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

Data Structures

class  NetRouter
 Provides net routing based on the Nilsson graphsearch algorithm. More...
 
class  NetRouterBase
 Abstract class for a net router. More...
 
class  NetRouterHeuristic
 Provides net routing based on the Nillson graphsearch algorithm. More...
 
class  NetRouterHeuristicBase
 Provides the interface for net routers. More...
 
class  NetVectorRouterBase
 Abstract class for a net router. More...
 
class  NetVectorRouterHeuristicBase
 Provides net routing based on the Nillson graphsearch algorithm. More...
 
struct  TilewireData
 Pathfinder annotations for Tilewires. More...
 
class  PathFinder
 
class  PathFinderHeuristic
 Provides net routing based on the Nillson graphsearch algorithm. More...
 
class  PathFinderNetRouterHeuristic
 Provides net routing based on the Nillson graphsearch algorithm. More...
 
class  RouteNet
 Router net. More...
 
class  RouteNode
 An object that holds an arc and path information for routing. More...
 
class  RouteNodePtrCostCompare
 Binary predicate for comparing RouteNode pointers based on cost. More...
 
class  RouterHeuristicBase
 Provides the interface for net routers. More...
 
struct  RouterStatistics
 Router Statistics net. More...
 
class  RouteTreeNode
 An object that holds more complete path information for routing and tracing. More...
 
class  RouteUtilities
 Router net. More...
 
class  Trace
 Provides path extraction from usage information in a DDB instance.. More...
 
class  TraceNode
 An object that holds more complete path information for routing and tracing. More...
 
struct  TraceVirtex5TestFixture
 
struct  TraceVirtexTristateTestFixture
 
struct  TraceUnitTestFixture
 
class  Unrouter
 Unroutes connected resources in a DDB instance. More...
 
struct  TracerTestFixture
 

Typedefs

typedef std::vector< RouteNetRouteNetVector
 Vector of RouteNet objects. More...
 
typedef std::vector< RouteNode * > RouteNodePtrVector
 Vector of RouteNode pointers. More...
 
typedef std::vector< TraceNode * > TraceNodePtrVector
 Vector of TraceNode pointer. More...
 

Enumerations

enum  ERoutePropertyType { eRouteTime = 0, eRoutePropertyTypeCount }
 

Functions

 BOOST_AUTO_TEST_CASE (NetRouterHeuristicT)
 Unit test for the Heuristic. More...
 
 BOOST_AUTO_TEST_CASE (NetRouterT)
 Unit test for the NetRouter. More...
 
 BOOST_AUTO_TEST_CASE (PathFinderHeuristic)
 Unit test for the PathFinderHeuristic. More...
 
void testRouteDesign (std::string path, std::string exportpath)
 
 BOOST_AUTO_TEST_CASE (pathfinder_virtex2p)
 Spartan3E regression. More...
 
 BOOST_AUTO_TEST_CASE (pathfinder_virtex4)
 Virtex4 regression. More...
 
 BOOST_AUTO_TEST_CASE (pathfinder_virtex5)
 Virtex5 regression. More...
 
 BOOST_AUTO_TEST_CASE (pathfinder_virtex6)
 Virtex6 regression. More...
 
 BOOST_AUTO_TEST_CASE (PathFinder)
 Unit test for the NetRouter. More...
 
 BOOST_AUTO_TEST_CASE (RouteNetT)
 Unit test for the Net class. More...
 
 BOOST_AUTO_TEST_CASE (RouteNodeT)
 Unit test for the RouteNode class. More...
 
 BOOST_AUTO_TEST_CASE (RouteTreeNodeT)
 Unit test for the RouteNode class. More...
 
 BOOST_AUTO_TEST_CASE (TraceNodeT)
 Unit test for the RouteNode class. More...
 
 BOOST_AUTO_TEST_CASE (FullNet)
 Unit test for the findTop and normalizeDepth functions in the Tracer. More...
 
 BOOST_AUTO_TEST_CASE (trace_full_net)
 
 BOOST_AUTO_TEST_CASE (trace_to_sinks)
 
 BOOST_AUTO_TEST_CASE (trace_to_branch)
 
 BOOST_AUTO_TEST_CASE (trace_to_sources)
 
 BOOST_AUTO_TEST_CASE (trace_single_path)
 

Typedef Documentation

typedef std::vector<RouteNet> torc::router::RouteNetVector

Vector of RouteNet objects.

Definition at line 205 of file RouteNet.hpp.

Vector of RouteNode pointers.

Definition at line 115 of file RouteNode.hpp.

Vector of TraceNode pointer.

Definition at line 192 of file TraceNode.hpp.

Enumeration Type Documentation

Enumerator
eRouteTime 
eRoutePropertyTypeCount 

Definition at line 33 of file RouteNet.hpp.

Function Documentation

torc::router::BOOST_AUTO_TEST_CASE ( PathFinderHeuristic  )

Unit test for the PathFinderHeuristic.

Definition at line 28 of file PathFinderHeuristicUnitTest.cpp.

28  {
29 
30  BOOST_CHECK_EQUAL(1 == 1, true);
31 
32 }
torc::router::BOOST_AUTO_TEST_CASE ( RouteNetT  )

Unit test for the Net class.

Definition at line 28 of file RouteNetUnitTest.cpp.

