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

Unroutes connected resources in a DDB instance. More...

#include <Unrouter.hpp>

+ Collaboration diagram for torc::router::Unrouter:

Public Member Functions

 Unrouter (DDB &inDB)
 Public Constructor. More...
 
 ~Unrouter ()
 Destructor. More...
 
boost::int32_t unrouteToSinks (const Tilewire inTilewire)
 
RouteTreeNodetraceToSinks (Tilewire inTilewire)
 Trace from given Tilewire in a sinkwards direction only. More...
 
RouteTreeNodetraceBranch (Tilewire inTilewire)
 Trace from given Tilewire sinkwards and sourcewards to source or branch. More...
 
RouteTreeNodetraceToSource (Tilewire inTilewire)
 Trace from given Tilewire sourcewards to the source of the net. More...
 
RouteTreeNodetraceFull (Tilewire inTilewire)
 Trace from given Tilewire and recover the entire net. More...
 

Protected Types

enum  { eTraceToSource = 0, eTraceToBranch = 1, eTraceFullNet = 2 }
 

Protected Member Functions

void traceDownstream (RouteTreeNode *inNode)
 Remove the dummy node if possible. More...
 
void traceUpstream (RouteTreeNode *inNode, boost::int32_t inMode)
 Recursively traces from the specified RouteTreeNode in one of three modes. More...
 

Protected Attributes

DDBmDB
 Database reference. More...
 
ArcUsagemArcUsage
 ArcUsage reference. More...
 
WireUsagemWireUsage
 WireUsage reference. More...
 
TilewireVector mSegmentBuf
 Scratch segment storage. More...
 
TilewireVector mSinksBuf
 Scratch wire storage. More...
 
TilewireVector mSourcesBuf
 Scratch wire storage. More...
 
std::set< TilewiremTracedWiresBuf
 Traced wires collection. More...
 
TilewireVector mWireQueue
 

Private Types

typedef architecture::DDB DDB
 Imported type name. More...
 
typedef architecture::ArcUsage ArcUsage
 
typedef architecture::WireUsage WireUsage
 
typedef architecture::Tilewire Tilewire
 
typedef architecture::Arc Arc
 
typedef
architecture::TilewireVector 
TilewireVector
 
typedef architecture::ArcVector ArcVector
 

Detailed Description

Unroutes connected resources in a DDB instance.

The unrouter allows the user to deactivate pips and wires that are associated with one another as all or part of a net.

Definition at line 36 of file Unrouter.hpp.

Member Typedef Documentation

Definition at line 43 of file Unrouter.hpp.

Definition at line 40 of file Unrouter.hpp.

Definition at line 45 of file Unrouter.hpp.

Imported type name.

Definition at line 39 of file Unrouter.hpp.

Definition at line 42 of file Unrouter.hpp.

Definition at line 41 of file Unrouter.hpp.

Member Enumeration Documentation

anonymous enum
protected
Enumerator
eTraceToSource 
eTraceToBranch 
eTraceFullNet 

Definition at line 66 of file Unrouter.hpp.

Constructor & Destructor Documentation

torc::router::Unrouter::Unrouter ( DDB inDB)
inline

Public Constructor.

Definition at line 71 of file Unrouter.hpp.

71  : mDB(inDB), mArcUsage(inDB.getArcUsage()),
72  mWireUsage(inDB.getWireUsage()) {}
WireUsage & mWireUsage
WireUsage reference.
Definition: Unrouter.hpp:53
ArcUsage & mArcUsage
ArcUsage reference.
Definition: Unrouter.hpp:51
DDB & mDB
Database reference.
Definition: Unrouter.hpp:49
torc::router::Unrouter::~Unrouter ( )
inline

Destructor.

Definition at line 74 of file Unrouter.hpp.

74 {}

Member Function Documentation

RouteTreeNode* torc::router::Unrouter::traceBranch ( Tilewire  inTilewire)
inline

Trace from given Tilewire sinkwards and sourcewards to source or branch.

Traces from the specified source Tilewire. All downstream sinks are found and the closest branch point in the net or source is found.

Definition at line 126 of file Unrouter.hpp.

