torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EdifContext.cpp
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 HAVE_CONFIG_H
17 #include "torc/generic/config.h"
18 #endif
19 
21 #include "torc/generic/Log.hpp"
22 
23 namespace torc {
24 namespace generic {
25 
26 void EdifContext::setRoot(const RootSharedPtr& inRoot) {
27  mRoot = inRoot;
28 }
29 
30 void EdifContext::setLinker(const LinkerSharedPtr& inLinker) {
31  mLinker = inLinker;
32 }
33 
35  mCurrentLibrary = inLibrary;
36 }
37 
39  mCurrentDesign = inDesign;
40 }
41 
43  mCurrentCell = inCell;
44 }
45 
47  mCurrentView = inView;
48 }
49 
51  mCurrentInstance = inInstance;
52 }
53 
55  mCurrentPort = inPort;
56 }
57 
59  mCurrentPortRef = inPortRef;
60 }
61 
63  mNet.push(inNet);
64 }
65 
67  mCurrentNet = inNet;
68 }
69 
71  assert(!mNet.empty());
72  mNet.pop();
73 }
74 
76  return (!mNet.empty()) ? mNet.top() : NetSharedPtr();
77 }
78 
80  mCurrentStatus = inStatus;
81 }
82 
84  mCurrentWritten = inWritten;
85 }
86 
88  mCurrentSimulationInfo = inSimulationInfo;
89 }
90 
92  mCurrentSimulate = inSimulate;
93 }
94 
96  mCurrentApply = inApply;
97 }
98 
100  mCurrentLogicalResponse = inLogicalResponse;
101 }
102 
104  mCurrentWaveValue = inWaveValue;
105 }
106 
108  mCurrentLogicValue = inLogicValue;
109 }
110 
112  mCurrentTiming = inTiming;
113 }
114 
116  mCurrentPathDelay = inPathDelay;
117 }
118 
120  mCurrentEvent = inEvent;
121 }
122 
124  mCurrentForbiddenEvent = inForbiddenEvent;
125 }
126 
128  mStatusContainer.push(inStatusContainer);
129 }
130 
132  assert(!mStatusContainer.empty());
133  mStatusContainer.pop();
134 }
135 
137  return (!mStatusContainer.empty()) ? mStatusContainer.top() : StatusContainerSharedPtr();
138 }
139 
141  return (!mPortBundleContext.empty()) ? mPortBundleContext.top() : PortBundleSharedPtr();
142 }
143 
145  mPortBundleContext.push(inPortBundleContext);
146 }
147 
149  assert(!mPortBundleContext.empty());
150  mPortBundleContext.pop();
151 }
152 
154  return (!mNetBundleContext.empty()) ? mNetBundleContext.top() : NetBundleSharedPtr();
155 }
156 
158  mNetBundleContext.push(inNetBundleContext);
159 }
160 
162  assert(!mNetBundleContext.empty());
163  mNetBundleContext.pop();
164 }
165 
166 void EdifContext::setIsInInstance(bool inIsInInstance) {
167  mIsInInstance = inIsInInstance;
168 }
169 
171  mFactory = inFactory;
172 }
173 
174 void EdifContext::setIsViewBeingLinked(bool inIsViewBeingLinked) {
175  mIsViewBeingLinked = inIsViewBeingLinked;
176 }
177 
179  mProperty.push(inProperty);
180 }
181 
183  assert(!mProperty.empty());
184  mProperty.pop();
185 }
186 
188  return (!mProperty.empty()) ? mProperty.top() : PropertySharedPtr();
189 }
190 
192  mPropertyContainer.push(inPropertyContainer);
193 }
194 
196  assert(!mPropertyContainer.empty());
197  mPropertyContainer.pop();
198 }
199 
201  mPropertyDepth++;
202 }
203 
205  mPropertyDepth--;
206 }
207 
210 }
211 
212 //For Permutable
214  mPermutable.push(inPermutable);
215 }
216 
218  assert(!mPermutable.empty());
219  mPermutable.pop();
220 }
221 
223  return (!mPermutable.empty()) ? mPermutable.top() : PermutableSharedPtr();
224 }
225 
228 }
229 
232 }
233 
234 //For Interface joined info
236  const InterfaceJoinedInfoSharedPtr& inInterfaceJoinedInfo) {
237  mInterfaceJoinedInfo.push(inInterfaceJoinedInfo);
238 }
239 
241  assert(!mInterfaceJoinedInfo.empty());
242  mInterfaceJoinedInfo.pop();
243 }
244 
246  return (!mInterfaceJoinedInfo.empty())
248 }
249 
252 }
253 
256 }
257 
258 //For LogicElement
260  mLogicElement.push(inLogicElement);
261 }
262 
264  assert(!mLogicElement.empty());
265  mLogicElement.pop();
266 }
267 
269  return (!mLogicElement.empty()) ? mLogicElement.top() : LogicElementSharedPtr();
270 }
271 
274 }
275 
278 }
279 
281  const ObjectFactorySharedPtr& inFactory, const ParserOptions& inOptions) : mRoot(inRoot),
282  mLinker(inLinker), mFactory(inFactory), mOptions(inOptions), mCurrentLibrary(),
283  mCurrentDesign(), mCurrentCell(), mCurrentView(), mCurrentInstance(), mCurrentPort(),
284  mCurrentNet(), mCurrentStatus(), mCurrentWritten(), mStatusContainer(), mPortBundleContext(),
285  mNetBundleContext(), mIsInInstance(), mIsViewBeingLinked(false), mProperty(),
286  mPropertyContainer(), mPropertyDepth(0), mPermutable(), mPermutableDepth(0),
287  mInterfaceJoinedInfo(), mInterfaceJoinedInfoDepth(0), mCurrentSimulationInfo(),
288  mCurrentSimulate(), mCurrentApply(), mCurrentLogicalResponse(), mCurrentWaveValue(),
289  mCurrentLogicValue(), mCurrentTiming(), mCurrentEvent(), mCurrentForbiddenEvent(),
290  mLogicElement(), mLogicElementDepth(0) {
291  log("Context created\n");
292 }
293 
295  log("Context destroyed\n");
296 }
297 
298 } //namespace generic
299 } //namespace torc
300 
boost::shared_ptr< LogicValue > LogicValueSharedPtr
void log(const char *fmt,...)
Definition: Log.cpp:89
boost::shared_ptr< Instance > InstanceSharedPtr
InstanceSharedPtr mCurrentInstance
std::stack< NetSharedPtr > mNet
boost::shared_ptr< StatusContainer > StatusContainerSharedPtr
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)
boost::shared_ptr< WaveValue > WaveValueSharedPtr
boost::shared_ptr< PropertyContainer > PropertyContainerSharedPtr
void setCurrentView(const ViewSharedPtr &inView)
Definition: EdifContext.cpp:46
boost::shared_ptr< LogicElement > LogicElementSharedPtr
boost::shared_ptr< PortBundle > PortBundleSharedPtr
boost::shared_ptr< Permutable > PermutableSharedPtr
void setCurrentEvent(const EventSharedPtr &inEvent)
LogicalResponseSharedPtr mCurrentLogicalResponse
SimulateSharedPtr mCurrentSimulate
void setCurrentLibrary(const LibrarySharedPtr &inLibrary)
Definition: EdifContext.cpp:34
WaveValueSharedPtr mCurrentWaveValue
void setCurrentWritten(const WrittenSharedPtr &inWritten)
Definition: EdifContext.cpp:83
void setCurrentLogicalResponse(const LogicalResponseSharedPtr &inLogicalResponse)
Definition: EdifContext.cpp:99
WrittenSharedPtr mCurrentWritten
boost::shared_ptr< Linker > LinkerSharedPtr
PermutableSharedPtr getCurrentPermutable()
std::stack< PortBundleSharedPtr > mPortBundleContext
StatusSharedPtr mCurrentStatus
boost::shared_ptr< Written > WrittenSharedPtr
boost::shared_ptr< ObjectFactory > ObjectFactorySharedPtr
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)
InterfaceJoinedInfoSharedPtr getCurrentInterfaceJoinedInfo()
void setRoot(const RootSharedPtr &inRoot)
Definition: EdifContext.cpp:26
ObjectFactorySharedPtr mFactory
void setCurrentPathDelay(const PathDelaySharedPtr &inPathDelay)
PortBundleSharedPtr getCurrentPortBundleContext()
boost::shared_ptr< LogicalResponse > LogicalResponseSharedPtr
boost::shared_ptr< Net > NetSharedPtr
std::stack< PropertySharedPtr > mProperty
boost::shared_ptr< Library > LibrarySharedPtr
boost::shared_ptr< PortReference > PortReferenceSharedPtr
boost::shared_ptr< SimulationInfo > SimulationInfoSharedPtr
NetBundleSharedPtr getCurrentNetBundleContext()
boost::shared_ptr< ForbiddenEvent > ForbiddenEventSharedPtr
ApplySharedPtr mCurrentApply
boost::shared_ptr< Apply > ApplySharedPtr
PathDelaySharedPtr mCurrentPathDelay
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)
void setLinker(const LinkerSharedPtr &inLinker)
Definition: EdifContext.cpp:30
void setIsInInstance(bool inIsInInstance)
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
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
std::stack< PermutableSharedPtr > mPermutable
boost::shared_ptr< NetBundle > NetBundleSharedPtr
ForbiddenEventSharedPtr mCurrentForbiddenEvent
LibrarySharedPtr mCurrentLibrary
void setFactory(const ObjectFactorySharedPtr &inFactory)
boost::shared_ptr< Root > RootSharedPtr
PortReferenceSharedPtr mCurrentPortRef