28  {
29  typedef architecture::Tilewire Tilewire;
31  typedef architecture::Arc Arc;
33  typedef std::string string;
34 
35  Tilewire tilewire1(architecture::xilinx::TileIndex(100), architecture::xilinx::WireIndex(2));
36  Tilewire tilewire2(architecture::xilinx::TileIndex(100), architecture::xilinx::WireIndex(3));
37  Tilewire tilewire3(architecture::xilinx::TileIndex(120), architecture::xilinx::WireIndex(2));
38  Tilewire tilewire4(architecture::xilinx::TileIndex(120), architecture::xilinx::WireIndex(3));
39  Arc arc1(tilewire1, tilewire2);
40  Arc arc2(tilewire2, tilewire3);
41  string name1 = "Name1";
42  string name2 = "Name2";
43  TilewireVector sources;
44  TilewireVector sinks;
45  sources.push_back(tilewire1);
46  sinks.push_back(tilewire2);
47  sinks.push_back(tilewire3);
48 
49  // features tested:
50  // sizeof(RouteNet);
51  BOOST_CHECK_EQUAL(sizeof(RouteNet), sizeof(string) + sizeof(TilewireVector)
52  + sizeof(TilewireVector) + sizeof(ArcVector) + sizeof(RouteNodePtrVector)
53  + sizeof(boost::unordered_map<boost::uint32_t, boost::any>));
54  //BOOST_CHECK_EQUAL(sizeof(RouteNet), 144u);
55 
56  // functions tested:
57  // RouteNet(string& inName);
58  // RouteNet(string& inName, const TilewireVector& inSources, const TilewireVector& inSinks)
59  RouteNet rn1(name1);
60  RouteNet rn2(name2, sources, sinks);
61 
62  // functions tested:
63  // bool containsSource(Tilewire inTilewire)
64  // bool containsSink(Tilewire inTilewire)
65  // bool containsArc(const Arc& inArc)
66  // void addSource(Tilewire inTilewire)
67  // void addSink(Tilewire inTilewire)
68  // bool removeSource(Tilewire inTilewire)
69  // bool removeSink(Tilewire inTilewire)
70  // void addArc(const Arc& inArc)
71  // bool removeArc(const Arc& inArc)
72  // void unroute(void)
73  // bool hasAnySources(void) const
74  // bool hasOneSource(void) const
75  // bool hasMultipleSources(void) const
76  // size_t getSourceCount(void) const
77  // bool hasAnySinks(void) const
78  // bool hasOneSink(void) const
79  // bool hasMultipleSinks(void) const
80  // size_t getSinkCount(void) const
81  // bool hasAnyArcs(void) const
82  // size_t getArcCount(void) const
83  // const string& const getName()
84  BOOST_CHECK_EQUAL(rn1.getName(), name1);
85  BOOST_CHECK_EQUAL(rn1.containsSource(tilewire4), false);
86  BOOST_CHECK_EQUAL(rn1.containsSink(tilewire4), false);
87  BOOST_CHECK_EQUAL(rn1.containsArc(arc1), false);
88  BOOST_CHECK_EQUAL(rn1.hasAnySources(), false);
89  BOOST_CHECK_EQUAL(rn1.hasOneSource(), false);
90  BOOST_CHECK_EQUAL(rn1.hasAnySinks(), false);
91  BOOST_CHECK_EQUAL(rn1.hasOneSink(), false);
92  BOOST_CHECK_EQUAL(rn1.hasMultipleSources(), false);
93  BOOST_CHECK_EQUAL(rn1.hasMultipleSinks(), false);
94  BOOST_CHECK_EQUAL(rn1.hasAnyArcs(), false);
95  BOOST_CHECK_EQUAL(rn1.removeSource(tilewire2), false);
96  BOOST_CHECK_EQUAL(rn1.removeSink(tilewire2), false);
97  BOOST_CHECK_EQUAL(rn1.removeArc(arc1), false);
98 
99  BOOST_CHECK_EQUAL(rn2.getName(), name2);
100  BOOST_CHECK_EQUAL(rn2.hasAnySources(), true);
101  BOOST_CHECK_EQUAL(rn2.hasOneSource(), true);
102  BOOST_CHECK_EQUAL(rn2.hasAnySinks(), true);
103  BOOST_CHECK_EQUAL(rn2.hasMultipleSinks(), true);
104  BOOST_CHECK_EQUAL(rn2.containsSource(tilewire1), true);
105  BOOST_CHECK_EQUAL(rn2.containsSink(tilewire3), true);
106  BOOST_CHECK_EQUAL(rn2.containsArc(arc1), false);
107  rn2.addArc(arc1);
108  BOOST_CHECK_EQUAL(rn2.containsArc(arc1), true);
109  BOOST_CHECK_EQUAL(rn2.containsSource(tilewire4), false);
110  rn2.addSource(tilewire4);
111  BOOST_CHECK_EQUAL(rn2.containsSource(tilewire4), true);
112  BOOST_CHECK_EQUAL(rn2.removeSource(tilewire4), true);
113  BOOST_CHECK_EQUAL(rn2.containsSource(tilewire4), false);
114  BOOST_CHECK_EQUAL(rn2.containsSink(tilewire2), true);
115  BOOST_CHECK_EQUAL(rn2.removeSink(tilewire2), true);
116  BOOST_CHECK_EQUAL(rn2.containsSink(tilewire2), false);
117  rn2.addSink(tilewire2);
118  BOOST_CHECK_EQUAL(rn2.containsSink(tilewire2), true);
119  BOOST_CHECK_EQUAL(rn2.getArcCount(), 1u);
120 
121 
122 
123 
124 
125 }
std::vector< Tilewire > TilewireVector
Vector of Tilewire objects.
Definition: Tilewire.hpp:101
std::vector< RouteNode * > RouteNodePtrVector
Vector of RouteNode pointers.
Definition: RouteNode.hpp:115
std::vector< Arc > ArcVector
Vector of Arc objects.
Definition: Arc.hpp:78
std::string string

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( RouteNodeT  )

Unit test for the RouteNode class.

Definition at line 28 of file RouteNodeUnitTest.cpp.