126  {
127  mTracedWiresBuf.clear();
128  RouteTreeNode* node = new RouteTreeNode(inTilewire, inTilewire, 0, 0);
130  // returned node is a dummy node
131  return node;
132  }
void traceUpstream(RouteTreeNode *inNode, boost::int32_t inMode)
Recursively traces from the specified RouteTreeNode in one of three modes.
Definition: Unrouter.hpp:275
std::set< Tilewire > mTracedWiresBuf
Traced wires collection.
Definition: Unrouter.hpp:61

+ Here is the call graph for this function:

void torc::router::Unrouter::traceDownstream ( RouteTreeNode inNode)
inlineprotected

Remove the dummy node if possible.

Removes the dummy node if it is at an end of the trace. If it is in the middle, it removes it if there is only one child. Otherwise no change is made. Find the source of net that owns the given Tilewire. Recursively traces from the specified RouteTreeNode.

Definition at line 241 of file Unrouter.hpp.

241  {
242  const Tilewire& nodeTilewire = inNode->getSinkTilewire();
243  std::vector<RouteTreeNode*> activeSinks;
244 
245  mSegmentBuf.clear();
246  mDB.expandSegment(nodeTilewire, mSegmentBuf);
247  TilewireVector::iterator p;
248  TilewireVector::iterator e = mSegmentBuf.end();
249  for (p = mSegmentBuf.begin(); p < e; p++) {
250  const Tilewire& segmentTilewire = *p;
251  mTracedWiresBuf.insert(segmentTilewire);
252  mSinksBuf.clear();
253  mDB.expandTilewireSinks(segmentTilewire, mSinksBuf);
254  TilewireVector::iterator q;
255  TilewireVector::iterator f = mSinksBuf.end();
256  for (q = mSinksBuf.begin(); q < f; q++) {
257  const Tilewire& sinkTilewire = *q;
258  if(mTracedWiresBuf.count(sinkTilewire) == 1) continue;
259  if(mArcUsage.isUsed(segmentTilewire, sinkTilewire)) {
260  activeSinks.push_back(new RouteTreeNode(
261  segmentTilewire, sinkTilewire, 0, inNode));
262  }
263  }
264  }
265  unsigned int activeSinksSize = activeSinks.size();
266  if(activeSinksSize == 0) return;
267 
268  inNode->addChildren(activeSinks);
269  for(unsigned int i = 0; i < activeSinksSize; i++) {
270  RouteTreeNode* childNode = inNode->getChild(i);
271  traceDownstream(childNode);
272  }
273  }
TilewireVector mSegmentBuf
Scratch segment storage.
Definition: Unrouter.hpp:55
TilewireVector mSinksBuf
Scratch wire storage.
Definition: Unrouter.hpp:57
void expandTilewireSinks(const Tilewire &inTilewire, TilewireVector &outSinks, bool inUseTied=true, bool inUseRegular=true, bool inUseIrregular=true, bool inUseRoutethrough=true)
Expands the given tilewire's arc sinks.
Definition: DDB.cpp:214
std::set< Tilewire > mTracedWiresBuf
Traced wires collection.
Definition: Unrouter.hpp:61
void traceDownstream(RouteTreeNode *inNode)
Remove the dummy node if possible.
Definition: Unrouter.hpp:241
ArcUsage & mArcUsage
ArcUsage reference.
Definition: Unrouter.hpp:51
bool isUsed(const Arc &inArc)
Determines whether the specified arc is in use.
Definition: ArcUsage.hpp:209
DDB & mDB
Database reference.
Definition: Unrouter.hpp:49
void expandSegment(const Tilewire &inTilewire, TilewireVector &outTilewires, EExpandDirection inExpandDirection=eExpandDirectionNone)
Expands the given tilewire's segment.
Definition: DDB.cpp:154
architecture::Tilewire Tilewire
Definition: Unrouter.hpp:42

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RouteTreeNode* torc::router::Unrouter::traceFull ( Tilewire  inTilewire)
inline

Trace from given Tilewire and recover the entire net.

Traces from the specified Tilewire. All net sinks and the source are recovered fully reconstructing the net to which the Tilewire belongs.

Definition at line 146 of file Unrouter.hpp.

