2010-03-09 09:20:13 -06:00
|
|
|
|
|
|
|
// -*- C++ -*-
|
|
|
|
//
|
|
|
|
// This file is part of the Coriolis Software.
|
2013-04-21 10:36:06 -05:00
|
|
|
// Copyright (c) UPMC 2008-2013, All Rights Reserved
|
2010-03-09 09:20:13 -06:00
|
|
|
//
|
2011-02-02 05:17:46 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2010-03-09 09:20:13 -06:00
|
|
|
// | C O R I O L I S |
|
|
|
|
// | Alliance / Hurricane Interface |
|
|
|
|
// | |
|
|
|
|
// | Author : Jean-Paul CHAPUT |
|
|
|
|
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
|
|
|
// | =============================================================== |
|
2012-11-16 06:49:47 -06:00
|
|
|
// | C++ Module : "./Utilities.cpp" |
|
2011-02-02 05:17:46 -06:00
|
|
|
// +-----------------------------------------------------------------+
|
2010-03-09 09:20:13 -06:00
|
|
|
|
|
|
|
|
2012-11-16 06:49:47 -06:00
|
|
|
#include <Python.h>
|
2010-03-09 09:20:13 -06:00
|
|
|
#include <csignal>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstring>
|
2010-04-28 10:41:35 -05:00
|
|
|
#include <iomanip>
|
2010-03-09 09:20:13 -06:00
|
|
|
|
2010-06-22 08:55:37 -05:00
|
|
|
#include <boost/program_options.hpp>
|
|
|
|
namespace boptions = boost::program_options;
|
|
|
|
|
2013-04-21 10:36:06 -05:00
|
|
|
#include "vlsisapd/utilities/Path.h"
|
2010-06-22 08:55:37 -05:00
|
|
|
#include "vlsisapd/configuration/Configuration.h"
|
* ./crlcore/src/ccore:
- New: In Utilities, uses the new Backtrace to print the stack before
core-dumping.
- New: In Environment, pattern recognition of Pad model names.
- New: In AllianceFramework, pattern recognition of Pad model names.
- Bug: In Measures, add inspector support and uses pointer to prevent using
copy construction. Makes the inspector to core-dump.
- New: In RoutingLayerGauge, inspector support for Constant::Direction.
- Change: In ApDriver, correct managment of BIGVIA sizes. BIGVIA in one
metal keep their sizes, but BIGVIA whith cut must be expandeds to
contains their enclosure in metals. In Hurricane VIA size are relatives
to the cut but in Alliance, to the biggest metal.
Generate correct direction (always UP or RIGHT) for segments.
- Change: In ApParser, shrink BIGVIA to the size of their cut from the
Alliance format. Avoid VIA "bloating".
More thorough verification of Segment data coherency, mainly with
direction.
Suppress warning of non-existent logical instance in the special
case of "padreal".
- Change: In VstParserGrammar, perform an explicit plug connection on globals
Nets if the names of globals Nets differs.
- New: In display.xml, add style for printers (B&W).
- Bug: In technology.symbolic.xml, BLOCKAGE6 was associated to metal6 instead
of blockage6.
Correct extensions value for VIA metal layers above cut1.
- Bug: In Utilities, in System singleton constructor check of duplicated
type_info/RTTI initialization. Occurs when python modules are useds.
CRL must always be included first.
2010-11-16 07:57:57 -06:00
|
|
|
#include "hurricane/Backtrace.h"
|
2010-07-01 06:48:16 -05:00
|
|
|
#include "hurricane/Warning.h"
|
2010-07-15 06:46:40 -05:00
|
|
|
#include "hurricane/viewer/Script.h"
|
2010-03-09 09:20:13 -06:00
|
|
|
#include "crlcore/Utilities.h"
|
2012-11-16 06:49:47 -06:00
|
|
|
#include "crlcore/AllianceFramework.h"
|
2010-03-09 09:20:13 -06:00
|
|
|
|
|
|
|
|
2010-06-22 08:55:37 -05:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
using namespace Hurricane;
|
|
|
|
using namespace CRL;
|
|
|
|
|
|
|
|
|
|
|
|
void verboseLevel1Changed ( Cfg::Parameter* p )
|
|
|
|
{
|
2012-11-16 06:49:47 -06:00
|
|
|
if ( p->asBool() ) mstream::enable ( mstream::VerboseLevel1 );
|
|
|
|
else mstream::disable ( mstream::VerboseLevel1 );
|
2010-06-22 08:55:37 -05:00
|
|
|
|
|
|
|
//cerr << "Verbose Level 1: " << boolalpha << p->asBool() << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void verboseLevel2Changed ( Cfg::Parameter* p )
|
|
|
|
{
|
2012-11-16 06:49:47 -06:00
|
|
|
if ( p->asBool() ) mstream::enable ( mstream::VerboseLevel2 );
|
|
|
|
else mstream::disable ( mstream::VerboseLevel2 );
|
2010-06-22 08:55:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void infoChanged ( Cfg::Parameter* p )
|
|
|
|
{
|
|
|
|
if ( p->asBool() ) mstream::enable ( mstream::Info );
|
|
|
|
else mstream::disable ( mstream::Info );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-03 02:27:41 -06:00
|
|
|
void bugChanged ( Cfg::Parameter* p )
|
|
|
|
{
|
|
|
|
if ( p->asBool() ) mstream::enable ( mstream::Bug );
|
|
|
|
else mstream::disable ( mstream::Bug );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-22 08:55:37 -05:00
|
|
|
void catchCoreChanged ( Cfg::Parameter* p )
|
|
|
|
{
|
|
|
|
System::setCatchCore ( p->asBool() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void logModeChanged ( Cfg::Parameter* p )
|
|
|
|
{
|
2010-08-22 07:36:23 -05:00
|
|
|
if ( not p->asBool() ) tty::enable ();
|
|
|
|
else tty::disable ();
|
2010-06-22 08:55:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void traceLevelChanged ( Cfg::Parameter* p )
|
|
|
|
{
|
|
|
|
ltracelevel ( p->asInt() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-18 05:00:38 -05:00
|
|
|
void stratus1MappingNameChanged ( Cfg::Parameter* p )
|
|
|
|
{
|
2013-04-21 10:36:06 -05:00
|
|
|
Utilities::Path stratusMappingName ( p->asString() );
|
|
|
|
if ( not stratusMappingName.absolute() ) {
|
2010-07-18 05:00:38 -05:00
|
|
|
stratusMappingName = System::getPath("etc") / stratusMappingName;
|
|
|
|
}
|
|
|
|
setenv ( "STRATUS_MAPPING_NAME", stratusMappingName.string().c_str(), 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-22 08:55:37 -05:00
|
|
|
std::string environmentMapper ( std::string environmentName )
|
|
|
|
{
|
2010-11-17 09:40:39 -06:00
|
|
|
if ( environmentName == "HOME" ) return "home";
|
|
|
|
else if ( environmentName == "CORIOLIS_TOP" ) return "coriolis_top";
|
2010-07-18 05:00:38 -05:00
|
|
|
else if ( environmentName == "STRATUS_MAPPING_NAME" ) return "stratus_mapping_name";
|
2010-06-22 08:55:37 -05:00
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // End of anonymous namespace.
|
|
|
|
|
|
|
|
|
2010-04-28 10:41:35 -05:00
|
|
|
int tty::_width = 80;
|
2010-03-09 09:20:13 -06:00
|
|
|
bool tty::_enabled = true;
|
|
|
|
unsigned int mstream::_activeMask = mstream::Verbose0;
|
|
|
|
|
|
|
|
mstream cmess0 ( mstream::Verbose0, std::cout );
|
|
|
|
mstream cmess1 ( mstream::Verbose1, std::cout );
|
|
|
|
mstream cmess2 ( mstream::Verbose2, std::cout );
|
|
|
|
mstream cinfo ( mstream::Info , std::cout );
|
2012-12-03 02:27:41 -06:00
|
|
|
mstream cbug ( mstream::Bug , std::cout );
|
2010-03-09 09:20:13 -06:00
|
|
|
|
|
|
|
|
2010-04-28 10:41:35 -05:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Class : "::Dots".
|
|
|
|
|
|
|
|
|
|
|
|
Dots::Dots ( const std::string& left, const std::string& right ) : _left(left), _right(right) { }
|
|
|
|
|
|
|
|
|
|
|
|
Dots Dots::asPercentage ( const std::string& left, float value )
|
|
|
|
{
|
|
|
|
std::ostringstream right;
|
2010-06-13 15:50:18 -05:00
|
|
|
right << std::setprecision(3) << (value*100.0) << "%";
|
2010-04-28 10:41:35 -05:00
|
|
|
return Dots(left,right.str());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-08 07:02:31 -05:00
|
|
|
Dots Dots::asBool ( const std::string& left, bool value )
|
|
|
|
{ std::ostringstream right; right << std::boolalpha << value; return Dots(left,right.str()); }
|
|
|
|
|
|
|
|
|
2010-04-28 10:41:35 -05:00
|
|
|
Dots Dots::asUInt ( const std::string& left, unsigned int value )
|
|
|
|
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
|
|
|
|
|
|
|
|
2010-06-13 15:50:18 -05:00
|
|
|
Dots Dots::asInt ( const std::string& left, int value )
|
|
|
|
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
|
|
|
|
|
|
|
|
2010-04-28 10:41:35 -05:00
|
|
|
Dots Dots::asULong ( const std::string& left, unsigned long value )
|
|
|
|
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
|
|
|
|
|
|
|
|
|
|
|
Dots Dots::asSizet ( const std::string& left, size_t value )
|
|
|
|
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
|
|
|
|
|
|
|
|
|
|
|
Dots Dots::asDouble ( const std::string& left, double value )
|
|
|
|
{ std::ostringstream right; right << value; return Dots(left,right.str()); }
|
|
|
|
|
|
|
|
|
2010-06-08 07:02:31 -05:00
|
|
|
Dots Dots::asLambda ( const std::string& left, Hurricane::DbU::Unit value )
|
|
|
|
{ std::ostringstream right; right << Hurricane::DbU::getValueString(value); return Dots(left,right.str()); }
|
|
|
|
|
|
|
|
|
2010-06-13 15:50:18 -05:00
|
|
|
Dots Dots::asLambda ( const std::string& left, double value )
|
|
|
|
{ std::ostringstream right; right << Hurricane::DbU::getValueString(value); return Dots(left,right.str()); }
|
|
|
|
|
|
|
|
|
2010-04-28 10:41:35 -05:00
|
|
|
Dots Dots::asIdentifier ( const std::string& left, const std::string& value )
|
|
|
|
{ std::ostringstream right; right << "<" << value << ">"; return Dots(left,right.str()); }
|
|
|
|
|
|
|
|
|
|
|
|
Dots Dots::asString ( const std::string& left, const std::string& value )
|
|
|
|
{ return Dots(left,value); }
|
|
|
|
|
|
|
|
|
|
|
|
std::ostream& operator<< ( std::ostream& out, const Dots& dots )
|
|
|
|
{
|
|
|
|
int count = tty::getWidth() - 2 - dots._left.length() - dots._right.length();
|
|
|
|
out << dots._left << " "; while ( count-- > 0 ) out << "."; out << " " << dots._right;
|
|
|
|
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-09 09:20:13 -06:00
|
|
|
|
|
|
|
namespace CRL {
|
|
|
|
|
|
|
|
|
|
|
|
using std::cout;
|
|
|
|
using std::cerr;
|
|
|
|
using std::endl;
|
|
|
|
using std::string;
|
|
|
|
using std::ostringstream;
|
|
|
|
|
|
|
|
|
|
|
|
# define SIGTFLT 1
|
|
|
|
|
|
|
|
|
|
|
|
// Error messages.
|
|
|
|
const char* DupSystem = "\n Attempt to re-create Alliance System.";
|
|
|
|
const char* BadAllocProperty = "%s::create():\n Property allocation failed.\n";
|
|
|
|
const char* BadCreate = "%s::create():\n Memory allocation failed.\n";
|
|
|
|
const char* NullDataBase = "%s:\n\n The Hurricane DataBase have not been created yet.\n";
|
|
|
|
const char* NullTechnology = "%s:\n\n The Hurricane DataBase do not contain any technology.\n";
|
|
|
|
const char* NullLibrary = "%s:\n\n NULL Library given as argument.\n";
|
|
|
|
const char* NullCell = "%s:\n\n NULL Cell given as argument.\n";
|
|
|
|
const char* BadFopen = "%s:\n\n Unable to open %s file : \"%s\".\n";
|
|
|
|
const char* BadColorValue = "%s() :\n\n"
|
|
|
|
" Invalid color value for color \"%s\" : \"%s\".\n";
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Class : "CRL::System".
|
|
|
|
|
|
|
|
|
2010-07-01 06:48:16 -05:00
|
|
|
System* System::_singleton = NULL; //System::get();
|
2010-03-09 09:20:13 -06:00
|
|
|
|
2010-06-22 08:55:37 -05:00
|
|
|
|
|
|
|
System::System ()
|
|
|
|
: _catchCore(true)
|
|
|
|
{
|
|
|
|
// Immediate setup to avoid some tiresome looping...
|
|
|
|
_singleton = this;
|
2010-03-09 09:20:13 -06:00
|
|
|
|
|
|
|
// Set the trap function for the SIGINT signal (CTRL-C).
|
|
|
|
//if ( signal(SIGINT,System::TrapSig) == SIG_ERR )
|
|
|
|
// System::TrapSig ( SIGTFLT );
|
|
|
|
|
|
|
|
// Set the trap function for SIGFPE, SIGBUS, SIGABRT and SIGSEGV signals.
|
2010-06-22 08:55:37 -05:00
|
|
|
if ( ( signal(SIGFPE , System::_trapSig) == SIG_ERR )
|
|
|
|
|| ( signal(SIGBUS , System::_trapSig) == SIG_ERR )
|
|
|
|
|| ( signal(SIGABRT, System::_trapSig) == SIG_ERR )
|
|
|
|
|| ( signal(SIGPIPE, System::_trapSig) == SIG_ERR )
|
|
|
|
|| ( signal(SIGSEGV, System::_trapSig) == SIG_ERR ) )
|
|
|
|
System::_trapSig ( SIGTFLT );
|
|
|
|
|
|
|
|
// Environment variables reading.
|
|
|
|
boptions::options_description options ("Environment Variables");
|
|
|
|
options.add_options()
|
2010-11-17 09:40:39 -06:00
|
|
|
( "home" , boptions::value<string>()
|
|
|
|
, "User's home directory." )
|
2010-07-18 05:00:38 -05:00
|
|
|
( "coriolis_top" , boptions::value<string>()->default_value(CORIOLIS_TOP)
|
|
|
|
, "The root directory of the Coriolis installation tree." )
|
|
|
|
( "stratus_mapping_name", boptions::value<string>()
|
|
|
|
, "Stratus virtual cells mapping." );
|
2010-06-22 08:55:37 -05:00
|
|
|
|
|
|
|
boptions::variables_map arguments;
|
|
|
|
boptions::store ( boptions::parse_environment(options,environmentMapper), arguments );
|
|
|
|
boptions::notify ( arguments );
|
|
|
|
|
2012-11-16 06:49:47 -06:00
|
|
|
// Force creation of singleton at this stage.
|
|
|
|
// cerr << "In System singleton creation." << endl;
|
|
|
|
// AllianceFramework::get();
|
|
|
|
// cerr << "AllianceFramework has been allocated." << endl;
|
|
|
|
|
* ./crlcore/src/ccore:
- New: In Utilities, uses the new Backtrace to print the stack before
core-dumping.
- New: In Environment, pattern recognition of Pad model names.
- New: In AllianceFramework, pattern recognition of Pad model names.
- Bug: In Measures, add inspector support and uses pointer to prevent using
copy construction. Makes the inspector to core-dump.
- New: In RoutingLayerGauge, inspector support for Constant::Direction.
- Change: In ApDriver, correct managment of BIGVIA sizes. BIGVIA in one
metal keep their sizes, but BIGVIA whith cut must be expandeds to
contains their enclosure in metals. In Hurricane VIA size are relatives
to the cut but in Alliance, to the biggest metal.
Generate correct direction (always UP or RIGHT) for segments.
- Change: In ApParser, shrink BIGVIA to the size of their cut from the
Alliance format. Avoid VIA "bloating".
More thorough verification of Segment data coherency, mainly with
direction.
Suppress warning of non-existent logical instance in the special
case of "padreal".
- Change: In VstParserGrammar, perform an explicit plug connection on globals
Nets if the names of globals Nets differs.
- New: In display.xml, add style for printers (B&W).
- Bug: In technology.symbolic.xml, BLOCKAGE6 was associated to metal6 instead
of blockage6.
Correct extensions value for VIA metal layers above cut1.
- Bug: In Utilities, in System singleton constructor check of duplicated
type_info/RTTI initialization. Occurs when python modules are useds.
CRL must always be included first.
2010-11-16 07:57:57 -06:00
|
|
|
// Check for duplicated type_info initialization.
|
|
|
|
const boptions::variable_value& value = arguments["coriolis_top"];
|
|
|
|
if ( value.value().type() != typeid(string) ) {
|
|
|
|
throw Error("type_info RTTI tree has been initialized twice.\n\n"
|
|
|
|
" This may be due to incorrect import of Python modules, please ensure\n"
|
|
|
|
" that the CRL module is always imported first."
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-04-21 10:36:06 -05:00
|
|
|
Utilities::Path sysConfDir ( SYS_CONF_DIR );
|
|
|
|
if ( not sysConfDir.absolute() ) {
|
2010-06-22 08:55:37 -05:00
|
|
|
if ( arguments.count("coriolis_top") ) {
|
2010-11-17 09:40:39 -06:00
|
|
|
// const boptions::variable_value& value = arguments["coriolis_top"];
|
2010-07-17 05:22:34 -05:00
|
|
|
// cerr << "value:"
|
|
|
|
// << " empty:" << boolalpha << value.empty()
|
|
|
|
// << " defaulted:" << boolalpha << value.defaulted()
|
|
|
|
// << endl;
|
|
|
|
// const type_info& info = value.value().type();
|
|
|
|
// cerr << "type_info:" << info.name()
|
|
|
|
// << " vs. " << typeid(string).name() << endl;
|
|
|
|
// cerr << "Equal:" << boolalpha << (info == typeid(std::string)) << endl;
|
|
|
|
|
|
|
|
// const type_info& info2 = typeid(string);
|
|
|
|
// cerr << (void*)&(typeid(string))
|
|
|
|
// << " vs. " << (void*)&info2
|
|
|
|
// << " vs. " << (void*)&info
|
|
|
|
// << endl;
|
|
|
|
// cerr << "any_cast<string>:" << boost::any_cast<string>(value.value()) << endl;
|
|
|
|
|
2010-06-22 08:55:37 -05:00
|
|
|
sysConfDir = arguments["coriolis_top"].as<string>() / sysConfDir;
|
|
|
|
} else {
|
|
|
|
cerr << Error("Environment variable CORIOLIS_TOP not set,"
|
|
|
|
" may be unable to read configuration...") << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sysConfDir /= "coriolis2";
|
2012-11-16 06:49:47 -06:00
|
|
|
_pathes.insert ( make_pair("etc" ,sysConfDir ) );
|
|
|
|
_pathes.insert ( make_pair("home",arguments["home"].as<string>()) );
|
|
|
|
|
|
|
|
// Early setting of python pathes to be able to execute configuration scripts.
|
2013-04-21 10:36:06 -05:00
|
|
|
Utilities::Path pythonSitePackages ( PYTHON_SITE_PACKAGES );
|
2012-11-16 06:49:47 -06:00
|
|
|
pythonSitePackages = arguments["coriolis_top"].as<string>() / pythonSitePackages;
|
2012-12-03 02:27:41 -06:00
|
|
|
_pathes.insert ( make_pair("pythonSitePackages",pythonSitePackages.string()) );
|
2013-04-21 10:36:06 -05:00
|
|
|
Utilities::Path crlcoreDir = pythonSitePackages / "crlcore";
|
|
|
|
Utilities::Path stratusDir = pythonSitePackages / "stratus";
|
|
|
|
Utilities::Path cumulusDir = pythonSitePackages / "cumulus";
|
2012-11-16 06:49:47 -06:00
|
|
|
|
|
|
|
Isobar::Script::addPath ( sysConfDir.string() );
|
|
|
|
Isobar::Script::addPath ( pythonSitePackages.string() );
|
2012-12-03 02:27:41 -06:00
|
|
|
Isobar::Script::addPath ( crlcoreDir.string() );
|
2012-11-16 06:49:47 -06:00
|
|
|
Isobar::Script::addPath ( stratusDir.string() );
|
|
|
|
Isobar::Script::addPath ( cumulusDir.string() );
|
2010-06-22 08:55:37 -05:00
|
|
|
|
2012-11-16 06:49:47 -06:00
|
|
|
// Triggers Configuration singleton creation.
|
|
|
|
Cfg::Configuration::get ();
|
2010-06-22 08:55:37 -05:00
|
|
|
|
2010-07-18 05:00:38 -05:00
|
|
|
Cfg::getParamBool ("misc.catchCore" ,true )->registerCb ( catchCoreChanged );
|
|
|
|
Cfg::getParamBool ("misc.verboseLevel1" ,true )->registerCb ( verboseLevel1Changed );
|
|
|
|
Cfg::getParamBool ("misc.verboseLevel2" ,true )->registerCb ( verboseLevel2Changed );
|
|
|
|
Cfg::getParamBool ("misc.info" ,false)->registerCb ( infoChanged );
|
2012-12-03 02:27:41 -06:00
|
|
|
Cfg::getParamBool ("misc.bug" ,false)->registerCb ( bugChanged );
|
* ./crlcore/src/ccore:
- New: In Utilities, uses the new Backtrace to print the stack before
core-dumping.
- New: In Environment, pattern recognition of Pad model names.
- New: In AllianceFramework, pattern recognition of Pad model names.
- Bug: In Measures, add inspector support and uses pointer to prevent using
copy construction. Makes the inspector to core-dump.
- New: In RoutingLayerGauge, inspector support for Constant::Direction.
- Change: In ApDriver, correct managment of BIGVIA sizes. BIGVIA in one
metal keep their sizes, but BIGVIA whith cut must be expandeds to
contains their enclosure in metals. In Hurricane VIA size are relatives
to the cut but in Alliance, to the biggest metal.
Generate correct direction (always UP or RIGHT) for segments.
- Change: In ApParser, shrink BIGVIA to the size of their cut from the
Alliance format. Avoid VIA "bloating".
More thorough verification of Segment data coherency, mainly with
direction.
Suppress warning of non-existent logical instance in the special
case of "padreal".
- Change: In VstParserGrammar, perform an explicit plug connection on globals
Nets if the names of globals Nets differs.
- New: In display.xml, add style for printers (B&W).
- Bug: In technology.symbolic.xml, BLOCKAGE6 was associated to metal6 instead
of blockage6.
Correct extensions value for VIA metal layers above cut1.
- Bug: In Utilities, in System singleton constructor check of duplicated
type_info/RTTI initialization. Occurs when python modules are useds.
CRL must always be included first.
2010-11-16 07:57:57 -06:00
|
|
|
Cfg::getParamBool ("misc.logMode" ,false)->registerCb ( logModeChanged );
|
2010-07-18 05:00:38 -05:00
|
|
|
Cfg::getParamInt ("misc.traceLevel" ,1000 )->registerCb ( traceLevelChanged );
|
|
|
|
Cfg::getParamString("stratus1.mappingName","./stratus2sxlib.xml")->registerCb ( stratus1MappingNameChanged );
|
2010-06-22 08:55:37 -05:00
|
|
|
|
|
|
|
// Immediate update from the configuration.
|
|
|
|
catchCoreChanged ( Cfg::getParamBool("misc.catchCore" ) );
|
|
|
|
verboseLevel1Changed ( Cfg::getParamBool("misc.verboseLevel1") );
|
|
|
|
verboseLevel2Changed ( Cfg::getParamBool("misc.verboseLevel2") );
|
|
|
|
infoChanged ( Cfg::getParamBool("misc.info" ) );
|
2012-12-03 02:27:41 -06:00
|
|
|
bugChanged ( Cfg::getParamBool("misc.bug" ) );
|
2010-06-22 08:55:37 -05:00
|
|
|
logModeChanged ( Cfg::getParamBool("misc.logMode" ) );
|
|
|
|
traceLevelChanged ( Cfg::getParamInt ("misc.traceLevel" ) );
|
|
|
|
|
2013-04-21 10:36:06 -05:00
|
|
|
Utilities::Path stratusMappingName;
|
2010-07-18 05:00:38 -05:00
|
|
|
if ( arguments.count("stratus_mapping_name") ) {
|
|
|
|
Cfg::getParamString( "stratus1.mappingName")->setString ( arguments["stratus_mapping_name"].as<string>() );
|
|
|
|
}
|
2010-06-22 08:55:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
System *System::get ()
|
|
|
|
{
|
|
|
|
if ( _singleton == NULL ) {
|
|
|
|
_singleton = new System ();
|
|
|
|
}
|
2010-03-09 09:20:13 -06:00
|
|
|
|
|
|
|
return _singleton;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-22 08:55:37 -05:00
|
|
|
void System::_trapSig ( int sig )
|
2010-03-09 09:20:13 -06:00
|
|
|
{
|
2010-06-22 08:55:37 -05:00
|
|
|
cerr << "\n\n[CRL ERROR] System::_trapSig():\n" << endl;
|
* ./crlcore/src/ccore:
- New: In Utilities, uses the new Backtrace to print the stack before
core-dumping.
- New: In Environment, pattern recognition of Pad model names.
- New: In AllianceFramework, pattern recognition of Pad model names.
- Bug: In Measures, add inspector support and uses pointer to prevent using
copy construction. Makes the inspector to core-dump.
- New: In RoutingLayerGauge, inspector support for Constant::Direction.
- Change: In ApDriver, correct managment of BIGVIA sizes. BIGVIA in one
metal keep their sizes, but BIGVIA whith cut must be expandeds to
contains their enclosure in metals. In Hurricane VIA size are relatives
to the cut but in Alliance, to the biggest metal.
Generate correct direction (always UP or RIGHT) for segments.
- Change: In ApParser, shrink BIGVIA to the size of their cut from the
Alliance format. Avoid VIA "bloating".
More thorough verification of Segment data coherency, mainly with
direction.
Suppress warning of non-existent logical instance in the special
case of "padreal".
- Change: In VstParserGrammar, perform an explicit plug connection on globals
Nets if the names of globals Nets differs.
- New: In display.xml, add style for printers (B&W).
- Bug: In technology.symbolic.xml, BLOCKAGE6 was associated to metal6 instead
of blockage6.
Correct extensions value for VIA metal layers above cut1.
- Bug: In Utilities, in System singleton constructor check of duplicated
type_info/RTTI initialization. Occurs when python modules are useds.
CRL must always be included first.
2010-11-16 07:57:57 -06:00
|
|
|
cerr << "Program stack:\n" << Backtrace().textWhere() << endl;
|
2010-03-09 09:20:13 -06:00
|
|
|
|
|
|
|
switch ( sig ) {
|
|
|
|
case SIGINT:
|
|
|
|
// User interrupt with CTRL-C.
|
|
|
|
//emergency ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SIGTERM:
|
|
|
|
case SIGFPE:
|
|
|
|
case SIGBUS:
|
|
|
|
case SIGSEGV:
|
|
|
|
case SIGABRT:
|
|
|
|
case SIGPIPE:
|
|
|
|
//emergency ();
|
|
|
|
|
|
|
|
// Ouch!! This may result from a program bug.
|
|
|
|
cerr << " An program internal bug have occur ";
|
|
|
|
|
|
|
|
if (sig == SIGFPE ) cerr << "(SIGFPE).";
|
|
|
|
if (sig == SIGBUS ) cerr << "(SIGBUS).";
|
|
|
|
if (sig == SIGSEGV) cerr << "(SIGSEGV).";
|
|
|
|
if (sig == SIGPIPE) cerr << "(SIGPIPE).";
|
|
|
|
|
2010-06-01 16:36:12 -05:00
|
|
|
cerr << "\n Please e-mail to <alliance-users@asim.lip6.fr>.\n"
|
2010-03-09 09:20:13 -06:00
|
|
|
<< "\n program terminated ";
|
|
|
|
|
2010-06-22 08:55:37 -05:00
|
|
|
if ( getCatchCore() ) {
|
2010-03-09 09:20:13 -06:00
|
|
|
cerr << "(core not dumped).\n";
|
|
|
|
exit ( 1 );
|
|
|
|
} else {
|
|
|
|
cerr << "(core will be dumped).\n";
|
|
|
|
if ( ( signal(SIGFPE , SIG_DFL) == SIG_ERR )
|
|
|
|
|| ( signal(SIGBUS , SIG_DFL) == SIG_ERR )
|
|
|
|
|| ( signal(SIGABRT, SIG_DFL) == SIG_ERR )
|
|
|
|
|| ( signal(SIGSEGV, SIG_DFL) == SIG_ERR )
|
|
|
|
|| ( signal(SIGPIPE, SIG_DFL) == SIG_ERR ) )
|
|
|
|
exit ( 1 );
|
|
|
|
else {
|
|
|
|
kill ( getpid(), /*sig*/ SIGSEGV );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* Unexpected signal. */
|
|
|
|
cerr << "\n Unexpected signal \'" << sig << "\' in trap function.\n";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
exit ( 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-04-21 10:36:06 -05:00
|
|
|
const Utilities::Path& System::_getPath ( const string& key )
|
2010-06-22 08:55:37 -05:00
|
|
|
{
|
2013-04-21 10:36:06 -05:00
|
|
|
static Utilities::Path nullPath ("no_path");
|
2010-06-22 08:55:37 -05:00
|
|
|
|
2013-04-21 10:36:06 -05:00
|
|
|
map<const string,Utilities::Path>::const_iterator ipath = _pathes.find( key );
|
2010-06-22 08:55:37 -05:00
|
|
|
if ( ipath == _pathes.end() ) return nullPath;
|
|
|
|
|
|
|
|
return (*ipath).second;
|
|
|
|
}
|
2010-03-09 09:20:13 -06:00
|
|
|
|
|
|
|
|
2012-11-16 06:49:47 -06:00
|
|
|
void System::_runPythonInit ()
|
|
|
|
{
|
2012-12-03 02:27:41 -06:00
|
|
|
Cfg::Configuration* conf = Cfg::Configuration::get ();
|
2013-04-21 10:36:06 -05:00
|
|
|
Utilities::Path sysConfDir = getPath("etc");
|
|
|
|
Utilities::Path pythonSitePackages = getPath("pythonSitePackages");
|
2012-11-16 06:49:47 -06:00
|
|
|
|
|
|
|
#if XML_NOT_DISABLED
|
2013-04-21 10:36:06 -05:00
|
|
|
bool systemConfFound = false;
|
|
|
|
Utilities::Path systemConfFile = sysConfDir / "tools.configuration.xml";
|
|
|
|
if ( systemConfFile.exists() ) {
|
2012-11-16 06:49:47 -06:00
|
|
|
systemConfFound = true;
|
|
|
|
conf->readFromFile ( systemConfFile.string() );
|
|
|
|
} else {
|
|
|
|
cerr << Warning("System configuration file:\n <%s> not found."
|
|
|
|
,systemConfFile.string().c_str()) << endl;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-04-21 10:36:06 -05:00
|
|
|
bool systemConfFound = false;
|
|
|
|
Utilities::Path systemConfFile = pythonSitePackages / "crlcore" / "coriolisInit.py";
|
|
|
|
if ( systemConfFile.exists() ) {
|
2012-11-16 06:49:47 -06:00
|
|
|
systemConfFound = true;
|
2012-12-03 02:27:41 -06:00
|
|
|
//cout << " o Reading python dot configuration:" << endl;
|
|
|
|
//cout << " - <" << systemConfFile.string() << ">." << endl;
|
2012-11-16 06:49:47 -06:00
|
|
|
|
2013-04-21 10:36:06 -05:00
|
|
|
Isobar::Script* systemScript = Isobar::Script::create(systemConfFile.stem().string());
|
2012-11-16 06:49:47 -06:00
|
|
|
systemScript->runFunction("coriolisConfigure",NULL,Isobar::Script::NoScriptArgs);
|
|
|
|
systemScript->destroy();
|
|
|
|
} else {
|
|
|
|
cerr << Warning("System configuration file:\n <%s> not found."
|
|
|
|
,systemConfFile.string().c_str()) << endl;
|
|
|
|
}
|
|
|
|
|
2013-04-21 10:36:06 -05:00
|
|
|
bool homeConfFound = false;
|
|
|
|
Utilities::Path homeConfFile = getPath("home");
|
2012-11-16 06:49:47 -06:00
|
|
|
homeConfFile /= ".coriolis2.configuration.xml";
|
2013-04-21 10:36:06 -05:00
|
|
|
if ( homeConfFile.exists() ) {
|
2012-11-16 06:49:47 -06:00
|
|
|
homeConfFound = true;
|
|
|
|
conf->readFromFile ( homeConfFile.string() );
|
|
|
|
}
|
|
|
|
|
2013-04-21 10:36:06 -05:00
|
|
|
bool dotConfFound = false;
|
|
|
|
Utilities::Path dotConfFile = "./.coriolis2.configuration.xml";
|
|
|
|
if ( dotConfFile.exists() ) {
|
2012-11-16 06:49:47 -06:00
|
|
|
dotConfFound = true;
|
|
|
|
conf->readFromFile ( dotConfFile.string() );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delayed printing, as we known only now whether VerboseLevel1 is requested.
|
|
|
|
if ( cmess1.enabled() ) {
|
|
|
|
cmess1 << " o Reading Configuration. " << endl;
|
|
|
|
if (systemConfFound) cmess1 << " - <" << systemConfFile.string() << ">." << endl;
|
|
|
|
if (homeConfFound) cmess1 << " - <" << homeConfFile.string() << ">." << endl;
|
|
|
|
if (dotConfFound) cmess1 << " - <" << dotConfFile.string() << ">." << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-09 09:20:13 -06:00
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Class : "CRL::IoFile".
|
|
|
|
|
|
|
|
|
|
|
|
bool IoFile::open ( const string& mode )
|
|
|
|
{
|
|
|
|
if ( isOpen() )
|
|
|
|
throw Error ( "IoFile::Open():\n Attempt to reopen file %s\n", _path.c_str() );
|
|
|
|
|
|
|
|
_mode = mode;
|
|
|
|
_file = fopen ( _path.c_str(), mode.c_str() );
|
|
|
|
_lineNumber = 0;
|
|
|
|
_eof = false;
|
|
|
|
|
|
|
|
return _file;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IoFile::close ()
|
|
|
|
{
|
|
|
|
if ( isOpen() ) fclose ( _file );
|
|
|
|
_file = NULL;
|
|
|
|
_lineNumber = 0;
|
|
|
|
_eof = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char* IoFile::readLine ( char* buffer, size_t length )
|
|
|
|
{
|
|
|
|
assert ( buffer != NULL );
|
|
|
|
|
|
|
|
if ( eof() ) {
|
|
|
|
buffer[0] = '\0';
|
|
|
|
} else {
|
|
|
|
char* result = fgets ( buffer, length-1, _file );
|
|
|
|
if ( !result || feof(_file) ) {
|
|
|
|
_eof = true;
|
|
|
|
buffer[0] = '\0';
|
|
|
|
} else {
|
|
|
|
_lineNumber++;
|
|
|
|
size_t readLength = strlen ( buffer );
|
|
|
|
if ( buffer[readLength-1] == '\n' )
|
|
|
|
buffer[readLength-1] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string IoFile::_getString () const
|
|
|
|
{
|
|
|
|
ostringstream s;
|
|
|
|
|
|
|
|
s << "<IoFile " << _path << ">";
|
|
|
|
|
|
|
|
return s.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Record *IoFile::_getRecord () const
|
|
|
|
{
|
|
|
|
Record* record = new Record ( "<IoFile>" );
|
|
|
|
record->add ( getSlot ( "_path", &_path ) );
|
|
|
|
return record;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // End of CRL namespace.
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
// Class : "mstream".
|
|
|
|
|
|
|
|
|
2010-06-22 08:55:37 -05:00
|
|
|
void mstream::enable ( unsigned int mask ) { _activeMask |= mask; }
|
|
|
|
void mstream::disable ( unsigned int mask ) { _activeMask &= ~mask; }
|