00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <boost/test/unit_test.hpp>
00020 #include "torc/architecture/XdlImporter.hpp"
00021 #include "torc/physical/XdlExporter.hpp"
00022 #include "torc/architecture/DDB.hpp"
00023 #include "torc/common/DirectoryTree.hpp"
00024
00025 #include "PathFinder.hpp"
00026 #include "NetRouter.hpp"
00027
00028 #include "PathFinderHeuristic.hpp"
00029 #include "RouteUtilities.hpp"
00030 #include "PathFinderNetRouterHeuristic.hpp"
00031
00032 namespace torc {
00033 namespace router {
00034
00035 BOOST_AUTO_TEST_SUITE(router)
00036 BOOST_AUTO_TEST_SUITE(regression)
00037
00038 void testRouteDesign(std::string path, std::string exportpath);
00039 void testRouteDesign(std::string path, std::string exportpath) {
00040
00041 typedef torc::physical::Circuit::NetSharedPtrIterator NetSharedPtrIterator;
00042
00043 std::fstream fileStream(path.c_str());
00044 BOOST_REQUIRE(fileStream.good());
00045
00046 architecture::XdlImporter importer;
00047 importer(fileStream, path);
00048
00049 torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
00050 BOOST_REQUIRE(designPtr.get() != 0);
00051
00052 architecture::DDB* ddbPtr = importer.releaseDDBPtr();
00053
00054 NetRouterHeuristicBase* h = new PathFinderNetRouterHeuristic(*ddbPtr);
00055 NetRouterBase* r = new NetRouter(*ddbPtr, h);
00056 NetVectorRouterHeuristicBase* vh = new PathFinderHeuristic(*ddbPtr);
00057 NetVectorRouterBase* vr = new PathFinder(*ddbPtr, vh, r);
00058
00059 RouteUtilities ru;
00060 RouteNetVector nets;
00061
00062 std::cout << "RouteNets: " << nets.size() << std::endl;
00063 ru.design2routenets(designPtr->netsBegin(), designPtr->netsEnd(), nets);
00064 BOOST_CHECK_EQUAL(designPtr->getNetCount(), nets.size());
00065
00066 std::cout << "Unrouting nets..." << std::endl;
00067 NetSharedPtrIterator p;
00068 for (p = designPtr->netsBegin(); p != designPtr->netsEnd(); p++) {
00069 (*p)->unroute();
00070 }
00071
00072 std::cout << "RouteNets: " << nets.size() << std::endl;
00073 std::cout << *ddbPtr;
00074 std::cout << "Clearing usage from import" << std::endl;
00075 ddbPtr->clearUsage();
00076 vr->route(nets);
00077 std::cout << "Finished routing: " << path << std::endl;
00078
00079 std::cout << "Exporting route nets to physical" << std::endl;
00080 ru.routenets2design(nets, designPtr->netsBegin(), designPtr->netsEnd(), *ddbPtr);
00081
00082 std::cout << "Exporting XDL" << std::endl;
00083 std::fstream xdlExport(exportpath.c_str(), std::ios_base::out);
00084 physical::XdlExporter fileExporter(xdlExport);
00085 fileExporter(designPtr);
00086 }
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 BOOST_AUTO_TEST_CASE(pathfinder_virtex2p) {
00154
00155 int& argc = boost::unit_test::framework::master_test_suite().argc;;
00156 BOOST_REQUIRE(argc >= 1);
00157 char**&argv = boost::unit_test::framework::master_test_suite().argv;;
00158 torc::common::DirectoryTree directoryTree(argv[0]);
00159 boost::filesystem::path testPath(directoryTree.getExecutablePath()
00160 / "torc" / "router" / "PathFinderRegression");
00161 boost::filesystem::path referencePath(testPath / "PathFinderRegression.Virtex2P.Test1.xdl");
00162 boost::filesystem::path generatedPath(testPath /
00163 "PathFinderRegression.Virtex2P.Test1.generated.xdl");
00164 std::cout << referencePath.string() << std::endl;
00165
00166 testRouteDesign(referencePath.string(), generatedPath.string());
00167 }
00168
00169 BOOST_AUTO_TEST_CASE(pathfinder_virtex4) {
00170
00171 int& argc = boost::unit_test::framework::master_test_suite().argc;;
00172 BOOST_REQUIRE(argc >= 1);
00173 char**&argv = boost::unit_test::framework::master_test_suite().argv;;
00174 torc::common::DirectoryTree directoryTree(argv[0]);
00175 boost::filesystem::path testPath(directoryTree.getExecutablePath()
00176 / "torc" / "router" / "PathFinderRegression");
00177 boost::filesystem::path referencePath(testPath / "PathFinderRegression.Virtex4.Test1.xdl");
00178 boost::filesystem::path generatedPath(testPath /
00179 "PathFinderRegression.Virtex4.Test1.generated.xdl");
00180 std::cout << referencePath.string() << std::endl;
00181
00182 testRouteDesign(referencePath.string(), generatedPath.string());
00183 }
00184
00185 BOOST_AUTO_TEST_CASE(pathfinder_virtex5) {
00186
00187 int& argc = boost::unit_test::framework::master_test_suite().argc;;
00188 BOOST_REQUIRE(argc >= 1);
00189 char**&argv = boost::unit_test::framework::master_test_suite().argv;;
00190 torc::common::DirectoryTree directoryTree(argv[0]);
00191 boost::filesystem::path testPath(directoryTree.getExecutablePath()
00192 / "torc" / "router" / "PathFinderRegression");
00193 boost::filesystem::path referencePath(testPath / "PathFinderRegression.Virtex5.Test1.xdl");
00194 boost::filesystem::path generatedPath(testPath /
00195 "PathFinderRegression.Virtex5.Test1.generated.xdl");
00196 std::cout << referencePath.string() << std::endl;
00197
00198 testRouteDesign(referencePath.string(), generatedPath.string());
00199 }
00200
00201 BOOST_AUTO_TEST_CASE(pathfinder_virtex6) {
00202
00203 int& argc = boost::unit_test::framework::master_test_suite().argc;;
00204 BOOST_REQUIRE(argc >= 1);
00205 char**&argv = boost::unit_test::framework::master_test_suite().argv;;
00206 torc::common::DirectoryTree directoryTree(argv[0]);
00207 boost::filesystem::path testPath(directoryTree.getExecutablePath()
00208 / "torc" / "router" / "PathFinderRegression");
00209 boost::filesystem::path referencePath(testPath / "PathFinderRegression.Virtex6.Test1.xdl");
00210 boost::filesystem::path generatedPath(testPath /
00211 "PathFinderRegression.Virtex6.Test1.generated.xdl");
00212 std::cout << referencePath.string() << std::endl;
00213
00214 testRouteDesign(referencePath.string(), generatedPath.string());
00215 }
00216
00217 BOOST_AUTO_TEST_SUITE_END()
00218 BOOST_AUTO_TEST_SUITE_END()
00219
00220 }
00221 }