146  {
147  mTracedWiresBuf.clear();
148  RouteTreeNode* node = new RouteTreeNode(inTilewire, inTilewire, 0, 0);
150  // returned node is a dummy node
151  return node;
152  }
void traceUpstream(RouteTreeNode *inNode, boost::int32_t inMode)
Recursively traces from the specified RouteTreeNode in one of three modes.
Definition: Unrouter.hpp:275
std::set< Tilewire > mTracedWiresBuf
Traced wires collection.
Definition: Unrouter.hpp:61

+ Here is the call graph for this function:

RouteTreeNode* torc::router::Unrouter::traceToSinks ( Tilewire  inTilewire)
inline

Trace from given Tilewire in a sinkwards direction only.

Traces from the specified source Tilewire in a sinkwards direction. If the Tilewire is a logic site output, then the result will be a full net.

Definition at line 116 of file Unrouter.hpp.

116  {
117  mTracedWiresBuf.clear();
118  RouteTreeNode* node = new RouteTreeNode(inTilewire, inTilewire, 0, 0);
119  traceDownstream(node);
120  // returned node is a dummy node
121  return node;
122  }
std::set< Tilewire > mTracedWiresBuf
Traced wires collection.
Definition: Unrouter.hpp:61
void traceDownstream(RouteTreeNode *inNode)
Remove the dummy node if possible.
Definition: Unrouter.hpp:241

+ Here is the call graph for this function:

RouteTreeNode* torc::router::Unrouter::traceToSource ( Tilewire  inTilewire)
inline

Trace from given Tilewire sourcewards to the source of the net.

Traces from the specified source Tilewire. All downstream sinks are found and the source of the net is found. Branch points are ignored.

Definition at line 136 of file Unrouter.hpp.

136  {
137  mTracedWiresBuf.clear();
138  RouteTreeNode* node = new RouteTreeNode(inTilewire, inTilewire, 0, 0);
140  // returned node is a dummy node
141  return node;
142  }
void traceUpstream(RouteTreeNode *inNode, boost::int32_t inMode)
Recursively traces from the specified RouteTreeNode in one of three modes.
Definition: Unrouter.hpp:275
std::set< Tilewire > mTracedWiresBuf
Traced wires collection.
Definition: Unrouter.hpp:61

+ Here is the call graph for this function:

void torc::router::Unrouter::traceUpstream ( RouteTreeNode inNode,
boost::int32_t  inMode 
)
inlineprotected

Recursively traces from the specified RouteTreeNode in one of three modes.

Definition at line 275 of file Unrouter.hpp.

