19 #ifndef TORC_ROUTER_TRACE_HPP
20 #define TORC_ROUTER_TRACE_HPP
81 switch (inTraceMode) {
89 std::cout <<
"Invalid Trace mode setting." << std::endl;
96 std::cout <<
"Destroying Trace!" << std::endl;
97 TraceNodePtrVector::iterator p;
98 TraceNodePtrVector::iterator e =
mAllNodes.end();
99 for (p =
mAllNodes.begin(); p != e; p++) {
123 std::map<TraceNode*, std::map<TraceNode*, Arc> >::iterator outer_p;
124 std::map<TraceNode*, std::map<TraceNode*, Arc> >::iterator outer_end;
125 std::map<TraceNode*, Arc>::iterator inner_p;
126 std::map<TraceNode*, Arc>::iterator inner_end;
129 std::map<TraceNode*, Arc> innermap = outer_p->second;
130 inner_end = innermap.end();
131 for (inner_p = innermap.begin(); inner_p != inner_end; inner_p++) {
152 unsigned int childCount = 0;
153 unsigned int parentCount = 0;
155 for (
unsigned int i = 0 ; i < outArcs.size(); i++) {
160 for (
unsigned int i = 0; i < inArcs.size(); i++) {
165 if (childCount == 0) {
167 std::cout <<
"FOUND A SINK NODE: " << nodeTilewire << std::endl;
169 if (parentCount == 0) {
171 std::cout <<
"FOUND A SOURCE NODE: " << nodeTilewire << std::endl;
173 if (childCount > 1 || parentCount > 1) {
175 std::cout <<
"FOUND A BRANCH NODE: " << nodeTilewire
176 <<
" children: " << childCount <<
" parents: " << parentCount << std::endl;
181 if (childCount == 1 && parentCount == 1) {
189 traceSinks = !isBranch;
192 traceSources = !isBranch;
197 for (
unsigned int i = 0; i < outArcs.size(); i++) {
198 const Tilewire& sinkTilewire = outArcs[i].getSinkTilewire();
208 activeSinks.push_back(arcNode);
224 for (
unsigned int i = 0; i < inArcs.size(); i++) {
225 const Tilewire& sourceTilewire = inArcs[i].getSourceTilewire();
235 activeSources.push_back(arcNode);
253 for (
unsigned int i = 0; i < activeSinks.size(); i++) {
261 for (
unsigned int i = 0; i < activeSources.size(); i++) {
274 std::set<Tilewire> nodesVisited;
279 for (
unsigned int i = 0; i < parents.size(); i++) {
281 std::cout <<
"PARENT " << parents[i]->getTilewire() << std::endl;
282 nodesVisited.insert(parents[i]->getTilewire());
283 for (
unsigned int j = 0; j < parents[i]->getNumChildren(); j++) {
284 wavefront.push_back(parents[i]->getChild(j));
287 while (wavefront.size() != 0) {
288 node = wavefront.front();
289 wavefront.pop_front();
292 if (nodesVisited.find(tw) == nodesVisited.end()) {
295 std::cout <<
"Already visited " << tw << std::endl;
299 std::cout <<
"SOURCE NODE" << std::endl;
310 std::cout <<
"SINK NODE" << std::endl;
313 wavefront.push_back(node->
getChild(i));
320 std::map<Tilewire, TraceNode*>::iterator it;
329 for (
unsigned int i = 0; i < segmentTilewires.size(); i++) {
331 std::pair<Tilewire, TraceNode*>(segmentTilewires[i], newNode));
337 std::map<Tilewire, TraceNode*>::iterator it;
348 std::map<TraceNode*, std::map<TraceNode*, Arc> >::iterator outer_p;
349 std::map<TraceNode*, std::map<TraceNode*, Arc> >::iterator outer_end;
350 std::map<TraceNode*, Arc>::iterator inner_p;
351 std::map<TraceNode*, Arc>::iterator inner_end;
354 if (outer_p != outer_end) {
355 std::map<TraceNode*, Arc> innermap = outer_p->second;
356 inner_end = innermap.end();
357 inner_p = innermap.find(sink);
358 if (inner_p != inner_end) {
359 return inner_p->second;
368 #endif // TORC_ROUTER_TRACE_HPP
TraceNodePtrVector & getSources()
Get trace source nodes.
TraceNode * createNode(Tilewire inTilewire)
Create a TraceNode and update auxiliary structures.
Encapsulation of an arc between two tilewires.
std::vector< Tilewire > TilewireVector
Vector of Tilewire objects.
Tilewire getTilewire()
Get the Tilewire associated with this node.
Device database, including complete wiring and logic support.
void addParent(TraceNode *newParent)
Add parent to the node.
TraceNode * getChild(boost::uint32_t index)
Get a child by index, returns 0 for invalid index.
architecture::DDB DDB
Imported type name.
void traceWorker(TraceNode *inNode, ETraceMode inMode)
Recursively traces from the specified TraceNode in the specified mode.
std::map< TraceNode *, std::map< TraceNode *, Arc > > mTraceNodesToArc
Map of TraceNode pointers to Arc that connects them.
TraceNode * getParent(boost::uint32_t index)
Get a parent by index, returns 0 for invalid index.
architecture::TilewireVector TilewireVector
Header for the TraceNode class.
architecture::ArcVector ArcVector
void expandSegmentSinks(const Tilewire &inTilewire, ArcVector &outSinks, EExpandDirection inExpandDirection=eExpandDirectionNone, bool inUseTied=true, bool inUseRegular=true, bool inUseIrregular=true, bool inUseRoutethrough=true)
Expands all sink arcs for the given tilewire's segment.
std::vector< TraceNode * > TraceNodePtrVector
Vector of TraceNode pointer.
TraceNodePtrVector & getBranchPoints()
Get trace branch point nodes.
boost::int32_t getDepth() const
Get the depth of this node from the furthest node with no parent.
TraceNode * getNode(Tilewire inTilewire)
Get a TraceNode based on its owning Tilewire.
ArcUsage & mArcUsage
ArcUsage reference.
std::vector< Arc > ArcVector
Vector of Arc objects.
TraceNodePtrVector mBranchPoints
Vector of net branch nodes.
Header for Boost.Test helper functions.
ArcVector & getArcs()
Get all Arcs found during the trace.
void setDepth(boost::int32_t inDepth)
Set the depth of this node.
Header for torc::physical output stream helpers.
std::map< Tilewire, TraceNode * > mTilewireToTraceNode
Map of Tilewires to owning TraceNode.
Provides path extraction from usage information in a DDB instance..
TraceNodePtrVector mSources
Vector of net source nodes.
Encapsulation of a device tile and wire pair.
architecture::Tilewire Tilewire
Encapsulation the design arc usage.
void expandSegmentSources(const Tilewire &inTilewire, ArcVector &outSources, EExpandDirection inExpandDirection=eExpandDirectionNone, bool inUseTied=true, bool inUseRegular=true, bool inUseIrregular=true, bool inUseRoutethrough=true)
Expands all source arcs for the given tilewire's segment.
void normalizeDepth(TraceNode *inNode)
Normalize depth of nodes.
TraceNodePtrVector mSinks
Vector of net sink nodes.
std::vector< TraceNode * > TraceNodePtrVector
Vector of TraceNode pointers.
ArcVector mArcVector
Vector of all arcs, populated on a getArcs call.
boost::uint32_t getNumParents()
Get the number of parents.
Arc findArc(TraceNode *source, TraceNode *sink)
Find a traced Arc from the nodes that it connects.
TraceNodePtrVector mAllNodes
Vector of all TraceNode pointers.
Trace(DDB &inDB, Tilewire inTilewire, ETraceMode inTraceMode=eTraceFullNet)
Public Constructor.
ETraceMode
Enumeration for Trace modes.
TraceNode * mInitialNode
TraceNode representing the starting point for this trace.
Header for the DDB class.
boost::uint32_t getNumChildren()
Get the number of children.
DDB & mDB
Database reference.
bool isUsed(const Arc &inArc)
Determines whether the specified arc is in use.
std::list< TraceNode * > TraceNodePtrList
List of TraceNode pointers.
An object that holds more complete path information for routing and tracing.
architecture::ArcUsage ArcUsage
void addChild(TraceNode *newChild)
brief Add child to the node.
void expandSegment(const Tilewire &inTilewire, TilewireVector &outTilewires, EExpandDirection inExpandDirection=eExpandDirectionNone)
Expands the given tilewire's segment.
TraceNodePtrVector & getSinks()
Get trace sink nodes.