torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::physical::CombinationalPath Class Reference

Routing net. More...

#include <CombinationalPath.hpp>

Public Types

typedef
RoutingNetSharedPtrVector::const_iterator 
RoutingNetSharedPtrConstIterator
 Constant iterator to Routing Net shared pointers. More...
 
typedef
RoutingNetSharedPtrVector::iterator 
RoutingNetSharedPtrIterator
 Non-constant iterator to Routing Net shared pointers. More...
 

Public Member Functions

RoutingNetSharedPtrIterator findRoutingNet (const string &inName)
 Find a net by name. More...
 
bool addRoutingNet (RoutingNetSharedPtr &inRoutingNetPtr)
 Add a net to the set. More...
 
bool removeRoutingNet (RoutingNetSharedPtr &inRoutingNetPtr)
 Remove a net from the circuit. More...
 
PinType getInstancePinType (InstancePinSharedPtr instancePinPtr)
 Returns instance pin type. More...
 
bool setPatchCounts (DesignSharedPtr inDesignPtr)
 Set combinational counts for all nets. More...
 
RoutingNetSharedPtrConstIterator routingNetsBegin (void) const
 Returns the begin constant iterator for routingNets. More...
 
RoutingNetSharedPtrConstIterator routingNetsEnd (void) const
 Returns the end constant iterator for routingNets. More...
 
RoutingNetSharedPtrIterator routingNetsBegin (void)
 Returns the begin non-constant iterator for routingNets. More...
 
RoutingNetSharedPtrIterator routingNetsEnd (void)
 Returns the end non-constant iterator for routingNets. More...
 
size_t getRoutingNetCount (void) const
 Returns the number of routingNets in the circuit. More...
 

Protected Types

typedef std::string string
 Imported type name. More...
 

Protected Member Functions

 CombinationalPath ()
 Protected constructor. More...
 

Protected Attributes

RoutingNetSharedPtrVector mRoutingNets
 Vector of routing net shared pointers. More...
 

Friends

class RcFactory
 The Factory class has direct access to our internals. More...
 

Detailed Description

Routing net.

Definition at line 34 of file CombinationalPath.hpp.

Member Typedef Documentation

typedef RoutingNetSharedPtrVector::const_iterator torc::physical::CombinationalPath::RoutingNetSharedPtrConstIterator

Constant iterator to Routing Net shared pointers.

Definition at line 55 of file CombinationalPath.hpp.

typedef RoutingNetSharedPtrVector::iterator torc::physical::CombinationalPath::RoutingNetSharedPtrIterator

Non-constant iterator to Routing Net shared pointers.

Definition at line 57 of file CombinationalPath.hpp.

typedef std::string torc::physical::CombinationalPath::string
protected

Imported type name.

Definition at line 41 of file CombinationalPath.hpp.

Constructor & Destructor Documentation

torc::physical::CombinationalPath::CombinationalPath ( )
inlineprotected

Protected constructor.

Parameters
originalnet
inNetTypeThe net power type.

Definition at line 51 of file CombinationalPath.hpp.

51 {}

Member Function Documentation

bool torc::physical::CombinationalPath::addRoutingNet ( RoutingNetSharedPtr inRoutingNetPtr)
inline

Add a net to the set.

Parameters
inRoutingNetPtrThe net to add.
Returns
true if the net was added, or false if a net with the same name already exists in the circuit.
Todo:
Acquire mutex.
Todo:
Release mutex.

Definition at line 70 of file CombinationalPath.hpp.

70  {
71  /// \todo Acquire mutex.
73  RoutingNetSharedPtrIterator result = findRoutingNet(inRoutingNetPtr->getName());
74  if(result != e) return false;
75  mRoutingNets.push_back(inRoutingNetPtr);
76  return true;
77  /// \todo Release mutex.
78  }
RoutingNetSharedPtrVector mRoutingNets
Vector of routing net shared pointers.
RoutingNetSharedPtrVector::iterator RoutingNetSharedPtrIterator
Non-constant iterator to Routing Net shared pointers.
RoutingNetSharedPtrIterator findRoutingNet(const string &inName)
Find a net by name.

+ Here is the call graph for this function:

RoutingNetSharedPtrIterator torc::physical::CombinationalPath::findRoutingNet ( const string inName)
inline

Find a net by name.

Parameters
inNameThe net name to look for.
Returns
an iterator to the specified net, or netsEnd() if the name was not found.

Definition at line 62 of file CombinationalPath.hpp.

62  {
63  NameComparator predicate(inName);
64  return std::find_if(routingNetsBegin(), routingNetsEnd(), predicate);
65  }
RoutingNetSharedPtrConstIterator routingNetsEnd(void) const
Returns the end constant iterator for routingNets.
RoutingNetSharedPtrConstIterator routingNetsBegin(void) const
Returns the begin constant iterator for routingNets.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PinType torc::physical::CombinationalPath::getInstancePinType ( InstancePinSharedPtr  instancePinPtr)
inline

