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);
68 BOOST_CHECK_EQUAL(designPtr->getNetCount(), 1u);
69 BOOST_CHECK_EQUAL(ddbPtr->getArcUsage().getArcUsageCount(), 53u);
70 BOOST_TEST_MESSAGE(
"The pip count should include the routethrough.");
71 BOOST_CHECK_EQUAL(ddbPtr->getArcUsage().getArcUsageCount(), 54u);
73 sourceTw = ddbPtr->lookupTilewire(
"CLBLL_X16Y39",
"L_C");
74 sourceTw2 = ddbPtr->lookupTilewire(
"CLBLL_X16Y39",
"L_CMUX");
77 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y42",
"L_D1");
78 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
79 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X18Y36",
"L_A1");
80 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
81 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X18Y36",
"L_D3");
82 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
83 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y36",
"M_B6");
84 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
85 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y36",
"M_C5");
86 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
87 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y36",
"M_D3");
88 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
89 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X13Y42",
"L_D2");
90 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
91 tempTw = ddbPtr->lookupTilewire(
"CLBLL_X16Y42",
"L_A1");
92 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
93 tempTw = ddbPtr->lookupTilewire(
"CLBLL_X16Y42",
"L_CE");
94 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
95 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X18Y40",
"L_BX");
96 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
97 tempTw = ddbPtr->lookupTilewire(
"CLBLM_X18Y40",
"L_B4");
98 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
121 argv(boost::unit_test::framework::master_test_suite().
argv),
130 BOOST_REQUIRE(
argc >= 1);
134 BOOST_REQUIRE(designPtr.get() != 0);
136 BOOST_REQUIRE(ddbPtr != 0);
138 BOOST_CHECK_EQUAL(designPtr->getNetCount(), 1u);
139 BOOST_CHECK_EQUAL(ddbPtr->getArcUsage().getArcUsageCount(), 34u);
141 sourceTw1 = ddbPtr->lookupTilewire(
"R7C14",
"TBUF_OUT0");
142 sourceTw2 = ddbPtr->lookupTilewire(
"R7C18",
"TBUF_OUT0");
145 tempTw = ddbPtr->lookupTilewire(
"R7C14",
"S0_F_B1");
146 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
147 tempTw = ddbPtr->lookupTilewire(
"R7C14",
"S1_F_B1");
148 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
149 tempTw = ddbPtr->lookupTilewire(
"R7C14",
"S1_G_B1");
150 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
151 tempTw = ddbPtr->lookupTilewire(
"R7C14",
"S0_G_B1");
152 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
153 tempTw = ddbPtr->lookupTilewire(
"R7C18",
"S1_G_B1");
154 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
155 tempTw = ddbPtr->lookupTilewire(
"R7C18",
"S0_F_B1");
156 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
157 tempTw = ddbPtr->lookupTilewire(
"R7C18",
"S1_F_B1");
158 sinkCounts.insert(std::pair<architecture::Tilewire, int>(tempTw, 0));
166 BOOST_AUTO_TEST_SUITE(router)
168 BOOST_FIXTURE_TEST_SUITE(TraceRegressionVirtex, TraceVirtexTristateTestFixture)
171 std::cout << *ddbPtr;
174 BOOST_CHECK_EQUAL(sources.size(), 2u);
176 BOOST_CHECK_EQUAL(sinks.size(), 7u);
178 BOOST_CHECK_EQUAL(branchpoints.size(), 4u);
180 BOOST_CHECK_EQUAL(arcs.size(), 34u);
183 BOOST_AUTO_TEST_SUITE_END()
185 BOOST_FIXTURE_TEST_SUITE(TraceRegressionVirtex5, TraceVirtex5TestFixture)
189 std::cout << *ddbPtr;
192 BOOST_CHECK_EQUAL(sources.size(), 1u);
194 BOOST_CHECK_EQUAL(sinks.size(), 8u);
196 BOOST_CHECK_EQUAL(branchpoints.size(), 5u);
198 BOOST_CHECK_EQUAL(arcs.size(), 34u);
203 BOOST_AUTO_TEST_CASE(router_tracer_tracetosinks) {
204 Tracer tracer(*ddbPtr);
207 rtn = tracer.traceToSinks(sourceTw);
208 rtn2 = tracer.traceToSinks(sourceTw2);
209 rtn->normalizeDepth();
210 rtn2->normalizeDepth();
211 std::vector<RouteTreeNode*> vec;
212 std::vector<RouteTreeNode*> wavefront;
213 //vec.push_back(rtn);
214 //vec.push_back(rtn2);
215 wavefront.push_back(rtn);
216 wavefront.push_back(rtn2);
217 while (wavefront.size() != 0) {
218 RouteTreeNode* node = wavefront.back();
219 wavefront.pop_back();
221 for (unsigned int i = 0; i < node->getNumChildren(); i++) {
222 wavefront.push_back(node->getChild(i));
225 std::map<architecture::Tilewire, int>::iterator it;
226 for (unsigned int i = 0 ; i < vec.size(); i++) {
227 it = sinkCounts.find(vec[i]->getSinkTilewire());
228 if (it != sinkCounts.end()) {
232 BOOST_TEST_MESSAGE(*ddbPtr);
233 for (it = sinkCounts.begin(); it != sinkCounts.end(); it++) {
234 BOOST_TEST_MESSAGE("Checking sink " << it->first);
235 BOOST_CHECK(it->second == 1);
240 BOOST_AUTO_TEST_CASE(router_tracer_tracebranch) {
241 Tracer tracer(*ddbPtr);
242 architecture::Tilewire branchSource = ddbPtr->lookupTilewire("INT_X14Y37", "SL2END0");
244 rtn = tracer.traceBranch(branchSource);
245 rtn->normalizeDepth();
246 std::vector<RouteTreeNode*> vec;
247 std::vector<RouteTreeNode*> wavefront;
249 wavefront.push_back(rtn);
250 while (wavefront.size() != 0) {
251 RouteTreeNode* node = wavefront.back();
252 wavefront.pop_back();
254 for (unsigned int i = 0; i < node->getNumChildren(); i++) {
255 wavefront.push_back(node->getChild(i));
258 std::map<architecture::Tilewire, int>::iterator it;
259 for (unsigned int i = 0 ; i < vec.size(); i++) {
260 std::cout << "NODE: " << vec[i]->getArc() << std::endl;
261 it = sinkCounts.find(vec[i]->getSinkTilewire());
262 if (it != sinkCounts.end()) {
266 BOOST_TEST_MESSAGE(*ddbPtr);
267 for (it = sinkCounts.begin(); it != sinkCounts.end(); it++) {
268 BOOST_TEST_MESSAGE("Checking sink " << it->first);
269 BOOST_CHECK_EQUAL(it->second, 1);
270 //std::cout << it->first << " " << it->second << std::endl;
275 BOOST_AUTO_TEST_CASE(router_tracer_tracesink) {
279 BOOST_AUTO_TEST_CASE(router_tracer_tracefull) {
280 Tracer tracer(*ddbPtr);
281 architecture::Tilewire branchSource = ddbPtr->lookupTilewire("INT_X14Y37", "SL2END0");
282 std::cout << *ddbPtr << "START: " << branchSource << std::endl;
284 rtn = tracer.traceFull(branchSource);
285 rtn->normalizeDepth();
286 rtn = (RouteTreeNode*)rtn->getTop();
287 std::vector<RouteTreeNode*> vec;
288 std::vector<RouteTreeNode*> wavefront;
289 wavefront.push_back(rtn);
290 while (wavefront.size() != 0) {
291 RouteTreeNode* node = wavefront.back();
292 wavefront.pop_back();
294 for (unsigned int i = 0; i < node->getNumChildren(); i++) {
295 wavefront.push_back(node->getChild(i));
298 std::map<architecture::Tilewire, int>::iterator it;
299 for (unsigned int i = 0 ; i < vec.size(); i++) {
300 std::cout << "NODE: " << vec[i]->getArc() << std::endl;
301 it = sinkCounts.find(vec[i]->getSinkTilewire());
302 if (it != sinkCounts.end()) {
306 BOOST_TEST_MESSAGE(*ddbPtr);
307 for (it = sinkCounts.begin(); it != sinkCounts.end(); it++) {
308 BOOST_TEST_MESSAGE("Checking sink " << it->first);
309 BOOST_CHECK_EQUAL(it->second, 1);
310 //std::cout << it->first << " " << it->second << std::endl;
314 BOOST_AUTO_TEST_SUITE_END()
316 BOOST_AUTO_TEST_SUITE_END()
torc::physical::DesignSharedPtr designPtr
TraceNodePtrVector & getSources()
Get trace source nodes.
architecture::DDB * ddbPtr
Device database, including complete wiring and logic support.
std::map< architecture::Tilewire, int > sinkCounts
boost::filesystem::path referencePath
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design.
Header for the DirectoryTree class.
boost::filesystem::path testPath
torc::common::DirectoryTree directoryTree
~TraceVirtex5TestFixture()
std::vector< TraceNode * > TraceNodePtrVector
Vector of TraceNode pointer.
TraceNodePtrVector & getBranchPoints()
Get trace branch point nodes.
DDB * releaseDDBPtr(void)
Releases ownership of the device database. The caller is now responsible for deleting it...
architecture::DDB * ddbPtr
std::vector< Arc > ArcVector
Vector of Arc objects.
architecture::XdlImporter importer
TraceVirtexTristateTestFixture()
Header for Boost.Test helper functions.
ArcVector & getArcs()
Get all Arcs found during the trace.
Architecture aware importer from XDL format into a physical design.
Provides path extraction from usage information in a DDB instance..
architecture::XdlImporter importer
TraceVirtex5TestFixture()
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.
architecture::Tilewire sourceTw1
Header for the Trace class.
std::map< architecture::Tilewire, int > sinkCounts
architecture::Tilewire sourceTw2
boost::filesystem::path path
static boost::int32_t sLiveNodes
Static allocation and deallocation count.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
boost::filesystem::path testPath
torc::physical::DesignSharedPtr designPtr
torc::common::DirectoryTree directoryTree
boost::filesystem::path referencePath
~TraceVirtexTristateTestFixture()
Header for the DDB class.
BOOST_AUTO_TEST_CASE(NetRouterHeuristicT)
Unit test for the Heuristic.
Header for the XdlImporter class.
architecture::Tilewire sourceTw
TraceNodePtrVector & getSinks()
Get trace sink nodes.
architecture::Tilewire sourceTw2