* ./unicorn:

- Change: More consistants text-mode arguments.
This commit is contained in:
Jean-Paul Chaput 2010-05-26 07:03:04 +00:00
parent 5d452ce345
commit 0286d7ca1d
1 changed files with 64 additions and 49 deletions

View File

@ -107,7 +107,7 @@ namespace {
int main ( int argc, char *argv[] ) int main ( int argc, char *argv[] )
{ {
int returnCode = 0; int returnCode = 0;
bool kiteSuccess = false; bool kiteSuccess = true;
try { try {
float edgeCapacity; float edgeCapacity;
@ -121,46 +121,50 @@ int main ( int argc, char *argv[] )
bool coreDump; bool coreDump;
bool logMode; bool logMode;
bool textMode; bool textMode;
bool globalRoute;
bool detailedRoute;
bool loadGlobal; bool loadGlobal;
bool saveGlobal; bool saveGlobal;
poptions::options_description options ("Command line arguments & options"); poptions::options_description options ("Command line arguments & options");
options.add_options() options.add_options()
( "help,h" , "Print this help." ) ( "help,h" , "Print this help." )
( "verbose,v" , poptions::bool_switch(&verbose1)->default_value(false) ( "trace-level,l" , poptions::value<unsigned int>(&traceLevel)->default_value(1000)
, "First level of verbosity.") , "Set the level of trace, trace messages with a level superior to "
( "very-verbose,V", poptions::bool_switch(&verbose2)->default_value(false) "<arg> will be printed on <stderr>." )
, "Second level of verbosity.") ( "verbose,v" , poptions::bool_switch(&verbose1)->default_value(false)
( "info,i" , poptions::bool_switch(&info)->default_value(false) , "First level of verbosity.")
, "Lots of informational messages.") ( "very-verbose,V" , poptions::bool_switch(&verbose2)->default_value(false)
( "show-conf" , poptions::bool_switch(&showConf)->default_value(false) , "Second level of verbosity.")
, "Print Kite configuration settings.") ( "info,i" , poptions::bool_switch(&info)->default_value(false)
( "core-dump,D" , poptions::bool_switch(&coreDump)->default_value(false) , "Lots of informational messages.")
, "Enable core dumping.") ( "show-conf" , poptions::bool_switch(&showConf)->default_value(false)
( "log-mode,L" , poptions::bool_switch(&logMode)->default_value(false) , "Print Kite configuration settings.")
, "Disable ANSI escape sequences displaying.") ( "core-dump,D" , poptions::bool_switch(&coreDump)->default_value(false)
( "text,t" , poptions::bool_switch(&textMode)->default_value(false) , "Enable core dumping.")
, "Run in pure text mode.") ( "log-mode,L" , poptions::bool_switch(&logMode)->default_value(false)
( "global,g" , poptions::bool_switch(&loadGlobal)->default_value(false) , "Disable ANSI escape sequences displaying.")
, "Reload the global routing from disk.") ( "text,t" , poptions::bool_switch(&textMode)->default_value(false)
( "trace-level,l" , poptions::value<unsigned int>(&traceLevel)->default_value(1000) , "Run in pure text mode.")
, "Set the level of trace, trace messages with a level superior to " ( "global-route,G" , poptions::bool_switch(&globalRoute)->default_value(false)
"<arg> will be printed on <stderr>." ) , "Run the global router (Knik).")
( "tool,T" , poptions::value<string>() ( "load-global,g" , poptions::bool_switch(&loadGlobal)->default_value(false)
, "The tool to be run, in text mode." ) , "Reload the global routing from disk.")
( "edge,e" , poptions::value<float>(&edgeCapacity)->default_value(0.65) ( "save-global" , poptions::bool_switch(&saveGlobal)->default_value(false)
, "The egde density ratio applied on global router's edges." ) , "Save the global routing solution.")
( "expand-step" , poptions::value<float>(&expandStep)->default_value(0.99) ( "edge,e" , poptions::value<float>(&edgeCapacity)->default_value(0.65)
, "The density delta above which GCells are aggregateds." ) , "The egde density ratio applied on global router's edges." )
( "events-limit" , poptions::value<unsigned long>(&eventsLimit) ( "expand-step" , poptions::value<float>(&expandStep)->default_value(0.99)
, "The maximum number of iterations (events) that the router is" , "The density delta above which GCells are aggregateds." )
"allowed to perform." ) ( "events-limit" , poptions::value<unsigned long>(&eventsLimit)
( "cell,c" , poptions::value<string>() , "The maximum number of iterations (events) that the router is"
, "The name of the cell to load, whithout extension." ) "allowed to perform." )
( "save-design,s" , poptions::value<string>()->default_value("") ( "detailed-route,R" , poptions::bool_switch(&detailedRoute)->default_value(false)
, "Save the routed design.") , "Run the detailed router (Kite).")
( "save-global" , poptions::bool_switch(&saveGlobal)->default_value(false) ( "cell,c" , poptions::value<string>()
, "Save the global routing solution."); , "The name of the cell to load, whithout extension." )
( "save-design,s" , poptions::value<string>()
, "Save the routed design.");
poptions::variables_map arguments; poptions::variables_map arguments;
poptions::store ( poptions::parse_command_line(argc,argv,options), arguments ); poptions::store ( poptions::parse_command_line(argc,argv,options), arguments );
@ -191,6 +195,11 @@ int main ( int argc, char *argv[] )
cerr << "[ERROR] Cell not found: " << arguments["cell"].as<string>() << endl; cerr << "[ERROR] Cell not found: " << arguments["cell"].as<string>() << endl;
exit ( 2 ); exit ( 2 );
} }
} else {
loadGlobal = false;
saveGlobal = false;
globalRoute = false;
detailedRoute = false;
} }
Kite::Configuration::getDefault()->setEdgeCapacityPercent ( edgeCapacity ); Kite::Configuration::getDefault()->setEdgeCapacityPercent ( edgeCapacity );
@ -315,11 +324,15 @@ int main ( int argc, char *argv[] )
returnCode = qa->exec (); returnCode = qa->exec ();
ToolEngine::destroyAll (); ToolEngine::destroyAll ();
} else { } else {
if ( arguments.count("tool") and (arguments["tool"].as<string>() == "kite") ) { if ( detailedRoute and not (loadGlobal or globalRoute) ) globalRoute = true;
bool runKiteTool = loadGlobal or globalRoute or detailedRoute;
if ( runKiteTool ) {
//cell->flattenNets ( not arguments.count("global") ); //cell->flattenNets ( not arguments.count("global") );
unsigned int globalFlags = (arguments["global"].as<bool>()) ? Kite::LoadGlobalSolution unsigned int globalFlags = (loadGlobal) ? Kite::LoadGlobalSolution
: Kite::BuildGlobalSolution; : Kite::BuildGlobalSolution;
static KatabaticEngine::NetSet routingNets; static KatabaticEngine::NetSet routingNets;
KiteEngine* kite = KiteEngine::create ( cell ); KiteEngine* kite = KiteEngine::create ( cell );
@ -329,17 +342,19 @@ int main ( int argc, char *argv[] )
kite->runGlobalRouter ( globalFlags ); kite->runGlobalRouter ( globalFlags );
if ( saveGlobal ) kite->saveGlobalSolution (); if ( saveGlobal ) kite->saveGlobalSolution ();
kite->loadGlobalRouting ( Katabatic::LoadGrByNet, routingNets ); if ( detailedRoute ) {
kite->layerAssign ( Katabatic::NoNetLayerAssign ); kite->loadGlobalRouting ( Katabatic::LoadGrByNet, routingNets );
kite->runNegociate (); kite->layerAssign ( Katabatic::NoNetLayerAssign );
kiteSuccess = kite->getToolSuccess (); kite->runNegociate ();
kite->finalizeLayout (); kiteSuccess = kite->getToolSuccess ();
kite->dumpMeasures (); kite->finalizeLayout ();
kite->destroy (); kite->dumpMeasures ();
kite->destroy ();
if ( arguments.count("save-design") ) { if ( arguments.count("save-design") ) {
cell->setName ( arguments["save-design"].as<string>().c_str() ); cell->setName ( arguments["save-design"].as<string>().c_str() );
af->saveCell ( cell, Catalog::State::Physical ); af->saveCell ( cell, Catalog::State::Physical );
}
} }
returnCode = (kiteSuccess) ? 0 : 1; returnCode = (kiteSuccess) ? 0 : 1;