torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EdifContext.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef TORC_GENERIC_EDIF_EDIFCONTEXT_HPP
17 #define TORC_GENERIC_EDIF_EDIFCONTEXT_HPP
18 
21 #include <stack>
22 
23 //BOOST
24 #include <boost/shared_ptr.hpp>
25 
26 namespace torc { namespace generic { class Cell; } }
27 namespace torc { namespace generic { class Design; } }
28 namespace torc { namespace generic { class Instance; } }
29 namespace torc { namespace generic { class Library; } }
30 namespace torc { namespace generic { class Linker; } }
31 namespace torc { namespace generic { class Net; } }
32 namespace torc { namespace generic { class NetBundle; } }
33 namespace torc { namespace generic { class ObjectFactory; } }
34 namespace torc { namespace generic { class ParserOptions; } }
35 namespace torc { namespace generic { class Port; } }
36 namespace torc { namespace generic { class PortReference; } }
37 namespace torc { namespace generic { class PortBundle; } }
38 namespace torc { namespace generic { class Property; } }
39 namespace torc { namespace generic { class PropertyContainer; } }
40 namespace torc { namespace generic { class Root; } }
41 namespace torc { namespace generic { class View; } }
42 namespace torc { namespace generic { class Instance; } }
43 namespace torc { namespace generic { class Status; } }
44 namespace torc { namespace generic { class StatusContainer; } }
45 namespace torc { namespace generic { class Permutable; } }
46 namespace torc { namespace generic { class InterfaceJoinedInfo; } }
47 namespace torc { namespace generic { class SimulationInfo; } }
48 namespace torc { namespace generic { class Simulate; } }
49 namespace torc { namespace generic { class LogicValue; } }
50 namespace torc { namespace generic { class Apply; } }
51 namespace torc { namespace generic { class LogicalResponse; } }
52 namespace torc { namespace generic { class LogicElement; } }
53 namespace torc { namespace generic { class WaveValue; } }
54 namespace torc { namespace generic { class Timing; } }
55 namespace torc { namespace generic { class PathDelay; } }
56 namespace torc { namespace generic { class Event; } }
57 namespace torc { namespace generic { class ForbiddenEvent; } }
58 
59 
60 namespace torc {
61 namespace generic {
62 
63 class EdifContext {
64 public:
65  inline RootSharedPtr getRoot() const;
66 
67  void setRoot(const RootSharedPtr& inRoot);
68 
69  inline LinkerSharedPtr getLinker() const;
70 
71  void setLinker(const LinkerSharedPtr& inLinker);
72 
73  inline LibrarySharedPtr getCurrentLibrary() const;
74 
75  void setCurrentLibrary(const LibrarySharedPtr& inLibrary);
76 
77  inline CellSharedPtr getCurrentCell() const;
78 
79  void setCurrentCell(const CellSharedPtr& inCell);
80 
81  inline DesignSharedPtr getCurrentDesign() const;
82 
83  void setCurrentDesign(const DesignSharedPtr& inDesign);
84 
85  inline ViewSharedPtr getCurrentView() const;
86 
87  void setCurrentView(const ViewSharedPtr& inView);
88 
90 
91  void setCurrentInstance(const InstanceSharedPtr& inInstance);
92 
93  inline PortSharedPtr getCurrentPort() const;
94 
95  void setCurrentPort(const PortSharedPtr& inPort);
96 
98 
99  void setCurrentPortRef(const PortReferenceSharedPtr& inPortRef);
100 
101  void pushCurrentNet(const NetSharedPtr& inNet);
102 
104 
105  void popCurrentNet();
106 
107  void setCurrentNet(const NetSharedPtr& inNet);
108 
109  inline StatusSharedPtr getCurrentStatus() const;
110 
111  void setCurrentStatus(const StatusSharedPtr& inStatus);
112 
113  inline WrittenSharedPtr getCurrentWritten() const;
114 
115  void setCurrentWritten(const WrittenSharedPtr& inWritten);
116 
117  //For SimulationInfo
119 
120  void setCurrentSimulationInfo(const SimulationInfoSharedPtr& inSimulationInfo);
121 
122  //For Simulate
123  inline SimulateSharedPtr getCurrentSimulate() const;
124 
125  void setCurrentSimulate(const SimulateSharedPtr& inSimulate);
126 
127  //For Apply
128  inline ApplySharedPtr getCurrentApply() const;
129 
130  void setCurrentApply(const ApplySharedPtr& inApply);
131 
132  //For LogicalResponse
134 
135  void setCurrentLogicalResponse(const LogicalResponseSharedPtr& inLogicalResponse);
136 
137  //For WaveValue
139 
140  void setCurrentWaveValue(const WaveValueSharedPtr& inWaveValue);
141 
142  //For LogicValue
144 
145  void setCurrentLogicValue(const LogicValueSharedPtr& inLogicValue);
146 
147  //For Timing
148  inline TimingSharedPtr getCurrentTiming() const;
149 
150  void setCurrentTiming(const TimingSharedPtr& inTiming);
151 
152  //For PathDelay
154 
155  void setCurrentPathDelay(const PathDelaySharedPtr& inPathDelay);
156 
157  //For Event
158  inline EventSharedPtr getCurrentEvent() const;
159 
160  void setCurrentEvent(const EventSharedPtr& inEvent);
161 
162  //For ForbiddenEvent
164 
165  void setCurrentForbiddenEvent(const ForbiddenEventSharedPtr& inForbiddenEvent);
166 
167  void popStatusContainer();
168 
169  void pushStatusContainer(const StatusContainerSharedPtr& inStatusContainer);
170 
172 
174 
175  void pushPortBundleContext(PortBundleSharedPtr inPortBundleContext);
176 
177  void popPortBundleContext();
178 
180 
181  void pushNetBundleContext(NetBundleSharedPtr inNetBundleContext);
182 
183  void popNetBundleContext();
184 
185  inline bool getIsInInstance() const;
186 
187  void setIsInInstance(bool inIsInInstance);
188 
189  inline const ParserOptions& getOptions() const;
190 
191  inline ObjectFactorySharedPtr getFactory() const;
192 
193  void setFactory(const ObjectFactorySharedPtr& inFactory);
194 
195  inline bool getIsViewBeingLinked() const;
196 
197  void setIsViewBeingLinked(bool inIsViewBeingLinked);
198 
199  void pushProperty(const PropertySharedPtr& inProperty);
200 
201  void popProperty();
202 
204 
205  void popPropertyContainer();
206 
207  void pushPropertyContainer(const PropertyContainerSharedPtr& inPropertyContainer);
208 
210 
211  inline int32_t getPropertyDepth() const;
212 
213  void incrementPropertyDepth();
214 
215  void decrementPropertyDepth();
216 
217  //For Permutable
218  void pushPermutable(const PermutableSharedPtr& inPermutable);
219 
220  void popPermutable();
221 
223 
224  inline int32_t getPermutableDepth() const;
225 
227 
229 
230  //For InterfaceJoinedInfo
231  void pushInterfaceJoinedInfo(const InterfaceJoinedInfoSharedPtr& inInterfaceJoinedInfo);
232 
233  void popInterfaceJoinedInfo();
234 
236 
237  inline int32_t getInterfaceJoinedInfoDepth() const;
238 
240 
242 
243  //For LogicElement
244  void pushLogicElement(const LogicElementSharedPtr& inLogicElement);
245 
246  void popLogicElement();
247 
249 
250  inline int32_t getLogicElementDepth() const;
251 
253 
255 
256  EdifContext(const RootSharedPtr& inRoot, const LinkerSharedPtr& inLinker,
257  const ObjectFactorySharedPtr& inFactory, const ParserOptions& inOptions);
258  ~EdifContext() throw ();
259 
260 private:
275  std::stack<StatusContainerSharedPtr> mStatusContainer;
276  std::stack<PortBundleSharedPtr> mPortBundleContext;
277  std::stack<NetBundleSharedPtr> mNetBundleContext;
280  std::stack<PropertySharedPtr> mProperty;
281  std::stack<PropertyContainerSharedPtr> mPropertyContainer;
282  std::stack<NetSharedPtr> mNet;
283  int32_t mPropertyDepth;
284  std::stack<PermutableSharedPtr> mPermutable;
286  std::stack<InterfaceJoinedInfoSharedPtr> mInterfaceJoinedInfo;
298  std::stack<LogicElementSharedPtr> mLogicElement;
300 };
301 
303  return mRoot;
304 }
305 
307  return mLinker;
308 }
309 
311  return mCurrentLibrary;
312 }
313 
315  return mCurrentDesign;
316 }
317 
319  return mCurrentCell;
320 }
321 
323  return mCurrentView;
324 }
325 
327  return mCurrentInstance;
328 }
329 
331  return mCurrentPort;
332 }
333 
335  return mCurrentPortRef;
336 }
337 
338 inline bool EdifContext::getIsInInstance() const {
339  return mIsInInstance;
340 }
341 
343  return mCurrentStatus;
344 }
345 
347  return mCurrentWritten;
348 }
349 
351  return mCurrentSimulationInfo;
352 }
353 
355  return mCurrentSimulate;
356 }
357 
359  return mCurrentApply;
360 }
361 
364 }
365 
367  return mCurrentWaveValue;
368 }
369 
371  return mCurrentLogicValue;
372 }
373 
375  return mCurrentTiming;
376 }
377 
379  return mCurrentPathDelay;
380 }
381 
383  return mCurrentEvent;
384 }
385 
387  return mCurrentForbiddenEvent;
388 }
389 
390 inline const ParserOptions& EdifContext::getOptions() const {
391  return mOptions;
392 }
393 
395  return mFactory;
396 }
397 
399  return mIsViewBeingLinked;
400 }
401 
402 inline int32_t EdifContext::getPropertyDepth() const {
403  return mPropertyDepth;
404 }
405 
406 inline int32_t EdifContext::getPermutableDepth() const {
407  return mPermutableDepth;
408 }
409 
412 }
413 
414 inline int32_t EdifContext::getLogicElementDepth() const {
415  return mLogicElementDepth;
416 }
417 
418 } //namespace generic
419 } //namespace torc
420 
421 #endif // TORC_GENERIC_EDIF_EDIFCONTEXT_HPP
boost::shared_ptr< LogicValue > LogicValueSharedPtr
EventSharedPtr getCurrentEvent() const
boost::shared_ptr< Instance > InstanceSharedPtr
const ParserOptions & getOptions() const
InstanceSharedPtr mCurrentInstance
std::stack< NetSharedPtr > mNet
int32_t getPermutableDepth() const
boost::shared_ptr< StatusContainer > StatusContainerSharedPtr
int32_t getPropertyDepth() const
void setCurrentPort(const PortSharedPtr &inPort)
Definition: EdifContext.cpp:54
void pushCurrentNet(const NetSharedPtr &inNet)
Definition: EdifContext.cpp:62
TimingSharedPtr mCurrentTiming
void setCurrentForbiddenEvent(const ForbiddenEventSharedPtr &inForbiddenEvent)
std::stack< NetBundleSharedPtr > mNetBundleContext
void pushStatusContainer(const StatusContainerSharedPtr &inStatusContainer)
PortSharedPtr getCurrentPort() const
boost::shared_ptr< WaveValue > WaveValueSharedPtr
ObjectFactorySharedPtr getFactory() const
boost::shared_ptr< PropertyContainer > PropertyContainerSharedPtr
WaveValueSharedPtr getCurrentWaveValue() const
void setCurrentView(const ViewSharedPtr &inView)
Definition: EdifContext.cpp:46
PortReferenceSharedPtr getCurrentPortRef() const
boost::shared_ptr< LogicElement > LogicElementSharedPtr
boost::shared_ptr< PortBundle > PortBundleSharedPtr
int32_t getLogicElementDepth() const
boost::shared_ptr< Permutable > PermutableSharedPtr
void setCurrentEvent(const EventSharedPtr &inEvent)
ApplySharedPtr getCurrentApply() const
TimingSharedPtr getCurrentTiming() const
LogicalResponseSharedPtr mCurrentLogicalResponse
SimulateSharedPtr mCurrentSimulate
void setCurrentLibrary(const LibrarySharedPtr &inLibrary)
Definition: EdifContext.cpp:34
bool getIsViewBeingLinked() const
WaveValueSharedPtr mCurrentWaveValue
void setCurrentWritten(const WrittenSharedPtr &inWritten)
Definition: EdifContext.cpp:83
void setCurrentLogicalResponse(const LogicalResponseSharedPtr &inLogicalResponse)
Definition: EdifContext.cpp:99
WrittenSharedPtr getCurrentWritten() const
WrittenSharedPtr mCurrentWritten
boost::shared_ptr< Linker > LinkerSharedPtr
ForbiddenEventSharedPtr getCurrentForbiddenEvent() const
PermutableSharedPtr getCurrentPermutable()
int32_t getInterfaceJoinedInfoDepth() const
std::stack< PortBundleSharedPtr > mPortBundleContext
StatusSharedPtr mCurrentStatus
boost::shared_ptr< Written > WrittenSharedPtr
boost::shared_ptr< ObjectFactory > ObjectFactorySharedPtr
SimulateSharedPtr getCurrentSimulate() const
void setCurrentSimulationInfo(const SimulationInfoSharedPtr &inSimulationInfo)
Definition: EdifContext.cpp:87
void setCurrentSimulate(const SimulateSharedPtr &inSimulate)
Definition: EdifContext.cpp:91
boost::shared_ptr< Simulate > SimulateSharedPtr
void setCurrentInstance(const InstanceSharedPtr &inInstance)
Definition: EdifContext.cpp:50
boost::shared_ptr< Design > DesignSharedPtr
EventSharedPtr mCurrentEvent
void pushPermutable(const PermutableSharedPtr &inPermutable)
const ParserOptions & mOptions
InterfaceJoinedInfoSharedPtr getCurrentInterfaceJoinedInfo()
LogicValueSharedPtr getCurrentLogicValue() const
void setRoot(const RootSharedPtr &inRoot)
Definition: EdifContext.cpp:26
ObjectFactorySharedPtr mFactory
void setCurrentPathDelay(const PathDelaySharedPtr &inPathDelay)
PortBundleSharedPtr getCurrentPortBundleContext()
LinkerSharedPtr getLinker() const
boost::shared_ptr< LogicalResponse > LogicalResponseSharedPtr
CellSharedPtr getCurrentCell() const
boost::shared_ptr< Net > NetSharedPtr
std::stack< PropertySharedPtr > mProperty
boost::shared_ptr< Library > LibrarySharedPtr
boost::shared_ptr< PortReference > PortReferenceSharedPtr
boost::shared_ptr< SimulationInfo > SimulationInfoSharedPtr
LogicalResponseSharedPtr getCurrentLogicalResponse() const
NetBundleSharedPtr getCurrentNetBundleContext()
boost::shared_ptr< ForbiddenEvent > ForbiddenEventSharedPtr
ApplySharedPtr mCurrentApply
boost::shared_ptr< Apply > ApplySharedPtr
LibrarySharedPtr getCurrentLibrary() const
PathDelaySharedPtr mCurrentPathDelay
ViewSharedPtr getCurrentView() const
void setCurrentPortRef(const PortReferenceSharedPtr &inPortRef)
Definition: EdifContext.cpp:58
void setCurrentApply(const ApplySharedPtr &inApply)
Definition: EdifContext.cpp:95
void setCurrentCell(const CellSharedPtr &inCell)
Definition: EdifContext.cpp:42
void pushNetBundleContext(NetBundleSharedPtr inNetBundleContext)
boost::shared_ptr< Event > EventSharedPtr
void pushPortBundleContext(PortBundleSharedPtr inPortBundleContext)
void setCurrentStatus(const StatusSharedPtr &inStatus)
Definition: EdifContext.cpp:79
void pushInterfaceJoinedInfo(const InterfaceJoinedInfoSharedPtr &inInterfaceJoinedInfo)
void setCurrentWaveValue(const WaveValueSharedPtr &inWaveValue)
NetSharedPtr getCurrentNet()
Definition: EdifContext.cpp:75
void setCurrentNet(const NetSharedPtr &inNet)
Definition: EdifContext.cpp:66
SimulationInfoSharedPtr mCurrentSimulationInfo
void pushPropertyContainer(const PropertyContainerSharedPtr &inPropertyContainer)
void setCurrentTiming(const TimingSharedPtr &inTiming)
EdifContext(const RootSharedPtr &inRoot, const LinkerSharedPtr &inLinker, const ObjectFactorySharedPtr &inFactory, const ParserOptions &inOptions)
StatusSharedPtr getCurrentStatus() const
void setLinker(const LinkerSharedPtr &inLinker)
Definition: EdifContext.cpp:30
void setIsInInstance(bool inIsInInstance)
RootSharedPtr getRoot() const
LogicElementSharedPtr getCurrentLogicElement()
std::stack< LogicElementSharedPtr > mLogicElement
std::stack< StatusContainerSharedPtr > mStatusContainer
void setIsViewBeingLinked(bool inIsViewBeingLinked)
LogicValueSharedPtr mCurrentLogicValue
boost::shared_ptr< View > ViewSharedPtr
boost::shared_ptr< Cell > CellSharedPtr
boost::shared_ptr< InterfaceJoinedInfo > InterfaceJoinedInfoSharedPtr
DesignSharedPtr mCurrentDesign
void pushProperty(const PropertySharedPtr &inProperty)
PropertySharedPtr getCurrentProperty()
boost::shared_ptr< Port > PortSharedPtr
void pushLogicElement(const LogicElementSharedPtr &inLogicElement)
boost::shared_ptr< PathDelay > PathDelaySharedPtr
boost::shared_ptr< Property > PropertySharedPtr
std::stack< InterfaceJoinedInfoSharedPtr > mInterfaceJoinedInfo
DesignSharedPtr getCurrentDesign() const
InstanceSharedPtr getCurrentInstance() const
void setCurrentDesign(const DesignSharedPtr &inDesign)
Definition: EdifContext.cpp:38
StatusContainerSharedPtr getCurrentStatusContainer() const
PropertyContainerSharedPtr getCurrentPropertyContainer() const
void setCurrentLogicValue(const LogicValueSharedPtr &inLogicValue)
boost::shared_ptr< Timing > TimingSharedPtr
std::stack< PropertyContainerSharedPtr > mPropertyContainer
boost::shared_ptr< Status > StatusSharedPtr
PathDelaySharedPtr getCurrentPathDelay() const
std::stack< PermutableSharedPtr > mPermutable
boost::shared_ptr< NetBundle > NetBundleSharedPtr
ForbiddenEventSharedPtr mCurrentForbiddenEvent
SimulationInfoSharedPtr getCurrentSimulationInfo() const
LibrarySharedPtr mCurrentLibrary
void setFactory(const ObjectFactorySharedPtr &inFactory)
boost::shared_ptr< Root > RootSharedPtr
PortReferenceSharedPtr mCurrentPortRef