2010-03-09 09:24:55 -06:00
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
Support of RoutingGauge, part 2.
In Katabatic & Kite, remove all hard-coded values related to track pitches.
* New: In <Session>, add more convenience function to access RoutingGauge
characteristics.
* New: In <AutoSegment>, <AutoContact>, add support for the "depth spin",
that is, if the source/target contacts are going "top" or "down".
Used to compute the perpandicular pitch. Need a small modification
of the revalidation mechanism. The observers of <AutoSegment> are
notified when the spin changes.
* New: In <AutoSegment>, the getPPitch() method allow to compute the
"perpandicular pitch". For now it is simply the greatest from the
source perpandicular pitch and the target perpandicular pitch.
Make uses of the "depth spin".
* New: In <TrackElement>, <TrackSegment>, cache the perpandicular pitch.
Updated through the notification from the observable.
2014-05-19 10:58:38 -05:00
|
|
|
// Copyright (c) UPMC/LIP6 2008-2014, All Rights Reserved
|
2010-03-09 09:24:55 -06:00
|
|
|
//
|
2012-12-09 05:18:38 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2010-03-09 09:24:55 -06:00
|
|
|
// | 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 |
|
|
|
|
// | |
|
|
|
|
// | Author : Jean-Paul CHAPUT |
|
|
|
|
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
|
|
|
// | =============================================================== |
|
|
|
|
// | C++ Module : "./KiteMain.cpp" |
|
2012-12-09 05:18:38 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
#include <memory>
|
2010-03-09 09:24:55 -06:00
|
|
|
using namespace std;
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
#include <boost/program_options.hpp>
|
2012-12-09 05:18:38 -06:00
|
|
|
namespace bopts = boost::program_options;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
#include "vlsisapd/configuration/Configuration.h"
|
|
|
|
#include "hurricane/DebugSession.h"
|
|
|
|
#include "hurricane/DataBase.h"
|
|
|
|
#include "hurricane/Cell.h"
|
|
|
|
#include "hurricane/Warning.h"
|
2010-03-09 09:24:55 -06:00
|
|
|
using namespace Hurricane;
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
#include "crlcore/Utilities.h"
|
|
|
|
#include "crlcore/Banner.h"
|
|
|
|
#include "crlcore/AllianceFramework.h"
|
|
|
|
#include "crlcore/Hierarchy.h"
|
|
|
|
#include "crlcore/ToolBox.h"
|
2010-03-09 09:24:55 -06:00
|
|
|
using namespace CRL;
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
#include "knik/KnikEngine.h"
|
2010-03-09 09:24:55 -06:00
|
|
|
using namespace Knik;
|
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
#include "kite/KiteEngine.h"
|
2010-03-09 09:24:55 -06:00
|
|
|
using namespace Kite;
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Function : "main()".
|
|
|
|
|
|
|
|
int main ( int argc, char *argv[] )
|
|
|
|
{
|
|
|
|
int returnCode = 0;
|
|
|
|
bool kiteSuccess = false;
|
|
|
|
|
|
|
|
try {
|
2012-12-09 05:18:38 -06:00
|
|
|
Banner banner( "Kite"
|
|
|
|
, "1.0b"
|
|
|
|
, "Coriolis Router"
|
|
|
|
, "2008"
|
|
|
|
, "Jean-Paul Chaput"
|
|
|
|
, ""
|
|
|
|
);
|
|
|
|
|
2010-03-09 09:24:55 -06:00
|
|
|
unsigned int traceLevel;
|
|
|
|
bool verbose1;
|
|
|
|
bool verbose2;
|
2012-12-09 05:18:38 -06:00
|
|
|
bool showConf;
|
2010-03-09 09:24:55 -06:00
|
|
|
bool info;
|
2012-12-09 05:18:38 -06:00
|
|
|
bool bug;
|
2010-03-09 09:24:55 -06:00
|
|
|
bool coreDump;
|
|
|
|
bool logMode;
|
|
|
|
bool loadGlobal;
|
2012-12-09 05:18:38 -06:00
|
|
|
bool dumpMeasures;
|
|
|
|
bool saveGlobal;
|
|
|
|
bool destroyDatabase;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2012-12-09 05:18:38 -06:00
|
|
|
bopts::options_description options ("Command line arguments & options");
|
2010-03-09 09:24:55 -06:00
|
|
|
options.add_options()
|
2012-12-09 05:18:38 -06:00
|
|
|
( "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<unsigned int>(&traceLevel)->default_value(1000)
|
|
|
|
, "Set the level of trace, trace messages with a level superior to "
|
|
|
|
"<arg> will be printed on <stderr>." )
|
|
|
|
( "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<string>()
|
|
|
|
, "The name of the cell to load, without extension." )
|
|
|
|
( "save-design,s" , bopts::value<string>()
|
|
|
|
, "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).");
|
|
|
|
|
|
|
|
bopts::variables_map arguments;
|
|
|
|
bopts::store ( bopts::parse_command_line(argc,argv,options), arguments );
|
|
|
|
bopts::notify ( arguments );
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
if ( arguments.count("help") or not arguments.count("cell") ) {
|
2012-12-09 05:18:38 -06:00
|
|
|
cout << banner << endl;
|
2010-03-09 09:24:55 -06:00
|
|
|
cout << options << endl;
|
|
|
|
exit ( 0 );
|
|
|
|
}
|
|
|
|
|
2012-12-09 05:18:38 -06:00
|
|
|
Cfg::Configuration::pushDefaultPriority( Cfg::Parameter::CommandLine );
|
|
|
|
if (arguments["core-dump" ].as<bool>()) Cfg::getParamBool("misc.catchCore" )->setBool( false );
|
|
|
|
if (arguments["verbose" ].as<bool>()) Cfg::getParamBool("misc.verboseLevel1")->setBool( true );
|
|
|
|
if (arguments["very-verbose"].as<bool>()) Cfg::getParamBool("misc.verboseLevel2")->setBool( true );
|
|
|
|
if (arguments["info" ].as<bool>()) Cfg::getParamBool("misc.info" )->setBool( true );
|
|
|
|
if (arguments["bug" ].as<bool>()) Cfg::getParamBool("misc.bug" )->setBool( true );
|
|
|
|
if (arguments["log-mode" ].as<bool>()) Cfg::getParamBool("misc.logMode" )->setBool( true );
|
|
|
|
if (arguments["show-conf" ].as<bool>()) Cfg::getParamBool("misc.showConf" )->setBool( true );
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2012-12-09 05:18:38 -06:00
|
|
|
if (arguments.count("trace-level" )) Cfg::getParamInt("misc.traceLevel")->setInt( traceLevel );
|
|
|
|
Cfg::Configuration::popDefaultPriority();
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2012-12-09 05:18:38 -06:00
|
|
|
cmess1 << banner << endl;
|
|
|
|
showConf = Cfg::getParamBool("misc.showConf")->asBool();
|
2010-03-09 09:24:55 -06:00
|
|
|
|
|
|
|
dbo_ptr<DataBase> db ( DataBase::create() );
|
|
|
|
dbo_ptr<AllianceFramework> af ( AllianceFramework::create() );
|
|
|
|
Cell* cell = NULL;
|
|
|
|
|
|
|
|
if ( arguments.count("cell") ) {
|
2012-12-09 05:18:38 -06:00
|
|
|
cell = af->getCell( arguments["cell"].as<string>().c_str(), Catalog::State::Views );
|
|
|
|
if (not cell) {
|
2010-03-09 09:24:55 -06:00
|
|
|
cerr << af->getPrint() << endl;
|
|
|
|
cerr << "[ERROR] Cell not found: " << arguments["cell"].as<string>() << endl;
|
|
|
|
exit ( 2 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-09 05:18:38 -06:00
|
|
|
KatabaticEngine::NetSet routingNets;
|
2013-12-03 18:59:29 -06:00
|
|
|
unsigned int globalFlags = (loadGlobal) ? Kite::KtLoadGlobalRouting
|
|
|
|
: Kite::KtBuildGlobalRouting;
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2012-12-09 05:18:38 -06:00
|
|
|
KiteEngine* kite = KiteEngine::create( cell );
|
|
|
|
if (showConf) kite->printConfiguration();
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2012-12-09 05:18:38 -06:00
|
|
|
kite->runGlobalRouter( globalFlags );
|
|
|
|
if (saveGlobal) kite->saveGlobalSolution ();
|
2010-03-09 09:24:55 -06:00
|
|
|
|
2013-12-03 18:59:29 -06:00
|
|
|
kite->loadGlobalRouting ( Katabatic::EngineLoadGrByNet, routingNets );
|
|
|
|
kite->balanceGlobalDensity();
|
|
|
|
kite->layerAssign ( Katabatic::EngineNoNetLayerAssign );
|
|
|
|
kite->runNegociate ();
|
2012-12-09 05:18:38 -06:00
|
|
|
kiteSuccess = kite->getToolSuccess();
|
|
|
|
kite->finalizeLayout ();
|
|
|
|
|
|
|
|
if (dumpMeasures) kite->dumpMeasures();
|
|
|
|
kite->destroy();
|
|
|
|
|
|
|
|
if (arguments.count("save-design")) {
|
|
|
|
string name = arguments["save-design"].as<string>();
|
2010-03-09 09:24:55 -06:00
|
|
|
cell->setName ( name );
|
|
|
|
af->saveCell ( cell, Catalog::State::Physical );
|
|
|
|
}
|
|
|
|
|
|
|
|
returnCode = (kiteSuccess) ? 0 : 1;
|
2012-12-09 05:18:38 -06:00
|
|
|
|
|
|
|
if (not destroyDatabase) exit( returnCode );
|
|
|
|
cmess1 << " o Full database deletion (may be buggy)." << endl;
|
2010-03-09 09:24:55 -06:00
|
|
|
}
|
2012-12-09 05:18:38 -06:00
|
|
|
catch ( bopts::error& e ) {
|
2010-03-09 09:24:55 -06:00
|
|
|
cerr << "[ERROR] " << e.what() << endl;
|
|
|
|
exit ( 1 );
|
|
|
|
}
|
|
|
|
catch ( Error& e ) {
|
|
|
|
cerr << e.what() << endl;
|
|
|
|
exit ( 1 );
|
|
|
|
}
|
2012-12-09 05:18:38 -06:00
|
|
|
catch ( exception& e ) {
|
|
|
|
cerr << "[ERROR] " << e.what() << endl;
|
|
|
|
exit ( 1 );
|
|
|
|
}
|
2010-03-09 09:24:55 -06:00
|
|
|
catch ( ... ) {
|
|
|
|
cout << "[ERROR] Abnormal termination: unmanaged exception.\n" << endl;
|
|
|
|
exit ( 2 );
|
|
|
|
}
|
|
|
|
|
|
|
|
return returnCode;
|
|
|
|
}
|