diff --git a/chamsin/CMakeLists.txt b/chamsin/CMakeLists.txt index 4d7b6e3f..48f849c6 100644 --- a/chamsin/CMakeLists.txt +++ b/chamsin/CMakeLists.txt @@ -6,7 +6,8 @@ SET(CMAKE_MODULE_PATH "$ENV{HURRICANE_TOP}/share/cmake_modules/") FIND_PACKAGE(BISON REQUIRED) FIND_PACKAGE(FLEX REQUIRED) -find_package(HURRICANE REQUIRED) +FIND_PACKAGE(HURRICANE REQUIRED) +FIND_PACKAGE(CORIOLIS REQUIRED) #FIND_PACKAGE(Doxygen) ADD_SUBDIRECTORY(src) diff --git a/chamsin/src/analogic/RdsUnit.cpp b/chamsin/src/analogic/RdsUnit.cpp index c2098d06..baf02b39 100644 --- a/chamsin/src/analogic/RdsUnit.cpp +++ b/chamsin/src/analogic/RdsUnit.cpp @@ -147,16 +147,14 @@ static char* GetPattern(const string& str, const char* pattern) */ -static void CalculateRdsUnit() -// *************************** -{ +static void CalculateRdsUnit() { using Hurricane::Error; const char * rdsfilename = getenv("RDS_TECHNO_NAME"); FILE * rdstechnofile; if(!rdsfilename) { - throw Error("Can't not find macro RDS_TECHNO_FILE"); + throw Error("Cannot find macro RDS_TECHNO_NAME"); } if( !(rdstechnofile = fopen(rdsfilename, "r")) ) { diff --git a/chamsin/src/device/CMakeLists.txt b/chamsin/src/device/CMakeLists.txt index 5a654099..c5c351dc 100644 --- a/chamsin/src/device/CMakeLists.txt +++ b/chamsin/src/device/CMakeLists.txt @@ -4,3 +4,5 @@ ${CHAMSIN_SOURCE_DIR}/src/analogic) ADD_LIBRARY(device SHARED Device.cpp TrMos.cpp TrMos_PlaceRoute.cpp) TARGET_LINK_LIBRARIES(device analogic dtr hurricane) + +INSTALL(TARGETS device DESTINATION /lib) diff --git a/chamsin/src/device/Device.cpp b/chamsin/src/device/Device.cpp index 4604ddd9..35aa2fb3 100644 --- a/chamsin/src/device/Device.cpp +++ b/chamsin/src/device/Device.cpp @@ -75,9 +75,7 @@ void Device::_PreDelete() } -void Device::_PostCreate() -// ******************************* -{ +void Device::_PostCreate() { Inherit::_PostCreate(); //CDataBase* database = GetCDataBase(); @@ -91,7 +89,6 @@ void Device::_PostCreate() // Create GenericDtrAccess and DtrAccess // ************************************* GenericDtrAccess::Instance(DtrAccess::Instance()); - } diff --git a/chamsin/src/device/Device.h b/chamsin/src/device/Device.h index 36fc398f..0513b656 100644 --- a/chamsin/src/device/Device.h +++ b/chamsin/src/device/Device.h @@ -21,7 +21,6 @@ namespace Hurricane { class Record; class Point; class Transformation; -// class Transformation::Orientation; class Instance; } @@ -34,11 +33,9 @@ using Hurricane::Name; using Hurricane::Record; using Hurricane::Point; using Hurricane::Transformation; -//using Hurricane::Transformation::Orientation; using Hurricane::Instance; class Device : public Cell { -// ************************* # if !defined(__DOXYGEN_PROCESSOR__) // Types @@ -46,7 +43,7 @@ class Device : public Cell { public : typedef Cell Inherit; // Attributes -// ******************* +// ********** // Constructors diff --git a/chamsin/src/device/TrMos.cpp b/chamsin/src/device/TrMos.cpp index de2b553d..4bc1570c 100644 --- a/chamsin/src/device/TrMos.cpp +++ b/chamsin/src/device/TrMos.cpp @@ -25,27 +25,23 @@ namespace DEVICE{ // TrMos implementation // **************************************************************************************************** -TrMos::TrMos(Library* library, const Name& name) -// ************************************************************************** -: Inherit(library, name), - _type('N'), - _isBsConnected(false), - _m(1), - _sourceIsFirst(true), - _hasDummy(false), - _hasRing(true), - _tr1(NULL), - _capaRouting(0) -{ -} +TrMos::TrMos(Library* library, const Name& name): + Inherit(library, name), + _type('N'), + _isBsConnected(false), + _m(1), + _sourceIsFirst(true), + _hasDummy(false), + _hasRing(true), + _tr1(NULL), + _capaRouting(0) +{} -TrMos* TrMos::Create(Library* library, const Name & name) -// ************************************************************************** -{ - TrMos* trmos= new TrMos(library, name); - trmos->_PostCreate(); - return trmos; +TrMos* TrMos::Create(Library* library, const Name & name) { + TrMos* trmos= new TrMos(library, name); + trmos->_PostCreate(); + return trmos; } @@ -67,9 +63,7 @@ void TrMos::_PreDelete() } -void TrMos::_PostCreate() -// ******************************* -{ +void TrMos::_PostCreate() { Inherit::_PostCreate(); // do something. @@ -95,9 +89,7 @@ void TrMos::_PostCreate() } -Transistors TrMos::GetTransistors() const -// ************************************** -{ +Transistors TrMos::GetTransistors() const { return GetCollection(_transistorList); } @@ -106,8 +98,8 @@ void TrMos::Create(const char type, const bool isbsconnected) // ********************************************************** { if( _tr1 ) { - throw Error("Can't Create Logical View of TrMos " + GetString(GetName()) + " : " - + "it has already been created"); + throw Error("Can't Create Logical View of TrMos " + GetString(GetName()) + + " : " + "it has already been created"); } if( (type!=TRANSN) && (type!=TRANSP)) { @@ -142,10 +134,9 @@ void TrMos::Create(const char type, const bool isbsconnected) // **************************************************** _tr1 = MetaTransistor::Create(library, Name( GetString(GetName())+"_Mos1" ), _type); - Instance * instance = Instance::Create(this - , Name("Ins_" + GetString(_tr1->GetName())) - , _tr1 - ); + Instance * instance = Instance::Create(this, + Name("Ins_" + GetString(_tr1->GetName())), + _tr1); instance->GetPlug(_tr1->GetNet(Name("DRAIN")))->SetNet(drain); instance->GetPlug(_tr1->GetNet(Name("SOURCE")))->SetNet(source); @@ -165,8 +156,8 @@ void TrMos::Generate(const unsigned m, const bool sourceisfirst, const bool hasr // ********************************************************************************* { if( !_tr1 ) { - throw Error("Can't Create Physical View for " + GetString(this) - + " : " + "Logical view has't been created yet."); + throw Error("Can't Create Physical View for " + GetString(this) + + " : " + "Logical view has't been created yet."); } // if( !(_transistorList.empty()) ) { @@ -177,16 +168,16 @@ void TrMos::Generate(const unsigned m, const bool sourceisfirst, const bool hasr // Check out param of realization. // ******************************* if( m <= 0 ) - throw Error("Can't generate for " + GetString(this) + " : m " + GetString(m) - + " is invalid."); + throw Error("Can't generate for " + GetString(this) + " : m " + + GetString(m) + " is invalid."); if(nbsourcecolumn<1) - throw Error("Can't generate for " + GetString(this) + " : nbsourcecolumn " - + GetString(nbsourcecolumn) + " is invalid."); + throw Error("Can't generate for " + GetString(this) + + " : nbsourcecolumn " + GetString(nbsourcecolumn) + " is invalid."); if(nbdraincolumn<1) - throw Error("Can't generate for" + GetString(this) + " : nbdraincolumn " - + GetString(nbdraincolumn) + " is invalid."); + throw Error("Can't generate for" + GetString(this) + " : nbdraincolumn " + + GetString(nbdraincolumn) + " is invalid."); if(!(_transistorList.empty())) { @@ -201,10 +192,9 @@ void TrMos::Generate(const unsigned m, const bool sourceisfirst, const bool hasr // ***************************************** Library * library = GetLibrary(); - cout << ts << "################################################################" <SetM(_m); for(unsigned i=0; iGetName()) + "_Finger_" + GetString(i) - , _type - ); + Transistor* finger = Transistor::Create(library, + GetString(_tr1->GetName()) + "_Finger_" + GetString(i), + _type); _transistorList.push_back(finger); Instance::Create(_tr1, Name("Ins_" + GetString(finger->GetName())), finger); @@ -235,8 +224,7 @@ void TrMos::Generate(const unsigned m, const bool sourceisfirst, const bool hasr cout << "*** Stage 1 : CreateLayout of " + GetString(this) + " finish ***" <GetM()) + ".\n" - << ts << GetString(_m) + " Transistors are created.\n" - <_PostCreate(); @@ -45,43 +43,43 @@ DtrAccess * DtrAccess::Create() } -void DtrAccess::_PostCreate() -// ************************** -{ - const char * dtrfilename = getenv("DTR_FILE"); - if(!dtrfilename) { +void DtrAccess::_PostCreate() { + const char* dtrFileName = getenv("DTR_FILE"); + if(!dtrFileName) { throw Error("Can't not get Macro DTR_FILE."); } // Use API of DtrParser for get technology informations // **************************************************** - ParseDtr(dtrfilename, this); + ParseDtr(dtrFileName, this); // Traduit Micro to RdsUnit // ************************ - map >::iterator it_rulemap = _label2ruleMap.begin(), - it_end_rulemap = _label2ruleMap.end(); - - while(it_rulemap!=it_end_rulemap) { - - list::iterator m = ((*it_rulemap).second).begin() - , n = ((*it_rulemap).second).end(); - - while(m!=n) { - _label2RdsRuleMap[(*it_rulemap).first].push_back(ConvertRealToRdsUnit(*m)); - m++; - } - it_rulemap++; + for (Label2RuleMap::iterator lrmit = _label2ruleMap.begin(); + lrmit != _label2ruleMap.end(); + ++lrmit) { + for (list::iterator ldit = lrmit->second.begin(); + ldit != lrmit->second.end(); + ++ldit) { + _label2RdsRuleMap[lrmit->first].push_back(ConvertRealToRdsUnit(*ldit)); + } } // Get Objet Layer from Technology with its name. // ********************************************** - DataBase * db = GetDataBase(); + DataBase* db = GetDataBase(); - if(!db) throw Error("In GetV1Trans::Generate : can't find DataBase."); + if(!db) { + throw Error("In GetV1Trans::Generate : can't find DataBase."); + } + + Technology* tech = db->GetTechnology(); + + if (!tech) { + throw Error("In GetV1Trans::Generate : can't find Technology."); + } - Technology * tech = db->GetTechnology(); map >::iterator it_layermap = _label2layerNameMap.begin(), it_end_layermap = _label2layerNameMap.end(); @@ -109,9 +107,7 @@ void DtrAccess::_PostCreate() } -DtrAccess * DtrAccess::Instance() -// ***************************** -{ +DtrAccess * DtrAccess::Instance() { // User or environnement supplies this at startup // ********************************************** const char * singleton_name = getenv("DTRACCESS_SINGLETON"); @@ -120,14 +116,12 @@ DtrAccess * DtrAccess::Instance() if(!_instance) { _instance = DtrAccess::Create(); } - } - else { + } else { if(!_instance){ if( !(_instance=LookUp(string(singleton_name))) ) // if singleton hasn't been registered _instance = DtrAccess::Create(); } } - return _instance; } diff --git a/chamsin/src/dtr/DtrAccess.h b/chamsin/src/dtr/DtrAccess.h index fe660bbe..c59c2398 100644 --- a/chamsin/src/dtr/DtrAccess.h +++ b/chamsin/src/dtr/DtrAccess.h @@ -16,24 +16,21 @@ namespace Hurricane { class DtrAccess { -// ************** - -// Types -// ***** # if !defined(__DOXYGEN_PROCESSOR__) // Attributes // ********** - private : static DtrAccess * _instance; + private: typedef map > Label2RuleMap; + private: static DtrAccess * _instance; - private : map > _label2ruleMap; - private : map > _label2layerNameMap; - private : map > _label2electricalMap; - private : map _label2modellingMap; - private : map _label2simplecapamimMap; - - private : map > _label2RdsRuleMap; - private : map > _label2layerMap; + private: Label2RuleMap _label2ruleMap; + private: map > _label2layerNameMap; + private: map > _label2electricalMap; + private: map _label2modellingMap; + private: map _label2simplecapamimMap; + + private: map > _label2RdsRuleMap; + private: map > _label2layerMap; // For reusability of software diff --git a/chamsin/src/dtr/GenericDtrAccess.cpp b/chamsin/src/dtr/GenericDtrAccess.cpp index 875592e4..ca7cafd8 100644 --- a/chamsin/src/dtr/GenericDtrAccess.cpp +++ b/chamsin/src/dtr/GenericDtrAccess.cpp @@ -6,7 +6,6 @@ #include "DtrAccess.h" #include "GenericDtrAccess.h" -//#include "DtrAccess.h" BEGIN_NAMESPACE_HURRICANE diff --git a/chamsin/src/tests/AnalogicTest.cpp b/chamsin/src/tests/AnalogicTest.cpp index 517f69e5..4ae3003d 100644 --- a/chamsin/src/tests/AnalogicTest.cpp +++ b/chamsin/src/tests/AnalogicTest.cpp @@ -1,17 +1,29 @@ #include -#include "DataBase.h" #include "Library.h" -USING_NAMESPACE_HURRICANE +#include "Warning.h" +using namespace H; + +#include "crlcore/CDataBase.h" +using namespace CRL; #include "TrMos.h" using namespace DEVICE; int main() { - cout << "simple analogic test" << endl; - DataBase* db = DataBase::Create(); - Library* rootLibrary = Library::Create(db, Name("RootLibrary")); - Library* workLibrary = Library::Create(rootLibrary, Name("WorkLibrary")); - TrMos* trmos = TrMos::Create(workLibrary, Name("MosTr")); - return 1; + try { + cout << "simple analogic test" << endl; + CDataBase* db = CDataBase::Create(); + Library* workLibrary = Library::Create(db->GetRootLibrary(), Name("WorkLibrary")); + TrMos* trmos = TrMos::Create(workLibrary, Name("MosTr")); + exit(0); + } catch (Hurricane::Warning& w) { + cerr << w.What() << endl; + } catch (Hurricane::Error& e) { + cerr << e.What() << endl; + exit (1); + } catch (...) { + cout << "Abnormal termination\n" << endl; + exit(2); + } } diff --git a/chamsin/src/tests/CMakeLists.txt b/chamsin/src/tests/CMakeLists.txt index 973567fb..005369ce 100644 --- a/chamsin/src/tests/CMakeLists.txt +++ b/chamsin/src/tests/CMakeLists.txt @@ -1,6 +1,9 @@ -INCLUDE_DIRECTORIES(${HURRICANE_INCLUDE_DIR} +INCLUDE_DIRECTORIES(${HURRICANE_INCLUDE_DIR} ${CORIOLIS_INCLUDE_DIR} ${CHAMSIN_SOURCE_DIR}/src/analogic ${CHAMSIN_SOURCE_DIR}/src/device) ADD_EXECUTABLE(atest AnalogicTest.cpp) -TARGET_LINK_LIBRARIES(atest analogic device ${HURRICANE_LIBRARIES}) +TARGET_LINK_LIBRARIES(atest analogic device ${HURRICANE_LIBRARIES} +${CORIOLIS_LIBRARIES}) + +INSTALL(TARGETS atest DESTINATION /bin)