275  {
276 //std::cout << mDB << "UP CALL " << inNode->getArc() << std::endl;
277  const Tilewire& nodeSourceTilewire = inNode->getSourceTilewire();
278  const Tilewire& nodeSinkTilewire = inNode->getSinkTilewire();
279  Arc parentArc;
280  bool foundParent = false;
281  std::vector<RouteTreeNode*> activeSinks;
282  mSegmentBuf.clear();
283  mDB.expandSegment(nodeSourceTilewire, mSegmentBuf);
284  TilewireVector::iterator p;
285  TilewireVector::iterator e = mSegmentBuf.end();
286  for (p = mSegmentBuf.begin(); p != e; p++) {
287  const Tilewire& segmentTilewire = *p;
288  mTracedWiresBuf.insert(segmentTilewire);
289  mSourcesBuf.clear();
290  mDB.expandTilewireSources(segmentTilewire, mSourcesBuf);
291  TilewireVector::iterator q;
292  TilewireVector::iterator f = mSourcesBuf.end();
293  for (q = mSourcesBuf.begin(); q != f; q++) {
294  const Tilewire& sourceTilewire = *q;
295  if (mTracedWiresBuf.count(sourceTilewire) == 1) {
296  std::cout << "ALREADY SEEN THIS TILEWIRE" << std::endl;
297  continue;
298  }
299  if (mArcUsage.isUsed(sourceTilewire, segmentTilewire)) {
300  if (foundParent) {
301  std::cout << "TRACER ERROR: MULTIPLE PARENTS" << std::endl;
302  throw;
303  }
304  parentArc = Arc(sourceTilewire, segmentTilewire);
305  foundParent = true;
306  }
307  }
308  }
309  // now look at the sinks unless the caller is only interested in top level source
310  if (inMode != eTraceToSource) {
311  mSegmentBuf.clear();
312  mDB.expandSegment(nodeSinkTilewire, mSegmentBuf);
313  e = mSegmentBuf.end();
314  for (p = mSegmentBuf.begin(); p < e; p++) {
315  Tilewire segmentTilewire = *p;
316  mTracedWiresBuf.insert(segmentTilewire);
317  mSinksBuf.clear();
318  mDB.expandTilewireSinks(segmentTilewire, mSinksBuf);
319  TilewireVector::iterator q;
320  TilewireVector::iterator f = mSinksBuf.end();
321  for (q = mSinksBuf.begin(); q < f; q++) {
322  Tilewire sinkTilewire = *q;
323  if (mTracedWiresBuf.count(sinkTilewire) == 1) {
324  std::cout << "ALREADY SEEN THIS TILEWIRE" << std::endl;
325  continue;
326  }
327  if (mArcUsage.isUsed(segmentTilewire, sinkTilewire)) {
328  activeSinks.push_back(new RouteTreeNode(
329  segmentTilewire, sinkTilewire, 0, inNode));
330  }
331  }
332  }
333  unsigned int activeSinksSize = activeSinks.size();
334  std::cout << "ACTIVE SINKS SIZE: " << activeSinksSize << std::endl;
335  std::cout << inMode << " " << eTraceToBranch << std::endl;
336  if (inMode == eTraceToBranch && activeSinksSize > 0) return;
337  if (activeSinksSize > 1) {
338  inNode->addChildren(activeSinks);
339  activeSinksSize = inNode->getNumChildren(); //WHY??
340  std::cout << activeSinksSize << std::endl;
341  for (unsigned int i = 0; i < activeSinksSize; i++) {
342  RouteTreeNode* newChildNode = inNode->getChild(i);
343  traceDownstream(newChildNode);
344  }
345  }
346  }
347 
348  if (foundParent) {
349 //std::cout << mDB << "\tFOUND PARENT " << parentArc << std::endl;
350  inNode->makeParent(parentArc.getSourceTilewire(), parentArc.getSinkTilewire());
351  RouteTreeNode* parentNode = (RouteTreeNode*)inNode->getParent();
352  traceUpstream(parentNode, inMode);
353  }
354  }
TilewireVector mSegmentBuf
Scratch segment storage.
Definition: Unrouter.hpp:55
TilewireVector mSourcesBuf
Scratch wire storage.
Definition: Unrouter.hpp:59
TilewireVector mSinksBuf
Scratch wire storage.
Definition: Unrouter.hpp:57
void expandTilewireSinks(const Tilewire &inTilewire, TilewireVector &outSinks, bool inUseTied=true, bool inUseRegular=true, bool inUseIrregular=true, bool inUseRoutethrough=true)
Expands the given tilewire's arc sinks.
Definition: DDB.cpp:214
void traceUpstream(RouteTreeNode *inNode, boost::int32_t inMode)
Recursively traces from the specified RouteTreeNode in one of three modes.
Definition: Unrouter.hpp:275
void expandTilewireSources(const Tilewire &inTilewire, TilewireVector &outSources, bool inUseTied=true, bool inUseRegular=true, bool inUseIrregular=true, bool inUseRoutethrough=true)
Expands the given tilewire's arc sources.
Definition: DDB.cpp:264
std::set< Tilewire > mTracedWiresBuf
Traced wires collection.
Definition: Unrouter.hpp:61
architecture::Arc Arc
Definition: Unrouter.hpp:43
void traceDownstream(RouteTreeNode *inNode)
Remove the dummy node if possible.
Definition: Unrouter.hpp:241
ArcUsage & mArcUsage
ArcUsage reference.
Definition: Unrouter.hpp:51
bool isUsed(const Arc &inArc)
Determines whether the specified arc is in use.
Definition: ArcUsage.hpp:209
DDB & mDB
Database reference.
Definition: Unrouter.hpp:49
void expandSegment(const Tilewire &inTilewire, TilewireVector &outTilewires, EExpandDirection inExpandDirection=eExpandDirectionNone)
Expands the given tilewire's segment.
Definition: DDB.cpp:154
architecture::Tilewire Tilewire
Definition: Unrouter.hpp:42

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

