00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/router/PathFinderUnitTest.cpp $ 00003 // $Id: PathFinderUnitTest.cpp 1 2011-02-25 22:11:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 /// \file 00017 /// \brief Unit Test for PathFinder class. 00018 00019 #include <boost/test/unit_test.hpp> 00020 #include "torc/architecture/XdlImporter.hpp" 00021 #include "torc/architecture/DDB.hpp" 00022 #include "torc/common/DirectoryTree.hpp" 00023 00024 #include "PathFinder.hpp" 00025 #include "NetRouter.hpp" 00026 //#include "NetRouterHeuristic.hpp" 00027 #include "PathFinderHeuristic.hpp" 00028 #include "RouteUtilities.hpp" 00029 #include "PathFinderNetRouterHeuristic.hpp" 00030 00031 namespace torc { 00032 namespace router { 00033 00034 BOOST_AUTO_TEST_SUITE(router) 00035 00036 /// \brief Unit test for the NetRouter. 00037 BOOST_AUTO_TEST_CASE(PathFinder) { 00038 00039 int& argc = boost::unit_test::framework::master_test_suite().argc;; 00040 BOOST_REQUIRE(argc >= 1); 00041 /* char**&argv = boost::unit_test::framework::master_test_suite().argv;; 00042 torc::common::DirectoryTree directoryTree(argv[0]); 00043 boost::filesystem::path testPath(directoryTree.getExecutablePath() / "torc" / "router"); 00044 boost::filesystem::path referencePath(testPath / "pathfindertest1.xdl"); 00045 std::cout << referencePath.string() << std::endl; 00046 00047 std::fstream fileStream(referencePath.string().c_str()); 00048 BOOST_REQUIRE(fileStream.good()); 00049 00050 architecture::XdlImporter importer; 00051 std::cout << "HERE" << std::endl; 00052 importer(fileStream, referencePath.string()); 00053 std::cout << "AND HERE" << std::endl; 00054 00055 torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr(); 00056 BOOST_REQUIRE(designPtr.get() != 0); 00057 BOOST_CHECK_EQUAL(designPtr->getNetCount(), 2376u); 00058 architecture::DDB* ddbPtr = importer.releaseDDBPtr(); 00059 00060 00061 00062 // architecture::DDB ddb("xc5vlx110t"); 00063 // NetRouterHeuristicBase* h = new NetRouterHeuristic(*ddbPtr); 00064 NetRouterHeuristicBase* h = new PathFinderNetRouterHeuristic(*ddbPtr); 00065 NetRouterBase* r = new NetRouter(*ddbPtr, h); 00066 NetVectorRouterHeuristicBase* vh = new PathFinderHeuristic(*ddbPtr); 00067 NetVectorRouterBase* vr = new PathFinder(*ddbPtr, vh, r); 00068 00069 RouteUtilities ru; 00070 RouteNetVector nets; 00071 std::cout << "RouteNets: " << nets.size() << std::endl; 00072 00073 ru.design2routenets(designPtr->netsBegin(), designPtr->netsEnd(), nets); 00074 00075 std::cout << "RouteNets: " << nets.size() << std::endl; 00076 std::cout << *ddbPtr; 00077 std::cout << "Clearing usage from import" << std::endl; 00078 ddbPtr->clearUsage(); 00079 00080 vr->route(nets); 00081 00082 std::cout << "Finished" << std::endl;*/ 00083 00084 } 00085 00086 BOOST_AUTO_TEST_SUITE_END() 00087 00088 } // namespace router 00089 } // namespace torc