diff --git a/kite/src/CMakeLists.txt b/kite/src/CMakeLists.txt index abfcf78b..7b6668e6 100644 --- a/kite/src/CMakeLists.txt +++ b/kite/src/CMakeLists.txt @@ -96,13 +96,13 @@ OUTPUT_NAME "Kite" ) - add_executable ( kite-text ${kitecpps} ) - target_link_libraries ( kite-text kite ) + add_executable ( kite.bin ${kitecpps} ) + target_link_libraries ( kite.bin kite ) target_link_libraries ( pyKite kite ${CORIOLIS_PYTHON_LIBRARIES} ) install ( TARGETS kite DESTINATION lib${LIB_SUFFIX} ) - install ( TARGETS kite-text DESTINATION bin ) + install ( TARGETS kite.bin DESTINATION bin ) install ( TARGETS pyKite DESTINATION ${PYTHON_SITE_PACKAGES} ) install ( FILES ${includes} diff --git a/kite/src/KiteMain.cpp b/kite/src/KiteMain.cpp index fafbdc19..ecce5b83 100644 --- a/kite/src/KiteMain.cpp +++ b/kite/src/KiteMain.cpp @@ -2,14 +2,9 @@ // -*- C++ -*- // // This file is part of the Coriolis Software. -// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// Copyright (c) UPMC/LIP6 2008-2012, All Rights Reserved // -// =================================================================== -// -// $Id$ -// -// x-----------------------------------------------------------------x -// | | +// +-----------------------------------------------------------------+ // | C O R I O L I S | // | K i t e - D e t a i l e d R o u t e r | // | | @@ -17,28 +12,25 @@ // | E-mail : Jean-Paul.Chaput@asim.lip6.fr | // | =============================================================== | // | C++ Module : "./KiteMain.cpp" | -// | *************************************************************** | -// | U p d a t e s | -// | | -// x-----------------------------------------------------------------x +// +-----------------------------------------------------------------+ #include using namespace std; #include -namespace poptions = boost::program_options; +namespace bopts = boost::program_options; +#include "vlsisapd/configuration/Configuration.h" #include "hurricane/DebugSession.h" #include "hurricane/DataBase.h" #include "hurricane/Cell.h" #include "hurricane/Warning.h" #include "hurricane/UpdateSession.h" -#include "hurricane/viewer/HApplication.h" -#include "hurricane/viewer/Graphics.h" using namespace Hurricane; #include "crlcore/Utilities.h" +#include "crlcore/Banner.h" #include "crlcore/AllianceFramework.h" #include "crlcore/Hierarchy.h" #include "crlcore/ToolBox.h" @@ -51,41 +43,6 @@ using namespace Knik; using namespace Kite; -namespace { - - -// ------------------------------------------------------------------- -// Function : "printHelp()". - - void printHelp () - { - cout << endl; - cout << "Usage: kite [-v|--verbose] [-V|--very-verbose] [-D|--core-dump] \\\n" - << " [-l|--trace-level ] [-c|--cell ] \\\n" - << endl; - cout << "Options:\n" - << " o [-v|--verbose] : First level of verbosity.\n" - << " o [-V|--very-verbose] : Second level of verbosity (very talkative).\n" - << " o [-D|--core-dump] : Enable core dumping.\n" - << " o [-l|--trace-level ] :\n" - << " Sets the level of trace, trace messages with a level superior to\n" - << " will be printed on .\n" - << " o [-c|--cell ] :\n" - << " The name of the Cell to load, without extention.\n" - << endl; - } - - -} // End of anonymous namespace. - - - - -// x-----------------------------------------------------------------x -// | Fonctions Definitions | -// x-----------------------------------------------------------------x - - // ------------------------------------------------------------------- // Function : "main()". @@ -95,112 +52,129 @@ int main ( int argc, char *argv[] ) bool kiteSuccess = false; try { - float edgeCapacity; + Banner banner( "Kite" + , "1.0b" + , "Coriolis Router" + , "2008" + , "Jean-Paul Chaput" + , "" + ); + unsigned int traceLevel; bool verbose1; bool verbose2; + bool showConf; bool info; + bool bug; bool coreDump; bool logMode; bool loadGlobal; - bool saveDesign; + bool dumpMeasures; + bool saveGlobal; + bool destroyDatabase; - poptions::options_description options ("Command line arguments & options"); + bopts::options_description options ("Command line arguments & options"); options.add_options() - ( "help,h" , "Print this help." ) - ( "verbose,v" , poptions::bool_switch(&verbose1)->default_value(false) - , "First level of verbosity.") - ( "very-verbose,V", poptions::bool_switch(&verbose2)->default_value(false) - , "Second level of verbosity.") - ( "info,i" , poptions::bool_switch(&info)->default_value(false) - , "Lots of informational messages.") - ( "core-dump,D" , poptions::bool_switch(&coreDump)->default_value(false) - , "Enable core dumping.") - ( "log-mode,L" , poptions::bool_switch(&logMode)->default_value(false) - , "Disable ANSI escape sequences displaying.") - ( "global,g" , poptions::bool_switch(&loadGlobal)->default_value(false) - , "Reload the global routing from disk.") - ( "trace-level,l" , poptions::value(&traceLevel)->default_value(1000) - , "Set the level of trace, trace messages with a level superior to " - " will be printed on ." ) - ( "edge,e" , poptions::value(&edgeCapacity)->default_value(65.0) - , "The egde density ratio applied on global router's edges." ) - ( "cell,c" , poptions::value() - , "The name of the cell to load, without extension." ) - ( "save,s" , poptions::bool_switch(&saveDesign)->default_value(false) - , "Save the routed design."); + ( "help,h" , "Print this help." ) + ( "verbose,v" , bopts::bool_switch(&verbose1)->default_value(false) + , "First level of verbosity.") + ( "very-verbose,V" , bopts::bool_switch(&verbose2)->default_value(false) + , "Second level of verbosity.") + ( "show-conf" , bopts::bool_switch(&showConf)->default_value(false) + , "Print Kite configuration settings.") + ( "info,i" , bopts::bool_switch(&info)->default_value(false) + , "Lots of informational messages.") + ( "bug,b" , bopts::bool_switch(&bug)->default_value(false) + , "Display bug related messages.") + ( "log-mode,L" , bopts::bool_switch(&logMode)->default_value(false) + , "Disable ANSI escape sequences displaying.") + ( "trace-level,l" , bopts::value(&traceLevel)->default_value(1000) + , "Set the level of trace, trace messages with a level superior to " + " will be printed on ." ) + ( "core-dump,D" , bopts::bool_switch(&coreDump)->default_value(false) + , "Enable core dumping.") + ( "load-global,g" , bopts::bool_switch(&loadGlobal)->default_value(false) + , "Do *not* run the global router (Knik), reuse previous routing (.kgr).") + ( "save-global" , bopts::bool_switch(&saveGlobal)->default_value(false) + , "Save the global routing solution.") + ( "dump-measures,M", bopts::bool_switch(&dumpMeasures)->default_value(false) + , "Dump statistical measurements on the disk.") + ( "cell,c" , bopts::value() + , "The name of the cell to load, without extension." ) + ( "save-design,s" , bopts::value() + , "Save the routed design under the given name.") + ( "destroy-db" , bopts::bool_switch(&destroyDatabase)->default_value(false) + , "Perform a complete deletion of the database (may be buggy)."); - poptions::variables_map arguments; - poptions::store ( poptions::parse_command_line(argc,argv,options), arguments ); - poptions::notify ( arguments ); + bopts::variables_map arguments; + bopts::store ( bopts::parse_command_line(argc,argv,options), arguments ); + bopts::notify ( arguments ); if ( arguments.count("help") or not arguments.count("cell") ) { + cout << banner << endl; cout << options << endl; exit ( 0 ); } - System::get()->setCatchCore ( not coreDump ); + Cfg::Configuration::pushDefaultPriority( Cfg::Parameter::CommandLine ); + if (arguments["core-dump" ].as()) Cfg::getParamBool("misc.catchCore" )->setBool( false ); + if (arguments["verbose" ].as()) Cfg::getParamBool("misc.verboseLevel1")->setBool( true ); + if (arguments["very-verbose"].as()) Cfg::getParamBool("misc.verboseLevel2")->setBool( true ); + if (arguments["info" ].as()) Cfg::getParamBool("misc.info" )->setBool( true ); + if (arguments["bug" ].as()) Cfg::getParamBool("misc.bug" )->setBool( true ); + if (arguments["log-mode" ].as()) Cfg::getParamBool("misc.logMode" )->setBool( true ); + if (arguments["show-conf" ].as()) Cfg::getParamBool("misc.showConf" )->setBool( true ); - if ( verbose1 ) mstream::enable ( mstream::VerboseLevel1 ); - if ( verbose2 ) mstream::enable ( mstream::VerboseLevel2 ); - if ( info ) mstream::enable ( mstream::Info ); - if ( logMode ) tty::disable (); + if (arguments.count("trace-level" )) Cfg::getParamInt("misc.traceLevel")->setInt( traceLevel ); + Cfg::Configuration::popDefaultPriority(); - ltracelevel ( traceLevel ); + cmess1 << banner << endl; + showConf = Cfg::getParamBool("misc.showConf")->asBool(); dbo_ptr db ( DataBase::create() ); dbo_ptr af ( AllianceFramework::create() ); Cell* cell = NULL; if ( arguments.count("cell") ) { - cell = af->getCell (arguments["cell"].as().c_str(), Catalog::State::Views ); - if (!cell) { + cell = af->getCell( arguments["cell"].as().c_str(), Catalog::State::Views ); + if (not cell) { cerr << af->getPrint() << endl; cerr << "[ERROR] Cell not found: " << arguments["cell"].as() << endl; exit ( 2 ); } } - //Kite::Configuration::getDefault()->setEdgeCapacityPercent ( edgeCapacity ); + KatabaticEngine::NetSet routingNets; + unsigned int globalFlags = (loadGlobal) ? Kite::LoadGlobalSolution + : Kite::BuildGlobalSolution; - cell->flattenNets ( not arguments.count("global") ); + KiteEngine* kite = KiteEngine::create( cell ); + if (showConf) kite->printConfiguration(); - KnikEngine* knik = KnikEngine::create ( cell ); - if ( not loadGlobal ) { - knik->run (); - } else { - knik->createRoutingGraph (); - knik->loadSolution (); - } + kite->runGlobalRouter( globalFlags ); + if (saveGlobal) kite->saveGlobalSolution (); - static KatabaticEngine::NetSet routingNets; - KiteEngine* kite = KiteEngine::create ( cell ); - // kite->setSaturateRatio ( 0.85 ); - // kite->setExpandStep ( 0.20 ); - // kite->setRipupCost ( 3 ); - // kite->setRipupLimit ( Configuration::BorderRipupLimit, 25 ); - // kite->setRipupLimit ( Configuration::StrapRipupLimit , 15 ); - // kite->setRipupLimit ( Configuration::LocalRipupLimit , 5 ); - // kite->setRipupLimit ( Configuration::GlobalRipupLimit, 5 ); - // kite->setRipupLimit ( Configuration::LongGlobalRipupLimit, 5 ); - kite->runGlobalRouter ( Kite::LoadGlobalSolution ); - kite->loadGlobalRouting ( Katabatic::LoadGrByNet, routingNets ); - kite->layerAssign ( Katabatic::NoNetLayerAssign ); - kite->runNegociate (); - kiteSuccess = kite->getToolSuccess (); - kite->finalizeLayout (); - kite->destroy (); - knik->destroy (); + kite->loadGlobalRouting( Katabatic::LoadGrByNet, routingNets ); + kite->layerAssign ( Katabatic::NoNetLayerAssign ); + kite->runNegociate (); + kiteSuccess = kite->getToolSuccess(); + kite->finalizeLayout (); - if ( saveDesign ) { - string name = getString(cell->getName()) + "_kite"; + if (dumpMeasures) kite->dumpMeasures(); + kite->destroy(); + + if (arguments.count("save-design")) { + string name = arguments["save-design"].as(); cell->setName ( name ); af->saveCell ( cell, Catalog::State::Physical ); } returnCode = (kiteSuccess) ? 0 : 1; + + if (not destroyDatabase) exit( returnCode ); + cmess1 << " o Full database deletion (may be buggy)." << endl; } - catch ( poptions::error& e ) { + catch ( bopts::error& e ) { cerr << "[ERROR] " << e.what() << endl; exit ( 1 ); } @@ -208,6 +182,10 @@ int main ( int argc, char *argv[] ) cerr << e.what() << endl; exit ( 1 ); } + catch ( exception& e ) { + cerr << "[ERROR] " << e.what() << endl; + exit ( 1 ); + } catch ( ... ) { cout << "[ERROR] Abnormal termination: unmanaged exception.\n" << endl; exit ( 2 ); diff --git a/kite/src/RoutingEvent.cpp b/kite/src/RoutingEvent.cpp index 859608b0..791e249b 100644 --- a/kite/src/RoutingEvent.cpp +++ b/kite/src/RoutingEvent.cpp @@ -290,13 +290,14 @@ namespace { if ( _conflicts.size() > 0 ) { DbU::Unit halfConflict = 0; size_t i = 0; - for ( ; i<_conflicts.size() ; ++i ) { + for ( ; i<_conflicts.size()-1 ; ++i ) { halfConflict += _conflicts.size(); if ( halfConflict > _conflictLength/2 ) break; } // Ugly: hard-coded pitch. + cerr << "_conflicts.size():" << _conflicts.size() << " " << i << endl; _breakPos = _conflicts[i].getVMin() - DbU::lambda(5.0); } }