boost::int32_t torc::router::Unrouter::unrouteToSinks ( const Tilewire  inTilewire)
inline

Definition at line 77 of file Unrouter.hpp.

77  {
78  //mTracedWiresBuf.clear();
79  mWireQueue.clear();
80  mWireQueue.push_back(inTilewire);
81  Tilewire currentTilewire;
82  boost::int32_t releasedArcs = 0;
83 
84  while (mWireQueue.size() != 0) {
85  currentTilewire = mWireQueue.back();
86  mWireQueue.pop_back();
87 
88  mSegmentBuf.clear();
89  mDB.expandSegment(currentTilewire, mSegmentBuf);
90  TilewireVector::iterator p;
91  TilewireVector::iterator e = mSegmentBuf.end();
92  for (p = mSegmentBuf.begin(); p < e; p++) {
93  const Tilewire& segmentTilewire = *p;
94  mSinksBuf.clear();
95  mDB.expandTilewireSinks(segmentTilewire, mSinksBuf);
96  TilewireVector::iterator q;
97  TilewireVector::iterator f = mSinksBuf.end();
98  for (q = mSinksBuf.begin(); q < f; q++) {
99  const Tilewire& sinkTilewire = *q;
100  if(mArcUsage.isUsed(segmentTilewire, sinkTilewire)) {
101  mWireQueue.push_back(sinkTilewire);
102  Arc arc(segmentTilewire, sinkTilewire);
103  mDB.releaseArc(arc);
104  releasedArcs++;
105  }
106  }
107  }
108  }
109  return releasedArcs;
110  }
TilewireVector mSegmentBuf
Scratch segment storage.
Definition: Unrouter.hpp:55
TilewireVector mWireQueue
Definition: Unrouter.hpp:64
void releaseArc(const Arc &inArc, bool releaseSource=true, bool releaseSink=true)
Marks the arc and all of its source and sink segment wires as unused.
Definition: DDB.hpp:179
TilewireVector mSinksBuf
Scratch wire storage.
Definition: Unrouter.hpp:57
void expandTilewireSinks(const Tilewire &inTilewire, TilewireVector &outSinks, bool inUseTied=true, bool inUseRegular=true, bool inUseIrregular=true, bool inUseRoutethrough=true)
Expands the given tilewire's arc sinks.
Definition: DDB.cpp:214
architecture::Arc Arc
Definition: Unrouter.hpp:43
ArcUsage & mArcUsage
ArcUsage reference.
Definition: Unrouter.hpp:51
bool isUsed(const Arc &inArc)
Determines whether the specified arc is in use.
Definition: ArcUsage.hpp:209
DDB & mDB
Database reference.
Definition: Unrouter.hpp:49
void expandSegment(const Tilewire &inTilewire, TilewireVector &outTilewires, EExpandDirection inExpandDirection=eExpandDirectionNone)
Expands the given tilewire's segment.
Definition: DDB.cpp:154
architecture::Tilewire Tilewire
Definition: Unrouter.hpp:42

+ Here is the call graph for this function:

Field Documentation

ArcUsage& torc::router::Unrouter::mArcUsage
protected

ArcUsage reference.

Definition at line 51 of file Unrouter.hpp.

DDB& torc::router::Unrouter::mDB
protected

Database reference.

Definition at line 49 of file Unrouter.hpp.

TilewireVector torc::router::Unrouter::mSegmentBuf
protected

Scratch segment storage.

Definition at line 55 of file Unrouter.hpp.

TilewireVector torc::router::Unrouter::mSinksBuf
protected

Scratch wire storage.

Definition at line 57 of file Unrouter.hpp.

TilewireVector torc::router::Unrouter::mSourcesBuf
protected

Scratch wire storage.

Definition at line 59 of file Unrouter.hpp.

std::set<Tilewire> torc::router::Unrouter::mTracedWiresBuf
protected

Traced wires collection.

Definition at line 61 of file Unrouter.hpp.

TilewireVector torc::router::Unrouter::mWireQueue
protected

Definition at line 64 of file Unrouter.hpp.

WireUsage& torc::router::Unrouter::mWireUsage
protected

WireUsage reference.

Definition at line 53 of file Unrouter.hpp.


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