28  {
29  typedef architecture::Tilewire Tilewire;
30  typedef architecture::Arc Arc;
31  // create accessory wires and tiles
32  Tilewire tilewire1(architecture::xilinx::TileIndex(100), architecture::xilinx::WireIndex(2));
33  Tilewire tilewire2(architecture::xilinx::TileIndex(100), architecture::xilinx::WireIndex(3));
34  Tilewire tilewire3(architecture::xilinx::TileIndex(120), architecture::xilinx::WireIndex(2));
35  Tilewire tilewire4(architecture::xilinx::TileIndex(120), architecture::xilinx::WireIndex(3));
36  boost::int32_t cost1 = 4;
37  boost::int32_t cost2 = 5;
38  Arc arc1(tilewire1, tilewire2);
39  Arc arc2(tilewire2, tilewire3);
40 
41 
42  // features tested:
43  // sizeof(RouteNode)
44  BOOST_CHECK_EQUAL(sizeof(RouteNode), sizeof(architecture::Arc) + sizeof(RouteNode*)
45  + (3 * sizeof(boost::int32_t)));
46  BOOST_CHECK_EQUAL(sizeof(RouteNode), 32u);
47 
48  // functions tested:
49  // RouteNode(void);
50  // RouteNode(Tilewire inSource, Tilewire inSink, RouteNodeCost inCost,
51  // RouteNode* inParent);
52  RouteNode* routenode1 = new RouteNode(tilewire1, tilewire2, cost1, cost1, 0, 0);
53  RouteNode* routenode2 = new RouteNode(arc2, cost1, cost1, 1, routenode1);
54  RouteNode* routenode3 = new RouteNode(tilewire3, tilewire4, cost2, cost2, 2, routenode2);
55  RouteNode* routenode4 = new RouteNode();
56  BOOST_CHECK_EQUAL(routenode1 != 0, true);
57  BOOST_CHECK_EQUAL(routenode2 != 0, true);
58  BOOST_CHECK_EQUAL(routenode3 != 0, true);
59  BOOST_CHECK_EQUAL(routenode4 != 0, true);
60 
61  // functions tested:
62  // const Arc& getArc() const;
63  // const Tilewire& getSourceTilewire() const;
64  // const Tilewire& getSinkTilewire() const;
65  // const boost::int32_t getCost() const;
66  // void setCost(boost::int32_t inCost);
67  // RouteNode* getParent() const;
68  // RouteNode* getTop();
69  architecture::Arc arc1t = routenode1->getArc();
70  BOOST_CHECK_EQUAL(arc1t == arc1, true);
71  BOOST_CHECK_EQUAL(routenode2->getSourceTilewire() == tilewire2, true);
72  BOOST_CHECK_EQUAL(routenode2->getSinkTilewire() == tilewire3, true);
73  BOOST_CHECK_EQUAL(routenode3->getCost() == cost2, true);
74  BOOST_CHECK_EQUAL(routenode4->getCost() == 0, true);
75  BOOST_CHECK_EQUAL(routenode3->getPathCost() == cost2, true);
76  routenode4->setCost(42);
77  BOOST_CHECK_EQUAL(routenode4->getCost() == 42, true);
78  BOOST_CHECK_EQUAL(routenode3->getParent() == routenode2, true);
79  BOOST_CHECK_EQUAL(routenode3->getTop() == routenode1, true);
80 
81  // Test the comparison class
82  RouteNodePtrCostCompare compare;
83  BOOST_CHECK_EQUAL(compare(routenode1, routenode1), false);
84  BOOST_CHECK_EQUAL(compare(routenode2, routenode3), false);
85  BOOST_CHECK_EQUAL(compare(routenode3, routenode2), true);
86 
87  delete routenode1;
88  delete routenode2;
89  delete routenode3;
90  delete routenode4;
91 }

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( RouteTreeNodeT  )

Unit test for the RouteNode class.

Definition at line 28 of file RouteTreeNodeUnitTest.cpp.

