diff --git a/chamsin/src/analogic/GenV1Trans.cpp b/chamsin/src/analogic/GenV1Trans.cpp index 298d2a9c..da6eefcf 100644 --- a/chamsin/src/analogic/GenV1Trans.cpp +++ b/chamsin/src/analogic/GenV1Trans.cpp @@ -8,7 +8,6 @@ #include "RdsUnit.h" #include "GenTrans.h" #include "DtrAccess.h" -#include "GenericDtrAccess.h" #include "Technology.h" #include "UpdateSession.h" @@ -41,7 +40,7 @@ GenV1Trans::GenV1Trans(Transistor::MaskV1Info* masqueinfo) void GenV1Trans::Calculate(Transistor* transistor) // ********************************************** { - DtrAccess * dtraccess = DtrAccess::Instance(); + DtrAccess* dtraccess = DtrAccess::getDtrAccess(); // Check out mask param. // ********************* @@ -318,7 +317,7 @@ void GenV1Trans::Generate(Transistor* transistor) Net* drain = transistor->getNet(Name(transistor->getDrainName()) ); Net* grid = transistor->getNet(Name(transistor->getGridName()) ); - DtrAccess * dtraccess = DtrAccess::Instance(); + DtrAccess * dtraccess = DtrAccess::getDtrAccess(); //string mostype(1, transistor->getType()); // get Mos Type (N/P). string mostype; // get Mos Type (N/P). diff --git a/chamsin/src/device/Device.cpp b/chamsin/src/device/Device.cpp index 6b23cd5f..c9aec5e5 100644 --- a/chamsin/src/device/Device.cpp +++ b/chamsin/src/device/Device.cpp @@ -15,7 +15,6 @@ #include "Cells.h" #include "DtrAccess.h" -#include "GenericDtrAccess.h" using namespace Hurricane; // **************************************************************************************************** @@ -68,9 +67,6 @@ void Device::_postCreate() { //state->SetCell(this); //state->SetLibrary(getLibrary()); - // Create GenericDtrAccess and DtrAccess - // ************************************* - GenericDtrAccess::Instance(DtrAccess::Instance()); } diff --git a/chamsin/src/device/TrMos.cpp b/chamsin/src/device/TrMos.cpp index e79e449e..86fb3174 100644 --- a/chamsin/src/device/TrMos.cpp +++ b/chamsin/src/device/TrMos.cpp @@ -62,7 +62,7 @@ void TrMos::_postCreate() { _lowPinOrder.push_back(S); _lowPinOrder.push_back(B); - double minWidth = (DtrAccess::Instance())->getSingleRealRuleByLabel(string("RW_ALU1")); + double minWidth = (DtrAccess::getDtrAccess())->getSingleRealRuleByLabel(string("RW_ALU1")); _widthOfSourceWire = minWidth; _widthOfDrainWire = minWidth; diff --git a/chamsin/src/device/TrMos_PlaceRoute.cpp b/chamsin/src/device/TrMos_PlaceRoute.cpp index e708a0e6..dfae6a76 100644 --- a/chamsin/src/device/TrMos_PlaceRoute.cpp +++ b/chamsin/src/device/TrMos_PlaceRoute.cpp @@ -42,7 +42,7 @@ void TrMos::_PlaceAndRoute() // get Dtr Rules And Calculate the Size of AbutmentBox of Device. // ************************************************************** - DtrAccess * dtraccess = DtrAccess::Instance(); + DtrAccess * dtraccess = DtrAccess::getDtrAccess(); char type; if(_type == 'P') type = 'N'; diff --git a/chamsin/src/dtr/CMakeLists.txt b/chamsin/src/dtr/CMakeLists.txt index c9c39138..a979bfe2 100644 --- a/chamsin/src/dtr/CMakeLists.txt +++ b/chamsin/src/dtr/CMakeLists.txt @@ -32,9 +32,7 @@ SET_SOURCE_FILES_PROPERTIES(${binary_dir}/ParserDtrScan.cpp GENERATED) ADD_LIBRARY(dtr SHARED ${DST_SRCS} DtrAccess.cpp -RdsUnit.cpp -GenericDtrAccess.cpp) - +RdsUnit.cpp) TARGET_LINK_LIBRARIES(dtr ${HURRICANE_LIBRARIES}) diff --git a/chamsin/src/dtr/DtrAccess.cpp b/chamsin/src/dtr/DtrAccess.cpp index c714b6d1..9473786a 100644 --- a/chamsin/src/dtr/DtrAccess.cpp +++ b/chamsin/src/dtr/DtrAccess.cpp @@ -24,18 +24,12 @@ namespace Hurricane { // static data defintion // ********************* -DtrAccess* DtrAccess::_instance = NULL; +DtrAccess* DtrAccess::_singleton = NULL; map DtrAccess::_registry; -DtrAccess::DtrAccess() -// ******************* -{ -} - - DtrAccess * DtrAccess::create() { - DtrAccess * dtraccess = new DtrAccess(); + DtrAccess* dtraccess = new DtrAccess(); dtraccess->_postCreate(); @@ -92,9 +86,9 @@ void DtrAccess::_postCreate() { while(m!=n) { Layer * layer = tech->getLayer(Name(*m)); if(!layer) { - throw Error("Error : in function DtrAccess::_PostCreate , Can't find Layer " + throw Error("Error : in function DtrAccess::_postCreate , Can't find Layer " + getString(*m) + " in technology file when parser DtrFile."); -// cerr << Warning("In function DtrAccess::_PostCreate , Can't find Layer " +// cerr << Warning("In function DtrAccess::_postCreate , Can't find Layer " // + getString(*m) + " in technology file when parser DtrFile"); } @@ -107,41 +101,24 @@ void DtrAccess::_postCreate() { } -DtrAccess * DtrAccess::Instance() { +DtrAccess * DtrAccess::getDtrAccess() { // User or environnement supplies this at startup // ********************************************** const char * singleton_name = getenv("DTRACCESS_SINGLETON"); if(!singleton_name) { // if MACRO IS INVALID - if(!_instance) { - _instance = DtrAccess::create(); + if(!_singleton) { + _singleton = DtrAccess::create(); } } else { - if(!_instance){ - if( !(_instance=LookUp(string(singleton_name))) ) // if singleton hasn't been registered - _instance = DtrAccess::create(); + if(!_singleton){ + if( !(_singleton=LookUp(string(singleton_name))) ) // if singleton hasn't been registered + _singleton = DtrAccess::create(); } } - return _instance; + return _singleton; } - -void DtrAccess::_preDestroy() -// *********************** -{ - // Do something - // ************ -} - - -void DtrAccess::destroy() -// ******************** -{ - _preDestroy(); - delete this; -} - - GenericCollection DtrAccess::getRuleByLabel(const string& label) const // *************************************************************************** { @@ -153,7 +130,6 @@ GenericCollection DtrAccess::getRuleByLabel(const string& label) const return getCollection((*i).second); } - GenericCollection DtrAccess::getRdsRuleByLabel(const string& label) const // ****************************************************************************** { diff --git a/chamsin/src/dtr/DtrAccess.h b/chamsin/src/dtr/DtrAccess.h index 7e179e24..93dc86e9 100644 --- a/chamsin/src/dtr/DtrAccess.h +++ b/chamsin/src/dtr/DtrAccess.h @@ -18,7 +18,7 @@ class DtrAccess { // Attributes // ********** private: typedef map > Label2RuleMap; - private: static DtrAccess * _instance; + private: static DtrAccess * _singleton; private: Label2RuleMap _label2ruleMap; private: map > _label2layerNameMap; @@ -37,26 +37,13 @@ class DtrAccess { // Constructors // ************ - protected : DtrAccess(); - private : DtrAccess(const DtrAccess&); private : DtrAccess& operator=(const DtrAccess&); protected : static DtrAccess * create(); protected : virtual void _postCreate(); # endif - public : static DtrAccess* Instance(); - -// Destructors -// *********** -# if !defined(__DOXYGEN_PROCESSOR__) - protected : virtual ~DtrAccess() {}; - protected : virtual void _preDestroy(); -# endif - - - public : virtual void destroy(); - + public : static DtrAccess* getDtrAccess(); // Accessors // ********* diff --git a/chamsin/src/dtr/GenericDtrAccess.cpp b/chamsin/src/dtr/GenericDtrAccess.cpp deleted file mode 100644 index 006439da..00000000 --- a/chamsin/src/dtr/GenericDtrAccess.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// **************************************************************************************************** -// File: GenericDtrAccess.cpp -// Authors: Wu YiFei -// Date : 21/12/2006 -// **************************************************************************************************** - -#include "DtrAccess.h" -#include "GenericDtrAccess.h" - -namespace Hurricane { - -// **************************************************************************************************** -// GenericDtrAccess implementation -// **************************************************************************************************** - -GenericDtrAccess GenericDtrAccess::instance(NULL); - -GenericDtrAccess::GenericDtrAccess(DtrAccess* dtraccess):_dtrAccess(dtraccess) -// ************************************************************************** -{ -} - -void GenericDtrAccess::Instance(DtrAccess* dtraccess) -// ************************************************** -{ - if(!(instance._dtrAccess)) - instance._dtrAccess = dtraccess; -} - -string GenericDtrAccess::_getString() const -// **************************************** -{ - string s("Singleton GenericDtrAccess"); - return s; - -} - -} - -// **************************************************************************************************** -// Generic functions -// **************************************************************************************************** - -string getString(const Hurricane::GenericDtrAccess& access) -// ************************************************ -{ - return access._getString(); -} - - diff --git a/chamsin/src/dtr/GenericDtrAccess.h b/chamsin/src/dtr/GenericDtrAccess.h deleted file mode 100644 index f4bd71ee..00000000 --- a/chamsin/src/dtr/GenericDtrAccess.h +++ /dev/null @@ -1,75 +0,0 @@ -// **************************************************************************************************** -// File: GenericDtrAccess.h -// Authors: Wu YiFei -// Date : 21/12/2006 -// **************************************************************************************************** - - -#ifndef HURRICANE_GENERICDTRACCESS -#define HURRICANE_GENERICDTRACCESS - - -//BEGIN_NAMESPACE_HURRICANE - -namespace Hurricane { - -class DtrAccess; - -class GenericDtrAccess { -// ********************* - -// Types -// ***** - -# if !defined(__DOXYGEN_PROCESSOR__) -// Attributes -// ********** - private : static GenericDtrAccess instance; - - private : DtrAccess * _dtrAccess; - - -// Constructors -// ************ - protected : GenericDtrAccess(DtrAccess*); - private : GenericDtrAccess(const GenericDtrAccess&); - private : GenericDtrAccess& operator=(const GenericDtrAccess&); - -# endif - - public : static void Instance(DtrAccess*); - -// Destructors -// *********** - protected : virtual ~GenericDtrAccess(); - -// Accessors -// ********* - - -// Updators -// ******** - -// Operations -// ********** - -# if !defined(__DOXYGEN_PROCESSOR__) -// Others -// ****** - public: virtual string _getTypeName() const {return _TName("GenericDtrAccess");}; - public: virtual string _getString() const; -# endif - -}; - - -} - -// **************************************************************************************************** -// Generic functions -// **************************************************************************************************** - -string getString(const Hurricane::GenericDtrAccess&); - - -#endif // HURRICANE_GENERICDTRACCESS