Returns instance pin type.

Definition at line 94 of file CombinationalPath.hpp.

94  {
95 
96  NetSharedPtr netPtr = instancePinPtr->getParentWeakPtr().lock();
97  if(netPtr->containsSource(instancePinPtr))
98  return OutputP;
99  return InputP;
100  }
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.

+ Here is the caller graph for this function:

size_t torc::physical::CombinationalPath::getRoutingNetCount ( void  ) const
inline

Returns the number of routingNets in the circuit.

Definition at line 298 of file CombinationalPath.hpp.

298 { return mRoutingNets.size(); }
RoutingNetSharedPtrVector mRoutingNets
Vector of routing net shared pointers.
bool torc::physical::CombinationalPath::removeRoutingNet ( RoutingNetSharedPtr inRoutingNetPtr)
inline

Remove a net from the circuit.

Parameters
inRoutingNetPtrThe net to remove.
Returns
true if the net was removed, or false if the net did not exist.
Todo:
Acquire mutex.
Todo:
Release mutex.

Definition at line 82 of file CombinationalPath.hpp.

82  {
83  /// \todo Acquire mutex.
85  RoutingNetSharedPtrIterator result = findRoutingNet(inRoutingNetPtr->getName());
86  if(result == e) return false;
87  mRoutingNets.erase(result);
88  /// \todo Release mutex.
89  return true;
90  }
RoutingNetSharedPtrVector mRoutingNets
Vector of routing net shared pointers.
RoutingNetSharedPtrVector::iterator RoutingNetSharedPtrIterator
Non-constant iterator to Routing Net shared pointers.
RoutingNetSharedPtrIterator findRoutingNet(const string &inName)
Find a net by name.

+ Here is the call graph for this function:

RoutingNetSharedPtrConstIterator torc::physical::CombinationalPath::routingNetsBegin ( void  ) const
inline

Returns the begin constant iterator for routingNets.

Definition at line 290 of file CombinationalPath.hpp.

290 { return mRoutingNets.begin(); }
RoutingNetSharedPtrVector mRoutingNets
Vector of routing net shared pointers.

+ Here is the caller graph for this function:

RoutingNetSharedPtrIterator torc::physical::CombinationalPath::routingNetsBegin ( void  )
inline

Returns the begin non-constant iterator for routingNets.

Definition at line 294 of file CombinationalPath.hpp.

294 { return mRoutingNets.begin(); }
RoutingNetSharedPtrVector mRoutingNets
Vector of routing net shared pointers.
RoutingNetSharedPtrConstIterator torc::physical::CombinationalPath::routingNetsEnd ( void  ) const
inline

Returns the end constant iterator for routingNets.

Definition at line 292 of file CombinationalPath.hpp.

292 { return mRoutingNets.end(); }
RoutingNetSharedPtrVector mRoutingNets
Vector of routing net shared pointers.

+ Here is the caller graph for this function:

RoutingNetSharedPtrIterator torc::physical::CombinationalPath::routingNetsEnd ( void  )
inline

Returns the end non-constant iterator for routingNets.

Definition at line 296 of file CombinationalPath.hpp.

296 { return mRoutingNets.end(); }
RoutingNetSharedPtrVector mRoutingNets
Vector of routing net shared pointers.
bool torc::physical::CombinationalPath::setPatchCounts ( DesignSharedPtr  inDesignPtr)
inline

Set combinational counts for all nets.

Definition at line 102 of file CombinationalPath.hpp.