28  {
29  typedef architecture::Tilewire Tilewire;
30  typedef architecture::Arc Arc;
31  // create accessory wires and tiles
32  Tilewire tilewire1(architecture::xilinx::TileIndex(100), architecture::xilinx::WireIndex(2));
33  Tilewire tilewire2(architecture::xilinx::TileIndex(100), architecture::xilinx::WireIndex(3));
34  Tilewire tilewire3(architecture::xilinx::TileIndex(120), architecture::xilinx::WireIndex(2));
35  Tilewire tilewire4(architecture::xilinx::TileIndex(120), architecture::xilinx::WireIndex(3));
36  Arc arc2(tilewire2, tilewire3);
37  boost::int32_t cost1 = 4;
38  boost::int32_t cost2 = 5;
39 
40  // features tested:
41  // sizeof(RouteNode)
42  BOOST_CHECK_EQUAL(sizeof(RouteTreeNode), sizeof(RouteNode)
43  + sizeof(RouteTreeNode*) + sizeof(std::vector<RouteTreeNode*>*));
44  BOOST_CHECK_EQUAL(sizeof(RouteNode), 32u);
45  BOOST_CHECK_EQUAL(sizeof(RouteTreeNode), 48u);
46  BOOST_CHECK_EQUAL(sizeof(RouteTreeNode*), 8u);
47  BOOST_CHECK_EQUAL(sizeof(std::vector<RouteTreeNode*>*), 8u);
48  BOOST_CHECK_EQUAL(sizeof(boost::int32_t), 4u);
49 
50  // functions tested:
51  // RouteTreeNode();
52  // RouteTreeNode(Tilewire inSource, Tilewire inSink, boost::int32_t inCost,
53  // RouteTreeNode* inParent)
54  RouteTreeNode* routenode1 = new RouteTreeNode(tilewire1, tilewire2, cost1, 0);
55  RouteTreeNode* routenode2 = new RouteTreeNode(arc2, cost1, routenode1);
56  RouteTreeNode* routenode3 = new RouteTreeNode(tilewire3, tilewire4, cost2, routenode2);
57  RouteTreeNode* routenode4 = new RouteTreeNode(tilewire4, tilewire1, cost2, routenode2);
58  RouteTreeNode* routenode5 = new RouteTreeNode();
59  BOOST_CHECK_EQUAL(routenode1 != 0, true);
60  BOOST_CHECK_EQUAL(routenode2 != 0, true);
61  BOOST_CHECK_EQUAL(routenode3 != 0, true);
62  BOOST_CHECK_EQUAL(routenode4 != 0, true);
63  BOOST_CHECK_EQUAL(routenode5 != 0, true);
64 
65  // functions tested:
66  // boost::int32_t getDepth() const;
67  // addChildren(const std::vector<RouteTreeNode*>& newChildren);
68  // boost::uint16_t getNumChildren();
69  // RouteTreeNode* getChild(unsigned int index);
70  // makeParent(const Tilewire& inSource, const Tilewire& inSink;
71  // void normalizeDepth;
72  // void adjustDepth(int adjustment);
73  std::vector<RouteTreeNode*> vec1;
74  vec1.push_back(routenode2);
75  std::vector<RouteTreeNode*> vec2;
76  vec2.push_back(routenode3);
77  vec2.push_back(routenode4);
78  routenode1->addChildren(vec1);
79  routenode2->addChildren(vec2);
80  BOOST_CHECK_EQUAL(routenode1->getDepth() == 0, true);
81  BOOST_CHECK_EQUAL(routenode2->getDepth() == 1, true);
82  BOOST_CHECK_EQUAL(routenode3->getDepth() == 2, true);
83  BOOST_CHECK_EQUAL(routenode4->getDepth() == 2, true);
84  BOOST_CHECK_EQUAL(routenode5->getDepth() == -1, true);
85  BOOST_CHECK_EQUAL(routenode1->getNumChildren() == 1, true);
86  BOOST_CHECK_EQUAL(routenode2->getNumChildren() == 2, true);
87  BOOST_CHECK_EQUAL(routenode3->getNumChildren() == 0, true);
88  BOOST_CHECK_EQUAL(routenode4->getNumChildren() == 0, true);
89  BOOST_CHECK_EQUAL(routenode1->getChild(0) == routenode2, true);
90  BOOST_CHECK_EQUAL(routenode2->getChild(0) == routenode3, true);
91  BOOST_CHECK_EQUAL(routenode2->getChild(1) == routenode4, true);
92 
93  routenode1->makeParent(tilewire4, tilewire3);
94  BOOST_CHECK_EQUAL(tilewire1 == routenode1->getSourceTilewire(), true);
95  BOOST_CHECK_EQUAL(tilewire2 == routenode1->getSinkTilewire(), true);
96  RouteTreeNode* parentnode = (RouteTreeNode*)routenode1->getParent();
97  BOOST_CHECK_EQUAL(tilewire4 == parentnode->getSourceTilewire(), true);
98  BOOST_CHECK_EQUAL(tilewire3 == parentnode->getSinkTilewire(), true);
99  BOOST_CHECK_EQUAL(parentnode->getDepth() == -1, true);
100  routenode4->normalizeDepth();
101  BOOST_CHECK_EQUAL(parentnode->getDepth() == 0, true);
102  BOOST_CHECK_EQUAL(routenode1->getDepth() == 1, true);
103  BOOST_CHECK_EQUAL(routenode2->getDepth() == 2, true);
104  BOOST_CHECK_EQUAL(routenode3->getDepth() == 3, true);
105  BOOST_CHECK_EQUAL(routenode4->getDepth() == 3, true);
106  BOOST_CHECK_EQUAL(routenode5->getDepth() == -1, true);
107 }

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( TraceNodeT  )

Unit test for the RouteNode class.

Definition at line 30 of file TraceNodeUnitTest.cpp.

30  {
31  typedef architecture::Tilewire Tilewire;
32  typedef architecture::Arc Arc;
33 
34  // create accessory wires and tiles
35  Tilewire tilewire1(architecture::xilinx::TileIndex(100), architecture::xilinx::WireIndex(1));
36  Tilewire tilewire2(architecture::xilinx::TileIndex(100), architecture::xilinx::WireIndex(2));
37  Tilewire tilewire3(architecture::xilinx::TileIndex(120), architecture::xilinx::WireIndex(3));
38  Tilewire tilewire4(architecture::xilinx::TileIndex(120), architecture::xilinx::WireIndex(4));
39  Tilewire tilewire5(architecture::xilinx::TileIndex(140), architecture::xilinx::WireIndex(5));
40  Tilewire tilewire6(architecture::xilinx::TileIndex(140), architecture::xilinx::WireIndex(6));
41 
42  // features tested:
43  // sizeof(TraceNode)
44  BOOST_CHECK_EQUAL(sizeof(TraceNode), sizeof(boost::int32_t)
45  + sizeof(Tilewire) + sizeof(std::vector<TraceNode*>)
46  + sizeof(std::vector<std::pair<Tilewire, TraceNode*> >));
47  BOOST_CHECK_EQUAL(sizeof(std::vector<TraceNode*>), 24u);
48  BOOST_CHECK_EQUAL(sizeof(std::vector<std::pair<Tilewire, TraceNode*> >), 24u);
49  BOOST_CHECK_EQUAL(sizeof(Tilewire), 6u);
50  BOOST_CHECK_EQUAL(sizeof(TraceNode), 58u);
51  BOOST_CHECK_EQUAL(sizeof(TraceNode*), 8u);
52  BOOST_CHECK_EQUAL(sizeof(boost::int32_t), 4u);
53 
54  // functions tested:
55  // TraceNode(Tilewire inTilewire)
56  TraceNode* tracenode1 = new TraceNode(tilewire1);
57  TraceNode* tracenode2 = new TraceNode(tilewire2);
58  TraceNode* tracenode3 = new TraceNode(tilewire3);
59  TraceNode* tracenode4 = new TraceNode(tilewire4);
60  TraceNode* tracenode5 = new TraceNode(tilewire5);
61  TraceNode* tracenode6 = new TraceNode(tilewire6);
62 
63  BOOST_CHECK(TraceNode::sLiveNodes == 6);
64 
65  //functions tested:
66  // getTilewire()
67  // getDepth()
68  // getNumChildren()
69  // getNumParents()
70  // getChild()
71  // getParent()
72  // removeChild()
73  // removeParent()
74  BOOST_CHECK(tracenode1 != 0);
75  BOOST_CHECK(tracenode1->getDepth() == -1);
76  BOOST_CHECK(tracenode1->getNumChildren() == 0);
77  BOOST_CHECK(tracenode1->getNumParents() == 0);
78  BOOST_CHECK(tracenode1->getTilewire() == tilewire1);
79  BOOST_CHECK(tracenode1->getChild(0) == 0);
80  BOOST_CHECK(tracenode1->getParent(0) == 0);
81  BOOST_CHECK(tracenode1->removeChild(0) == 0);
82  BOOST_CHECK(tracenode1->removeParent(0) == 0);
83 
84  // attach a bunch of nodes together
85  tracenode1->addChild(tracenode3);
86  BOOST_CHECK(tracenode1->getNumChildren() == 1);
87  BOOST_CHECK(tracenode1->getChild(0)->getTilewire() == tilewire3);
88  tracenode2->addChild(tracenode4);
89  BOOST_CHECK(tracenode2->getNumChildren() == 1);
90  BOOST_CHECK(tracenode2->getChild(0)->getTilewire() == tilewire4);
91  tracenode3->addParent(tracenode1);
92  BOOST_CHECK(tracenode3->getNumParents() == 1);
93  BOOST_CHECK(tracenode3->getParent(0)->getTilewire() == tilewire1);
94  tracenode3->addChild(tracenode4);
95  BOOST_CHECK(tracenode3->getNumChildren() == 1);
96  BOOST_CHECK(tracenode3->getChild(0)->getTilewire() == tilewire4);
97  tracenode4->addParent(tracenode2);
98  BOOST_CHECK(tracenode4->getNumParents() == 1);
99  tracenode4->addParent(tracenode3);
100  BOOST_CHECK(tracenode4->getNumParents() == 2);
101  std::vector<TraceNode*> testvec;
102  testvec.push_back(tracenode5);
103  testvec.push_back(tracenode6);
104  tracenode4->addChildren(testvec);
105  BOOST_CHECK(tracenode4->getNumChildren() == 2);
106  tracenode5->addParent(tracenode4);
107  BOOST_CHECK(tracenode5->getNumParents() == 1);
108  tracenode6->addParent(tracenode4);
109  BOOST_CHECK(tracenode6->getNumParents() == 1);
110 
111  // remove all node connections
112  BOOST_CHECK(tracenode1->removeChild(0)->getTilewire() == tilewire3);
113  BOOST_CHECK(tracenode1->getNumChildren() == 0);
114  BOOST_CHECK(tracenode2->removeChild(0)->getTilewire() == tilewire4);
115  BOOST_CHECK(tracenode2->getNumChildren() == 0);
116  BOOST_CHECK(tracenode3->removeParent(0) == tracenode1);
117  BOOST_CHECK(tracenode3->getNumParents() == 0);
118  BOOST_CHECK(tracenode3->removeChild(0)->getTilewire() == tilewire4);
119  BOOST_CHECK(tracenode3->getNumChildren() == 0);
120  BOOST_CHECK(tracenode4->removeParent(1) == tracenode3);
121  BOOST_CHECK(tracenode4->getNumParents() == 1);
122  BOOST_CHECK(tracenode4->removeParent(0) == tracenode2);
123  BOOST_CHECK(tracenode4->getNumParents() == 0);
124  BOOST_CHECK(tracenode4->removeChild(0)->getTilewire() == tilewire5);
125  BOOST_CHECK(tracenode4->getNumChildren() == 1);
126  BOOST_CHECK(tracenode4->removeChild(0)->getTilewire() == tilewire6);
127  BOOST_CHECK(tracenode4->getNumChildren() == 0);
128  BOOST_CHECK(tracenode5->removeParent(0) == tracenode4);
129  BOOST_CHECK(tracenode5->getNumParents() == 0);
130  BOOST_CHECK(tracenode6->removeParent(0)->getTilewire() == tilewire4);
131  BOOST_CHECK(tracenode6->getNumParents() == 0);
132 
133  // clean up
134  delete tracenode1;
135  delete tracenode2;
136  delete tracenode3;
137  delete tracenode4;
138  delete tracenode5;
139  delete tracenode6;
140 
141  BOOST_CHECK(TraceNode::sLiveNodes == 0);
142 
143  tracenode1 = new TraceNode(tilewire1);
144  tracenode2 = new TraceNode(tilewire2);
145  tracenode3 = new TraceNode(tilewire3);
146  tracenode4 = new TraceNode(tilewire4);
147  tracenode5 = new TraceNode(tilewire5);
148  tracenode6 = new TraceNode(tilewire6);
149 
150  // attach the nodes together again
151  tracenode1->addChild(tracenode3);
152  tracenode2->addChild(tracenode4);
153  tracenode3->addParent(tracenode1);
154  tracenode3->addChild(tracenode4);
155  tracenode4->addParent(tracenode2);
156  tracenode4->addParent(tracenode3);
157  testvec.clear();
158  testvec.push_back(tracenode5);
159  testvec.push_back(tracenode6);
160  tracenode4->addChildren(testvec);
161  tracenode5->addParent(tracenode4);
162  tracenode6->addParent(tracenode4);
163 
164  BOOST_CHECK(TraceNode::sLiveNodes == 6);
165 
166  // testing the destructor, but no way to verfiy that it is working???
167  delete tracenode1;
168  delete tracenode2;
169  delete tracenode3;
170  delete tracenode4;
171  delete tracenode5;
172  delete tracenode6;
173 
174  BOOST_CHECK(TraceNode::sLiveNodes == 0);
175 }

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( NetRouterHeuristicT  )

Unit test for the Heuristic.

Definition at line 32 of file NetRouterHeuristicUnitTest.cpp.

32  {
33 
34  typedef architecture::Tilewire Tilewire;
35  typedef architecture::ExtendedWireInfo ExtendedWireInfo;
36 
37  architecture::DDB db("xc5vlx30");
38  //architecture::DDB db("torc/devices/xc5vlx30");
39  NetRouterHeuristic h(db);
40 
41  Tilewire tw1(architecture::xilinx::TileIndex(3000), architecture::xilinx::WireIndex(100));
42  Tilewire tw2(architecture::xilinx::TileIndex(4004), architecture::xilinx::WireIndex(225));
43 
44  RouteNode* node1 = new RouteNode(tw1, tw1, 50, 50, 0, 0);
45  RouteNode* node2 = new RouteNode(tw1, tw1, 0, 0, 1, node1);
46 
47 // ExtendedWireInfo ewi1(db, tw1);
48 // ExtendedWireInfo ewi2(db, tw2);
49 
50 // std::cout << ewi1 << std::endl;
51 // std::cout << ewi2 << std::endl;
52 
53  h.setSink(tw2);
54  h.nodeCostInitial(*node1);
55  h.nodeCost(*node2);
56 
57  BOOST_CHECK_EQUAL(node1->getCost() == 74, true);
58  BOOST_CHECK_EQUAL(node2->getCost() == 148, true);
59 
60  delete node1;
61  delete node2;
62 }

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( PathFinder  )

Unit test for the NetRouter.

Definition at line 37 of file PathFinderUnitTest.cpp.

37  {
38 
39  int& argc = boost::unit_test::framework::master_test_suite().argc;;
40  BOOST_REQUIRE(argc >= 1);
41 /* char**&argv = boost::unit_test::framework::master_test_suite().argv;;
42  torc::common::DirectoryTree directoryTree(argv[0]);
43  boost::filesystem::path testPath(directoryTree.getExecutablePath() / "torc" / "router");
44  boost::filesystem::path referencePath(testPath / "pathfindertest1.xdl");
45 std::cout << referencePath.string() << std::endl;
46 
47  std::fstream fileStream(referencePath.string().c_str());
48  BOOST_REQUIRE(fileStream.good());
49 
50  architecture::XdlImporter importer;
51 std::cout << "HERE" << std::endl;
52  importer(fileStream, referencePath.string());
53 std::cout << "AND HERE" << std::endl;
54 
55  torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
56  BOOST_REQUIRE(designPtr.get() != 0);
57  BOOST_CHECK_EQUAL(designPtr->getNetCount(), 2376u);
58  architecture::DDB* ddbPtr = importer.releaseDDBPtr();
59 
60 
61 
62 // architecture::DDB ddb("xc5vlx110t");
63 // NetRouterHeuristicBase* h = new NetRouterHeuristic(*ddbPtr);
64  NetRouterHeuristicBase* h = new PathFinderNetRouterHeuristic(*ddbPtr);
65  NetRouterBase* r = new NetRouter(*ddbPtr, h);
66  NetVectorRouterHeuristicBase* vh = new PathFinderHeuristic(*ddbPtr);
67  NetVectorRouterBase* vr = new PathFinder(*ddbPtr, vh, r);
68 
69  RouteUtilities ru;
70  RouteNetVector nets;
71  std::cout << "RouteNets: " << nets.size() << std::endl;
72 
73  ru.design2routenets(designPtr->netsBegin(), designPtr->netsEnd(), nets);
74 
75  std::cout << "RouteNets: " << nets.size() << std::endl;
76  std::cout << *ddbPtr;
77  std::cout << "Clearing usage from import" << std::endl;
78  ddbPtr->clearUsage();
79 
80  vr->route(nets);
81 
82  std::cout << "Finished" << std::endl;*/
83 
84 }
torc::router::BOOST_AUTO_TEST_CASE ( NetRouterT  )

Unit test for the NetRouter.

Definition at line 39 of file NetRouterUnitTest.cpp.

39  {
40  architecture::DDB ddb("xc5vlx30");
41  NetRouterHeuristicBase* h = new NetRouterHeuristic(ddb);
42  NetRouterBase* r = new NetRouter(ddb, h);
43 
44  architecture::Tilewire twSource = ddb.lookupTilewire("CLBLL_X16Y42", "L_A");
45  architecture::Tilewire twSink1 = ddb.lookupTilewire("CLBLL_X16Y42", "L_C3");
46  architecture::Tilewire twSink2 = ddb.lookupTilewire("CLBLL_X23Y16", "L_B2");
47  std::string netname = "TEST_NET";
48  RouteNet net(netname);
49  net.addSource(twSource);
50  net.addSink(twSink1);
51  net.addSink(twSink2);
52 
53  BOOST_MESSAGE("ROUTE CALL");
54  std::cout << net.routeNodes().size() << std::endl;
55  r->route(net);
56  double t = boost::any_cast<double>(net.mProperties[eRouteTime]);
57  std::cout << t << std::endl;
58  BOOST_MESSAGE("ROUTE FINISHED");
59  std::cout << net.routeNodes().size() << std::endl;
60 
61  RouteNodePtrVector& v = net.routeNodes();
62  std::cout << ddb;
63  architecture::ExtendedWireInfo ewi(ddb);
64  for (unsigned int i = 0; i < v.size(); i++) {
65  //std::cout << "pip " << v[i]->getSourceTilewire() << " -> " < v[i]->getSinkTilewire()
66  //std::cout << "pip " << v[i]->getArc() << std::endl;
67  std::cout << "pip ";
68  ewi = v[i]->getSourceTilewire();
69  std::cout << ewi.mTileName << " " << ewi.mWireName << " -> ";
70  ewi = v[i]->getSinkTilewire();
71  std::cout << ewi.mWireName << "," << std::endl;
72  }
73 
74 }
std::vector< RouteNode * > RouteNodePtrVector
Vector of RouteNode pointers.
Definition: RouteNode.hpp:115
std::string string

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( trace_full_net  )

Definition at line 72 of file TraceUnitTest.cpp.

72  {
73  Trace trace(ddb, twMid, Trace::eTraceFullNet);
74  BOOST_CHECK_EQUAL(trace.getSources().size(), 1u);
75  BOOST_CHECK_EQUAL(trace.getSinks().size(), 2u);
76  BOOST_CHECK_EQUAL(trace.getBranchPoints().size(), 1u);
77  BOOST_CHECK_EQUAL(trace.getArcs().size(), 9u);
78 }

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( trace_to_sinks  )

Definition at line 80 of file TraceUnitTest.cpp.

80  {
81  Trace trace(ddb, twMid, Trace::eTraceToSinks);
82  BOOST_CHECK_EQUAL(trace.getSources().size(), 0u);
83  BOOST_CHECK_EQUAL(trace.getSinks().size(), 1u);
84  BOOST_CHECK_EQUAL(trace.getBranchPoints().size(), 0u);
85  BOOST_CHECK_EQUAL(trace.getArcs().size(), 4u);
86 }

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( trace_to_branch  )

Definition at line 88 of file TraceUnitTest.cpp.

88  {
89  Trace trace(ddb, twMid, Trace::eTraceToBranch);
90  BOOST_CHECK_EQUAL(trace.getSources().size(), 0u);
91  BOOST_CHECK_EQUAL(trace.getSinks().size(), 1u);
92  BOOST_CHECK_EQUAL(trace.getBranchPoints().size(), 1u);
93  BOOST_CHECK_EQUAL(trace.getArcs().size(), 6u);
94 }

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( trace_to_sources  )

Definition at line 96 of file TraceUnitTest.cpp.

96  {
97  Trace trace(ddb, twMid, Trace::eTraceToSources);
98  BOOST_CHECK_EQUAL(trace.getSources().size(), 1u);
99  BOOST_CHECK_EQUAL(trace.getSinks().size(), 0u);
100  BOOST_CHECK_EQUAL(trace.getBranchPoints().size(), 1u);
101  BOOST_CHECK_EQUAL(trace.getArcs().size(), 3u);
102 }

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( trace_single_path  )

Definition at line 104 of file TraceUnitTest.cpp.

104  {
105  Trace trace(ddb, twMid, Trace::eTraceSinglePath);
106  BOOST_CHECK_EQUAL(trace.getSources().size(), 0u);
107  BOOST_CHECK_EQUAL(trace.getSinks().size(), 1u);
108  BOOST_CHECK_EQUAL(trace.getBranchPoints().size(), 1u);
109  BOOST_CHECK_EQUAL(trace.getArcs().size(), 6u);
110 }

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( pathfinder_virtex2p  )

Spartan3E regression.

Spartan6 regression Spartan6 regression VirtexE regression Virtex2P regression

Definition at line 153 of file PathFinderRegressionTest.cpp.

153  {
154 
155  int& argc = boost::unit_test::framework::master_test_suite().argc;;
156  BOOST_REQUIRE(argc >= 1);
157  char**&argv = boost::unit_test::framework::master_test_suite().argv;;
158  torc::common::DirectoryTree directoryTree(argv[0]);
159  boost::filesystem::path testPath(directoryTree.getExecutablePath()
160  / "torc" / "router" / "PathFinderRegression");
161  boost::filesystem::path referencePath(testPath / "PathFinderRegression.Virtex2P.Test1.xdl");
162  boost::filesystem::path generatedPath(testPath /
163  "PathFinderRegression.Virtex2P.Test1.generated.xdl");
164  std::cout << referencePath.string() << std::endl;
165 
166  testRouteDesign(referencePath.string(), generatedPath.string());
167 }
Encapsulation of filesystem paths that are used by the library.
boost::filesystem::path path
void testRouteDesign(std::string path, std::string exportpath)

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( pathfinder_virtex4  )

Virtex4 regression.

Definition at line 169 of file PathFinderRegressionTest.cpp.

169  {
170 
171  int& argc = boost::unit_test::framework::master_test_suite().argc;;
172  BOOST_REQUIRE(argc >= 1);
173  char**&argv = boost::unit_test::framework::master_test_suite().argv;;
174  torc::common::DirectoryTree directoryTree(argv[0]);
175  boost::filesystem::path testPath(directoryTree.getExecutablePath()
176  / "torc" / "router" / "PathFinderRegression");
177  boost::filesystem::path referencePath(testPath / "PathFinderRegression.Virtex4.Test1.xdl");
178  boost::filesystem::path generatedPath(testPath /
179  "PathFinderRegression.Virtex4.Test1.generated.xdl");
180  std::cout << referencePath.string() << std::endl;
181 
182  testRouteDesign(referencePath.string(), generatedPath.string());
183 }
Encapsulation of filesystem paths that are used by the library.
boost::filesystem::path path
void testRouteDesign(std::string path, std::string exportpath)

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( FullNet  )

Unit test for the findTop and normalizeDepth functions in the Tracer.

Definition at line 170 of file TraceRegressionTest.cpp.

170  {
171  std::cout << *ddbPtr;
172  Trace trace(*ddbPtr, sourceTw1, Trace::eTraceFullNet);
173  TraceNodePtrVector& sources = trace.getSources();
174  BOOST_CHECK_EQUAL(sources.size(), 2u);
175  TraceNodePtrVector& sinks = trace.getSinks();
176  BOOST_CHECK_EQUAL(sinks.size(), 7u);
177  TraceNodePtrVector& branchpoints = trace.getBranchPoints();
178  BOOST_CHECK_EQUAL(branchpoints.size(), 4u);
179  architecture::ArcVector& arcs = trace.getArcs();
180  BOOST_CHECK_EQUAL(arcs.size(), 34u);
181 }
std::vector< TraceNode * > TraceNodePtrVector
Vector of TraceNode pointer.
Definition: TraceNode.hpp:192
std::vector< Arc > ArcVector
Vector of Arc objects.
Definition: Arc.hpp:78

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( pathfinder_virtex5  )

Virtex5 regression.

Definition at line 185 of file PathFinderRegressionTest.cpp.

185  {
186 
187  int& argc = boost::unit_test::framework::master_test_suite().argc;;
188  BOOST_REQUIRE(argc >= 1);
189  char**&argv = boost::unit_test::framework::master_test_suite().argv;;
190  torc::common::DirectoryTree directoryTree(argv[0]);
191  boost::filesystem::path testPath(directoryTree.getExecutablePath()
192  / "torc" / "router" / "PathFinderRegression");
193  boost::filesystem::path referencePath(testPath / "PathFinderRegression.Virtex5.Test1.xdl");
194  boost::filesystem::path generatedPath(testPath /
195  "PathFinderRegression.Virtex5.Test1.generated.xdl");
196  std::cout << referencePath.string() << std::endl;
197 
198  testRouteDesign(referencePath.string(), generatedPath.string());
199 }
Encapsulation of filesystem paths that are used by the library.
boost::filesystem::path path
void testRouteDesign(std::string path, std::string exportpath)

+ Here is the call graph for this function:

torc::router::BOOST_AUTO_TEST_CASE ( pathfinder_virtex6  )

Virtex6 regression.

Definition at line 201 of file PathFinderRegressionTest.cpp.

201  {
202 
203  int& argc = boost::unit_test::framework::master_test_suite().argc;;
204  BOOST_REQUIRE(argc >= 1);
205  char**&argv = boost::unit_test::framework::master_test_suite().argv;;
206  torc::common::DirectoryTree directoryTree(argv[0]);
207  boost::filesystem::path testPath(directoryTree.getExecutablePath()
208  / "torc" / "router" / "PathFinderRegression");
209  boost::filesystem::path referencePath(testPath / "PathFinderRegression.Virtex6.Test1.xdl");
210  boost::filesystem::path generatedPath(testPath /
211  "PathFinderRegression.Virtex6.Test1.generated.xdl");
212  std::cout << referencePath.string() << std::endl;
213 
214  testRouteDesign(referencePath.string(), generatedPath.string());
215 }
Encapsulation of filesystem paths that are used by the library.
boost::filesystem::path path
void testRouteDesign(std::string path, std::string exportpath)

+ Here is the call graph for this function:

void torc::router::testRouteDesign ( std::string  path,
std::string  exportpath 
)

Definition at line 39 of file PathFinderRegressionTest.cpp.

39  {
40 
41  typedef torc::physical::Circuit::NetSharedPtrIterator NetSharedPtrIterator;
42 
43  std::fstream fileStream(path.c_str());
44  BOOST_REQUIRE(fileStream.good());
45 
46  architecture::XdlImporter importer;
47  importer(fileStream, path);
48 
49  torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
50  BOOST_REQUIRE(designPtr.get() != 0);
51  //BOOST_CHECK_EQUAL(designPtr->getNetCount(), netCount);
52  architecture::DDB* ddbPtr = importer.releaseDDBPtr();
53 
54  NetRouterHeuristicBase* h = new PathFinderNetRouterHeuristic(*ddbPtr);
55  NetRouterBase* r = new NetRouter(*ddbPtr, h);
56  NetVectorRouterHeuristicBase* vh = new PathFinderHeuristic(*ddbPtr);
57  NetVectorRouterBase* vr = new PathFinder(*ddbPtr, vh, r);
58 
59  RouteUtilities ru;
60  RouteNetVector nets;
61 
62  std::cout << "RouteNets: " << nets.size() << std::endl;
63  ru.design2routenets(designPtr->netsBegin(), designPtr->netsEnd(), nets);
64  BOOST_CHECK_EQUAL(designPtr->getNetCount(), nets.size());
65 
66  std::cout << "Unrouting nets..." << std::endl;
67  NetSharedPtrIterator p;
68  for (p = designPtr->netsBegin(); p != designPtr->netsEnd(); p++) {
69  (*p)->unroute();
70  }
71 
72  std::cout << "RouteNets: " << nets.size() << std::endl;
73  std::cout << *ddbPtr;
74  std::cout << "Clearing usage from import" << std::endl;
75  ddbPtr->clearUsage();
76  vr->route(nets);
77  std::cout << "Finished routing: " << path << std::endl;
78 
79  std::cout << "Exporting route nets to physical" << std::endl;
80  ru.routenets2design(nets, designPtr->netsBegin(), designPtr->netsEnd(), *ddbPtr);
81 
82  std::cout << "Exporting XDL" << std::endl;
83  std::fstream xdlExport(exportpath.c_str(), std::ios_base::out);
84  physical::XdlExporter fileExporter(xdlExport);
85  fileExporter(designPtr);
86 }
std::vector< RouteNet > RouteNetVector
Vector of RouteNet objects.
Definition: RouteNet.hpp:205
boost::filesystem::path path
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
NetSharedPtrVector::iterator NetSharedPtrIterator
Non-constant iterator to Net shared pointers.
Definition: Circuit.hpp:78

+ Here is the call graph for this function:

+ Here is the caller graph for this function: