19 #include <boost/test/unit_test.hpp>
51 argv(boost::unit_test::framework::master_test_suite().
argv),
60 BOOST_REQUIRE(
argc >= 1);
64 BOOST_REQUIRE(designPtr.get() != 0);
66 BOOST_REQUIRE(ddbPtr != 0);
69 BOOST_CHECK_EQUAL(designPtr->getNetCount(), 1u);
70 BOOST_CHECK_EQUAL(ddbPtr->getArcUsage().getArcUsageCount(), 53u);
74 sourceTw = ddbPtr->lookupTilewire(
"CLBLL_X16Y39",
"L_C");
75 sourceTw2 = ddbPtr->lookupTilewire(
"CLBLL_X16Y39",
"L_CMUX");
78 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y42",
"L_D1");
79 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
80 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X18Y36",
"L_A1");
81 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
82 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X18Y36",
"L_D3");
83 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
84 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y36",
"M_B6");
85 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
86 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y36",
"M_C5");
87 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
88 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y36",
"M_D3");
89 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
90 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y42",
"L_D2");
91 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
92 tempTw = ddbPtr->lookupTilewire(
"CLBLL_X16Y42",
"L_A1");
93 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
94 tempTw = ddbPtr->lookupTilewire(
"CLBLL_X16Y42",
"L_CE");
95 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
96 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X18Y40",
"L_BX");
97 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
98 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X18Y40",
"L_B4");
99 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
106 BOOST_FIXTURE_TEST_SUITE(router, TracerTestFixture)
109 BOOST_AUTO_TEST_CASE(router_unrouter_tracetosinks) {
110 Tracer tracer(*ddbPtr);
113 rtn = tracer.traceToSinks(sourceTw);
114 rtn2 = tracer.traceToSinks(sourceTw2);
115 rtn->normalizeDepth();
116 rtn2->normalizeDepth();
117 std::vector<RouteTreeNode*> vec;
118 std::vector<RouteTreeNode*> wavefront;
119 //vec.push_back(rtn);
120 //vec.push_back(rtn2);
121 wavefront.push_back(rtn);
122 wavefront.push_back(rtn2);
123 while (wavefront.size() != 0) {
124 RouteTreeNode* node = wavefront.back();
125 wavefront.pop_back();
127 for (unsigned int i = 0; i < node->getNumChildren(); i++) {
128 wavefront.push_back(node->getChild(i));
131 std::map<architecture::Tilewire, int>::iterator it;
132 for (unsigned int i = 0 ; i < vec.size(); i++) {
133 it = sinkCounts.find(vec[i]->getSinkTilewire());
134 if (it != sinkCounts.end()) {
138 BOOST_TEST_MESSAGE(*ddbPtr);
139 for (it = sinkCounts.begin(); it != sinkCounts.end(); it++) {
140 BOOST_TEST_MESSAGE("Checking sink " << it->first);
141 BOOST_CHECK(it->second == 1);
146 BOOST_AUTO_TEST_CASE(router_unrouter_tracebranch) {
147 Tracer tracer(*ddbPtr);
148 architecture::Tilewire branchSource = ddbPtr->lookupTilewire("INT_X14Y37", "SL2END0");
150 rtn = tracer.traceBranch(branchSource);
151 rtn->normalizeDepth();
152 std::vector<RouteTreeNode*> vec;
153 std::vector<RouteTreeNode*> wavefront;
155 wavefront.push_back(rtn);
156 while (wavefront.size() != 0) {
157 RouteTreeNode* node = wavefront.back();
158 wavefront.pop_back();
160 for (unsigned int i = 0; i < node->getNumChildren(); i++) {
161 wavefront.push_back(node->getChild(i));
164 std::map<architecture::Tilewire, int>::iterator it;
165 for (unsigned int i = 0 ; i < vec.size(); i++) {
166 std::cout << "NODE: " << vec[i]->getArc() << std::endl;
167 it = sinkCounts.find(vec[i]->getSinkTilewire());
168 if (it != sinkCounts.end()) {
172 BOOST_TEST_MESSAGE(*ddbPtr);
173 for (it = sinkCounts.begin(); it != sinkCounts.end(); it++) {
174 BOOST_TEST_MESSAGE("Checking sink " << it->first);
175 BOOST_CHECK_EQUAL(it->second, 1);
176 //std::cout << it->first << " " << it->second << std::endl;
181 BOOST_AUTO_TEST_CASE(router_unrouter_tracesink) {
185 BOOST_AUTO_TEST_CASE(router_unrouter_tracefull) {
186 Tracer tracer(*ddbPtr);
187 architecture::Tilewire branchSource = ddbPtr->lookupTilewire("INT_X14Y37", "SL2END0");
188 std::cout << *ddbPtr << "START: " << branchSource << std::endl;
190 rtn = tracer.traceFull(branchSource);
191 rtn->normalizeDepth();
192 rtn = (RouteTreeNode*)rtn->getTop();
193 std::vector<RouteTreeNode*> vec;
194 std::vector<RouteTreeNode*> wavefront;
195 wavefront.push_back(rtn);
196 while (wavefront.size() != 0) {
197 RouteTreeNode* node = wavefront.back();
198 wavefront.pop_back();
200 for (unsigned int i = 0; i < node->getNumChildren(); i++) {
201 wavefront.push_back(node->getChild(i));
204 std::map<architecture::Tilewire, int>::iterator it;
205 for (unsigned int i = 0 ; i < vec.size(); i++) {
206 std::cout << "NODE: " << vec[i]->getArc() << std::endl;
207 it = sinkCounts.find(vec[i]->getSinkTilewire());
208 if (it != sinkCounts.end()) {
212 BOOST_TEST_MESSAGE(*ddbPtr);
213 for (it = sinkCounts.begin(); it != sinkCounts.end(); it++) {
214 BOOST_TEST_MESSAGE("Checking sink " << it->first);
215 BOOST_CHECK_EQUAL(it->second, 1);
216 //std::cout << it->first << " " << it->second << std::endl;
220 BOOST_AUTO_TEST_SUITE_END()
Device database, including complete wiring and logic support.
architecture::XdlImporter importer
torc::common::DirectoryTree directoryTree
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design.
Header for the DirectoryTree class.
architecture::Tilewire sourceTw2
DDB * releaseDDBPtr(void)
Releases ownership of the device database. The caller is now responsible for deleting it...
std::map< architecture::Tilewire, int > sinkCounts
Header for Boost.Test helper functions.
Architecture aware importer from XDL format into a physical design.
Encapsulation of a device tile and wire pair.
Encapsulation of filesystem paths that are used by the library.
Header for torc::physical output stream helpers.
Header for the Trace class.
boost::filesystem::path path
boost::filesystem::path referencePath
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
boost::filesystem::path testPath
Header for the DDB class.
architecture::DDB * ddbPtr
Header for the XdlImporter class.
torc::physical::DesignSharedPtr designPtr
architecture::Tilewire sourceTw