102  {
103 
104  Circuit::NetSharedPtrConstIterator pn = inDesignPtr->netsBegin();
105  Circuit::NetSharedPtrConstIterator en = inDesignPtr->netsEnd();
106  while(pn < en){
107  NetSharedPtr netPtr = *pn++;
108  RoutingNetSharedPtr routingNetPtr(new RoutingNet(netPtr));
109  mRoutingNets.push_back(routingNetPtr);
110  }
111  Circuit::InstanceSharedPtrConstIterator pi = inDesignPtr->instancesBegin();
112  Circuit::InstanceSharedPtrConstIterator ei = inDesignPtr->instancesEnd();
113  // set nets connected to flipflops
114  while(pi < ei) {
115  InstanceSharedPtr instance1Ptr = *pi++;
116  if((instance1Ptr->getType()=="DFF")||(instance1Ptr->getType()=="IOB")){
117  Instance::InstancePinSharedPtrConstIterator ipp = instance1Ptr->pinsBegin();
118  Instance::InstancePinSharedPtrConstIterator ipe = instance1Ptr->pinsEnd();
119  while(ipp != ipe) {
120  InstancePinSharedPtr instancePinPtr = ipp->second;
121  if(getInstancePinType(instancePinPtr) == InputP){
122  NetSharedPtr netPtr = instancePinPtr->getParentWeakPtr().lock();
123  RoutingNetSharedPtr routingNetPtr = *findRoutingNet(netPtr->getName());
124  Net::InstancePinSharedPtrConstIterator sop = netPtr->sourcesBegin();
125  Net::InstancePinSharedPtrConstIterator soe = netPtr->sourcesEnd();
126  while(sop < soe){
127  InstancePinSharedPtr instPin = *sop++;
128  routingNetPtr->setPathCount(instPin, 1);
129  }
130  }
131  ++ipp;
132  }
133  }
134  }
135  bool repeatNeeded = true;
136  size_t maxTotalCount = 0;
137  while(repeatNeeded){
138  if(maxTotalCount>inDesignPtr->getInstanceCount()){
139  cout<<"Combinational Loop !!!!!"<<endl;;
140  break;
141  }
142  repeatNeeded = false;
143  pi = inDesignPtr->instancesBegin();
144  ei = inDesignPtr->instancesEnd();
145 
146  // set nets connected to other gates
147  while(pi < ei) {
148  InstanceSharedPtr instance1Ptr = *pi++;
149  if((instance1Ptr->getType()!= "DFF")&&(instance1Ptr->getType()!= "IOB")){
150  size_t maxCount = 0;
151  Instance::InstancePinSharedPtrConstIterator ipp = instance1Ptr->pinsBegin();
152  Instance::InstancePinSharedPtrConstIterator ipe = instance1Ptr->pinsEnd();
153  while(ipp != ipe) {
154  InstancePinSharedPtr instancePinPtr = ipp->second;
155  if(getInstancePinType(instancePinPtr) == OutputP){
156  NetSharedPtr netPtr = instancePinPtr->getParentWeakPtr().lock();
157  RoutingNetSharedPtr routingNetPtr = *findRoutingNet(netPtr->getName());
158  Net::InstancePinSharedPtrConstIterator sop = netPtr->sourcesBegin();
159  Net::InstancePinSharedPtrConstIterator soe = netPtr->sourcesEnd();
160  while(sop < soe){
161  InstancePinSharedPtr instPin = *sop++;
162  size_t currCount = routingNetPtr->getPathCount(instPin);
163  if(currCount>maxCount)
164  maxCount = currCount;
165  if(maxTotalCount<maxCount)
166  maxTotalCount=maxCount;
167  }
168  }
169  ++ipp;
170  }
171  ipp = instance1Ptr->pinsBegin();
172  ipe = instance1Ptr->pinsEnd();
173  while(ipp != ipe) {
174  InstancePinSharedPtr instancePinPtr = ipp->second;
175  if(getInstancePinType(instancePinPtr) == InputP){
176  NetSharedPtr netPtr = instancePinPtr->getParentWeakPtr().lock();
177  RoutingNetSharedPtr routingNetPtr = *findRoutingNet(netPtr->getName());
178  if(routingNetPtr->getPathCount(instancePinPtr)<(maxCount+1)){
179  routingNetPtr->setPathCount(instancePinPtr,maxCount+1);
180  repeatNeeded = true;
181  }
182  Net::InstancePinSharedPtrConstIterator sop = netPtr->sourcesBegin();
183  Net::InstancePinSharedPtrConstIterator soe = netPtr->sourcesEnd();
184  while(sop < soe){
185  InstancePinSharedPtr instPin = *sop++;
186  size_t currCount = routingNetPtr->getPathCount(instPin);
187  if(currCount<(maxCount+1)){
188  routingNetPtr->setPathCount(instPin, maxCount+1);
189  maxCount = currCount;
190  if(maxTotalCount<maxCount)
191  maxTotalCount=maxCount;
192  repeatNeeded = true;
193  }
194  }
195  }
196  ++ipp;
197  }
198  }
199  }
200  }
201  pn = inDesignPtr->netsBegin();
202  en = inDesignPtr->netsEnd();
203  while(pn < en){
204  NetSharedPtr netPtr = *pn++;
205 
206  RoutingNetSharedPtr routingNetPtr = *findRoutingNet(netPtr->getName());
207  Net::InstancePinSharedPtrConstIterator sop = netPtr->sourcesBegin();
208  Net::InstancePinSharedPtrConstIterator soe = netPtr->sourcesEnd();
209  size_t setCount = 0;
210  while(sop<soe){
211  if(setCount<routingNetPtr->getPathCount(*sop))
212  setCount = routingNetPtr->getPathCount(*sop);
213  ++sop;
214  }
215 
216  Net::InstancePinSharedPtrConstIterator sip = netPtr->sinksBegin();
217  Net::InstancePinSharedPtrConstIterator sie = netPtr->sinksEnd();
218  while(sip!=sie){
219  if(routingNetPtr->getPathCount(*sip)==0)
220  routingNetPtr->setPathCount(*sip, setCount);
221  ++sip;
222  }
223  }
224 
225 
226  repeatNeeded = true;
227 
228  while(repeatNeeded){
229  repeatNeeded = false;
230  pi = inDesignPtr->instancesBegin();
231  ei = inDesignPtr->instancesEnd();
232 
233  // set nets connected to other gates
234  while(pi < ei) {
235  InstanceSharedPtr instance1Ptr = *pi++;
236  if((instance1Ptr->getType()!= "DFF")&&(instance1Ptr->getType()!= "IOB")){
237  size_t maxCount = 0;
238  Instance::InstancePinSharedPtrConstIterator ipp = instance1Ptr->pinsBegin();
239  Instance::InstancePinSharedPtrConstIterator ipe = instance1Ptr->pinsEnd();
240  while(ipp != ipe) {
241  InstancePinSharedPtr instancePinPtr = ipp->second;
242  if(getInstancePinType(instancePinPtr) == InputP){
243  NetSharedPtr netPtr = instancePinPtr->getParentWeakPtr().lock();
244  RoutingNetSharedPtr routingNetPtr = *findRoutingNet(netPtr->getName());
245  size_t currCount = routingNetPtr->getPathCount(instancePinPtr);
246  if(currCount>maxCount)
247  maxCount = currCount;
248  }
249  ++ipp;
250  }
251 
252  ipp = instance1Ptr->pinsBegin();
253  ipe = instance1Ptr->pinsEnd();
254  while(ipp != ipe) {
255  InstancePinSharedPtr instancePinPtr = ipp->second;
256  if(getInstancePinType(instancePinPtr) == OutputP){
257  NetSharedPtr netPtr = instancePinPtr->getParentWeakPtr().lock();
258  RoutingNetSharedPtr routingNetPtr = *findRoutingNet(netPtr->getName());
259  if(routingNetPtr->getPathCount(instancePinPtr)<(maxCount)){
260  routingNetPtr->setPathCount(instancePinPtr,maxCount);
261  repeatNeeded = true;
262  size_t minDiff = 100000000;
263  Net::InstancePinSharedPtrConstIterator sop = netPtr->sinksBegin();
264  Net::InstancePinSharedPtrConstIterator soe = netPtr->sinksEnd();
265  while(sop < soe){
266  InstancePinSharedPtr instPin = *sop++;
267  size_t currCount = maxCount - routingNetPtr->getPathCount(instPin);
268  if(currCount<minDiff){
269  minDiff = currCount;
270  }
271  }
272  sop = netPtr->sinksBegin();
273  soe = netPtr->sinksEnd();
274  while(sop < soe){
275  InstancePinSharedPtr instPin = *sop++;
276  size_t currCount = routingNetPtr->getPathCount(instPin);
277  routingNetPtr->setPathCount(instPin,currCount+minDiff);
278  }
279  }
280  }
281  ++ipp;
282  }
283  }
284  }
285  }
286  return true;
287  }
RoutingNetSharedPtrVector mRoutingNets
Vector of routing net shared pointers.
InstanceSharedPtrVector::const_iterator InstanceSharedPtrConstIterator
Constant iterator to Instance shared pointers.
Definition: Circuit.hpp:72
PinType getInstancePinType(InstancePinSharedPtr instancePinPtr)
Returns instance pin type.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
InstancePinMap::const_iterator InstancePinSharedPtrConstIterator
Constant iterator to InstancePin shared pointers.
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
InstancePinSharedPtrVector::const_iterator InstancePinSharedPtrConstIterator
Constant iterator to InstancePin shared pointer objects.
boost::shared_ptr< RoutingNet > RoutingNetSharedPtr
Shared pointer encapsulation of a RoutingNet.
Definition: RoutingNet.hpp:131
RoutingNetSharedPtrIterator findRoutingNet(const string &inName)
Find a net by name.
NetSharedPtrVector::const_iterator NetSharedPtrConstIterator
Constant iterator to Net shared pointers.
Definition: Circuit.hpp:76

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend class RcFactory
friend

The Factory class has direct access to our internals.

Definition at line 37 of file CombinationalPath.hpp.

Field Documentation

RoutingNetSharedPtrVector torc::physical::CombinationalPath::mRoutingNets
protected

Vector of routing net shared pointers.

Definition at line 45 of file CombinationalPath.hpp.


The documentation for this class was generated from the following file: