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/packer/UnpackTest.cpp $ 00003 // $Id: UnpackTest.cpp 10 2011-10-12 18:40: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 #include <fstream> 00017 #include "torc/common/DirectoryTree.hpp" 00018 #include "torc/Physical.hpp" 00019 #include "torc/physical/XdlImporter.hpp" 00020 #include "torc/physical/XdlExporter.hpp" 00021 #include "torc/packer/XdlUnpack.hpp" 00022 #include "torc/packer/CombinationalPath.hpp" 00023 #include "torc/packer/RcFactory.hpp" 00024 00025 using namespace std; 00026 int main(int argc, char *argv[]) { 00027 00028 if (argc != 2) { 00029 std::cout << "Usage: " << argv[0] << " <input xdlfile>" << std::endl; 00030 return 1; 00031 } 00032 00033 ifstream inp(argv[1]); 00034 cout<<"Reading xdl file ....................."<<endl; 00035 torc::physical::XdlImporter importer; 00036 importer(inp, ""); 00037 torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr(); 00038 00039 torc::physical::XdlUnpack unpacker; 00040 cout<<"Unpacking ............................"<<endl; 00041 torc::physical::DesignSharedPtr dp = unpacker(designPtr); 00042 string unpackName = argv[1]; 00043 unpackName += "_unpack"; 00044 ofstream outp(unpackName.c_str()); 00045 torc::physical::XdlExporter fileExporter(outp); 00046 fileExporter(dp); 00047 cout<<"Extracting combinational paths ......."<<endl; 00048 // test combinational paths 00049 torc::physical::CombinationalPathSharedPtr combPtr = torc::physical::RcFactory::newCombinationalPathPtr(); 00050 combPtr->setPatchCounts(dp); 00051 torc::physical::CombinationalPath::RoutingNetSharedPtrConstIterator rnb = combPtr->routingNetsBegin(); 00052 torc::physical::CombinationalPath::RoutingNetSharedPtrConstIterator rne = combPtr->routingNetsEnd(); 00053 cout<<"Done ................................."<<endl; 00054 /*while(rnb<rne){ 00055 cout<<(*rnb)->getName()<<":"<<endl; 00056 size_t n=(*rnb)->getSuperNet()->getSourceCount() + (*rnb)->getSuperNet()->getSinkCount(); 00057 for(size_t i=0; i<n; ++i) 00058 cout<<"\n"<<(*rnb)->getPathCount(i)<<endl; 00059 ++rnb; 00060 }*/ 00061 return 0; 00062 }