diff --git a/chamsin/src/analogic/AnalogicalCommons.h b/chamsin/src/analogic/AnalogicalCommons.h index 0cbbddb1..97444067 100644 --- a/chamsin/src/analogic/AnalogicalCommons.h +++ b/chamsin/src/analogic/AnalogicalCommons.h @@ -13,12 +13,6 @@ // Macros Declaration. // ********************************************************************* -#define TRANSN 'N' -#define TRANSP 'P' - - -#define MAXNBCONTACT 8 - #define IF_DEBUG_HUR_ANALOG \ if(getenv("DEBUG_HUR_ANALOG")) { diff --git a/chamsin/src/analogic/GenTrans.h b/chamsin/src/analogic/GenTrans.h index bc6c39b6..ffbde722 100644 --- a/chamsin/src/analogic/GenTrans.h +++ b/chamsin/src/analogic/GenTrans.h @@ -188,28 +188,18 @@ class GenTrans { class GenV1Trans : public GenTrans { -// ********************************* + public: + typedef GenTrans Inherit; -// Types -// ***** - public : typedef GenTrans Inherit; + const Transistor::MaskV1Info* _masqueV1Info; + static const int maxNbContacts = 8; -// Attributs -// ********* - public : const Transistor::MaskV1Info* _masqueV1Info; + GenV1Trans(Transistor::MaskV1Info*); -// Constructors -// ************ - public : GenV1Trans(Transistor::MaskV1Info*); + virtual ~GenV1Trans() {}; -// Destructors -// ************ - public : virtual ~GenV1Trans() {}; - -// Operators -// ********* - public : virtual void Calculate(Transistor*) ; - public : virtual void Generate(Transistor*) ; + virtual void Calculate(Transistor*) ; + virtual void Generate(Transistor*) ; }; diff --git a/chamsin/src/analogic/GenV1Trans.cpp b/chamsin/src/analogic/GenV1Trans.cpp index eb9cf823..8279a9dc 100644 --- a/chamsin/src/analogic/GenV1Trans.cpp +++ b/chamsin/src/analogic/GenV1Trans.cpp @@ -4,16 +4,16 @@ // Date : 04/04/2007 // **************************************************************************************************** -#include "Collection.h" -#include "RdsUnit.h" -#include "GenTrans.h" -#include "DtrAccess.h" - #include "Technology.h" #include "UpdateSession.h" - #include "DataBase.h" +#include "RdsUnit.h" +#include "DtrAccess.h" +#include "AnalogicalCommons.h" +#include "GenTrans.h" + + namespace Hurricane { @@ -55,8 +55,8 @@ void GenV1Trans::Calculate(Transistor* transistor) + " of this transistor is invalid." ); - if(_masqueV1Info->getNbSourceColumn() < 1 || _masqueV1Info->getNbSourceColumn() > MAXNBCONTACT || - _masqueV1Info->getNbDrainColumn() < 1 || _masqueV1Info->getNbDrainColumn() > MAXNBCONTACT ) + if(_masqueV1Info->getNbSourceColumn() < 1 || _masqueV1Info->getNbSourceColumn() > GenV1Trans::maxNbContacts || + _masqueV1Info->getNbDrainColumn() < 1 || _masqueV1Info->getNbDrainColumn() > GenV1Trans::maxNbContacts ) throw Error("Can't launch function GenV1Trans::Calculate for " + getString(transistor) + " the nbsourcecolumn " + getString(_masqueV1Info->getNbSourceColumn()) diff --git a/chamsin/src/analogic/MetaTransistor.cpp b/chamsin/src/analogic/MetaTransistor.cpp index 6cd89c8d..402574b0 100644 --- a/chamsin/src/analogic/MetaTransistor.cpp +++ b/chamsin/src/analogic/MetaTransistor.cpp @@ -4,14 +4,13 @@ // Date : 21/12/2006 // **************************************************************************************************** - -#include "MetaTransistor.h" -#include "Transistor.h" -#include "Instances.h" #include "UpdateSession.h" -#include "Vertical.h" +using namespace Hurricane; -namespace Hurricane { +#include "Transistor.h" +#include "MetaTransistor.h" + +namespace Chamsin { // **************************************************************************************************** // MetaTransistor implementation @@ -86,9 +85,9 @@ void MetaTransistor::createLayout() setTerminal(false); - Transistor * internal_ref = NULL; - Transistor * left_ref = NULL; - Transistor * right_ref = NULL; + Transistor* internal_ref = NULL; + Transistor* left_ref = NULL; + Transistor* right_ref = NULL; for_each_instance(instance, this->getInstances()) Cell * mastercell = instance->getMasterCell(); diff --git a/chamsin/src/analogic/MetaTransistor.h b/chamsin/src/analogic/MetaTransistor.h index b35e5090..7d41b461 100644 --- a/chamsin/src/analogic/MetaTransistor.h +++ b/chamsin/src/analogic/MetaTransistor.h @@ -8,15 +8,11 @@ #define HURRICANE_METATRANSISTOR #include "Cell.h" +using namespace Hurricane; #include "AnalogicalCommons.h" namespace Hurricane { -class Library; -class Name; -class Symbol; -class Record; - class MetaTransistor: public Cell { // ******************************** diff --git a/chamsin/src/analogic/MetaTransistors.h b/chamsin/src/analogic/MetaTransistors.h index 786abf96..f3067f37 100644 --- a/chamsin/src/analogic/MetaTransistors.h +++ b/chamsin/src/analogic/MetaTransistors.h @@ -10,8 +10,6 @@ #include "Collection.h" -BEGIN_NAMESPACE_HURRICANE - class MetaTransistor; @@ -53,7 +51,5 @@ typedef GenericFilter MetaTransistorFilter; -END_NAMESPACE_HURRICANE - #endif // HURRICANE_METATRANSISTORS diff --git a/chamsin/src/analogic/Transistor.cpp b/chamsin/src/analogic/Transistor.cpp index 77f24ba9..95607d08 100644 --- a/chamsin/src/analogic/Transistor.cpp +++ b/chamsin/src/analogic/Transistor.cpp @@ -4,16 +4,53 @@ // Date : 21/12/2006 // **************************************************************************************************** -#include "AnalogicalCommons.h" -#include "Transistor.h" -#include "GenTrans.h" - #include "Vertical.h" #include "Horizontal.h" - #include "UpdateSession.h" +using namespace Hurricane; + +#include "AnalogicalCommons.h" +#include "GenTrans.h" + +#include "Transistor.h" + +namespace Chamsin { + +// **************************************************************************************************** +// Transistor::Polarity implementation +// **************************************************************************************************** + +Transistor::Polarity::Polarity(const Code& code) :_code(code) +{} + + +Transistor::Polarity::Polarity(const Polarity& type) :_code(type._code) +{} + + +Transistor::Polarity& Transistor::Polarity::operator=(const Polarity& type) { + _code = type._code; + return *this; +} + + +string Transistor::Polarity::_getString() const { + switch(_code) { + case N : return "N"; + case P : return "P"; + } + return "ABNORMAL"; +} + + +Record* Transistor::Polarity::_getRecord() const +// ***************************************** +{ + Record* record = new Record(getString(this)); + record->Add(getSlot("Code", _code)); + return record; +} -namespace Hurricane { // **************************************************************************************************** // Transistor::MaskVersion implementation @@ -39,13 +76,6 @@ Transistor::MaskVersion& Transistor::MaskVersion::operator=(const MaskVersion& v } -bool Transistor::MaskVersion::operator==(const MaskVersion& version) const -// *************************************************************************** -{ - return _code==version._code; -} - - string Transistor::MaskVersion::_getString() const // ************************************************* { @@ -228,20 +258,16 @@ Record* Transistor::MaskV1Info::_getRecord() const // Transistor implementation // **************************************************************************************************** -Transistor::Transistor(Library* library, const Name& name, char type) -// ******************************************************************* -: Inherit(library, name), - _type(type), - _masqueInfo(NULL), - _genTrans(NULL) -{ -} +Transistor::Transistor(Library* library, const Name& name, const Polarity& polarity) : + Inherit(library, name), + _polarity(polarity), + _masqueInfo(NULL), + _genTrans(NULL) +{} -Transistor* Transistor::create(Library* library, const Name& name, char type) -// ************************************************************************** -{ - Transistor* transistor = new Transistor(library, name, type); +Transistor* Transistor::create(Library* library, const Name& name, const Polarity& polarity) { + Transistor* transistor = new Transistor(library, name, polarity); transistor->_postCreate(); @@ -250,9 +276,7 @@ Transistor* Transistor::create(Library* library, const Name& name, char type) -void Transistor::_preDestroy() -// ****************************** -{ +void Transistor::_preDestroy() { // Delete aggregated objets. // ************************* if(_masqueInfo) @@ -281,19 +305,15 @@ void Transistor::_postCreate() } -string Transistor::_getString() const -// *********************************** -{ +string Transistor::_getString() const { string s = Inherit::_getString(); - s.insert(s.length()-1, " " + getString(_type)); + s.insert(s.length()-1, " " + getString(_polarity)); s.insert(s.length()-1, " " + getAbutmentType()._getString()); return s; } -Record* Transistor::_getRecord() const -// ************************************ -{ +Record* Transistor::_getRecord() const { Record* record = Inherit::_getRecord(); return record; } @@ -440,15 +460,3 @@ void Transistor::duplicateLayout(Transistor* transistor) } } - -// **************************************************************************************************** -// Generic functions -// **************************************************************************************************** - -string getString(const Hurricane::Transistor::MaskInfo& masqueinfo) -// ********************************************************** -{ - return masqueinfo._getString(); -} - - diff --git a/chamsin/src/analogic/Transistor.h b/chamsin/src/analogic/Transistor.h index 718a709b..bd6fd3c6 100644 --- a/chamsin/src/analogic/Transistor.h +++ b/chamsin/src/analogic/Transistor.h @@ -8,30 +8,45 @@ #define HURRICANE_TRANSISTOR #include "Cell.h" -#include "AnalogicalCommons.h" +using namespace Hurricane; +#include "Transistors.h" namespace Hurricane { -class Library; -class Name; -class Symbol; -class Record; class GenTrans; + + class Transistor : public Cell { -// ******************************** //# if !defined(__DOXYGEN_PROCESSOR__) // Types // ***** - public : typedef Cell Inherit; + public: typedef Cell Inherit; + + public: class Polarity { + public: enum Code {N=0, P=1}; + + private: Code _code; + + public : Polarity(const Code& code=N); + public : Polarity(const Polarity&); + public : Polarity& operator=(const Polarity&); + + public : operator const Code& () const { return _code; }; + public : const Code& getCode() const { return _code; }; + + public : string _getTypeName() const { return _TName("Transistor::Polarity"); }; + public : string _getString() const; + public : Record* _getRecord() const; + }; + public : class MaskVersion { - // ****************** public : enum Code { VERSION1=0 }; private: Code _code; @@ -40,8 +55,6 @@ class Transistor : public Cell { public : MaskVersion(const MaskVersion&); public : MaskVersion& operator=(const MaskVersion&); - public : bool operator==(const MaskVersion&) const; - public : operator const Code& () const { return _code; }; public : const Code& getCode() const { return _code; }; @@ -173,7 +186,7 @@ class Transistor : public Cell { // Attributes // ******************* - private : char _type; + private : Polarity _polarity; private : MaskInfo* _masqueInfo; private : GenTrans * _genTrans; //public : RealInfo * _realInfo; @@ -185,10 +198,10 @@ class Transistor : public Cell { // Constructors // ************ # if !defined(__DOXYGEN_PROCESSOR__) - protected : Transistor(Library* library, const Name& name, char type); + protected : Transistor(Library* library, const Name& name, const Polarity& polarity); # endif - public : static Transistor* create(Library* library, const Name& name, char type); + public : static Transistor* create(Library* library, const Name& name, const Polarity& polarity); # if !defined(__DOXYGEN_PROCESSOR__) protected : virtual void _postCreate(); @@ -202,11 +215,11 @@ class Transistor : public Cell { // Accessors // ********* - public : char getType() const { return _type; }; + public : const Polarity& getPolarity() const { return _polarity; }; public : MaskVersion getMaskVersion() const { return _getMaskInfoVersion(_masqueInfo); }; public : const MaskInfo* getMaskInfo() const { return _masqueInfo; }; - public : const double& getL() const { return _masqueInfo->getL(); }; - public : const double& getW() const { return _masqueInfo->getW(); }; + public : const double getL() const { return _masqueInfo->getL(); }; + public : const double getW() const { return _masqueInfo->getW(); }; public : const unsigned& getNbDrainColumn() const { return _masqueInfo->getNbDrainColumn(); }; public : const unsigned& getNbSourceColumn() const { return _masqueInfo->getNbSourceColumn(); }; public : const char* getDrainName() const { return "DRAIN"; }; @@ -219,8 +232,8 @@ class Transistor : public Cell { // Predicats // ********* - public : bool isNmos() const { return _type==TRANSN; }; - public : bool isPmos() const { return _type==TRANSP; }; + public : bool isNmos() const { return _polarity==Polarity::N; }; + public : bool isPmos() const { return _polarity==Polarity::P; }; public : bool isInternal() const { return getAbutmentType().getCode()==Type::INTERNAL; }; public : bool isLeft() const { return getAbutmentType().getCode()==Type::LEFT; }; public : bool isRight() const { return getAbutmentType().getCode()==Type::RIGHT; }; @@ -254,9 +267,40 @@ class Transistor : public Cell { }; +#if !defined(__DOXYGEN_PROCESSOR__) + +// ------------------------------------------------------------------- +// Class : "Proxy...". + +template<> + inline string ProxyTypeName + ( const Transistor::Polarity::Code* object ) + { return ">"; } + +template<> + inline string ProxyString + ( const Transistor::Polarity::Code* object ) + { + switch ( *object ) { + case Transistor::Polarity::N: return "N"; + case Transistor::Polarity::P: return "P"; + } + return "ABNORMAL"; + } + +template<> + inline Record* ProxyRecord + ( const Transistor::Polarity::Code* object ) + { + Record* record = new Record(getString(object)); + record->Add(getSlot("Code", (unsigned int*)object)); + return record; + } + + + -# if !defined(__DOXYGEN_PROCESSOR__) // ------------------------------------------------------------------- // Class : "Proxy...". @@ -269,7 +313,7 @@ template<> inline string ProxyString ( const Transistor::MaskVersion::Code* object ) { - switch ( *object ) { + switch ( *object ) { case Transistor::MaskVersion::VERSION1: return "VERSION1"; } return "ABNORMAL"; @@ -278,11 +322,11 @@ template<> template<> inline Record* ProxyRecord ( const Transistor::MaskVersion::Code* object ) - { + { Record* record = new Record(getString(object)); record->Add(getSlot("Code", (unsigned int*)object)); return record; - } + } // ------------------------------------------------------------------- @@ -291,7 +335,7 @@ template<> template<> inline string ProxyTypeName ( const Transistor::Type::Code* object ) - { return ">"; } + { return ">"; } template<> inline string ProxyString @@ -309,7 +353,7 @@ template<> template<> inline Record* ProxyRecord ( const Transistor::Type::Code* object ) - { + { Record* record = new Record(getString(object)); record->Add(getSlot("Code", (unsigned int*)object)); return record; @@ -319,8 +363,8 @@ template<> #endif } - - + + // **************************************************************************************************** // Generic functions @@ -329,4 +373,6 @@ template<> string getString(const Hurricane::Transistor::MaskInfo&); + + #endif // HURRICANE_TRANSISTOR diff --git a/chamsin/src/analogic/Transistors.h b/chamsin/src/analogic/Transistors.h index a95ae8b9..c806ce5c 100644 --- a/chamsin/src/analogic/Transistors.h +++ b/chamsin/src/analogic/Transistors.h @@ -12,7 +12,6 @@ namespace Hurricane { - class Transistor; diff --git a/chamsin/src/device/TrMos.cpp b/chamsin/src/device/TrMos.cpp index 1c203f04..bea0e560 100644 --- a/chamsin/src/device/TrMos.cpp +++ b/chamsin/src/device/TrMos.cpp @@ -5,7 +5,6 @@ // **************************************************************************************************** -#include "TrMos.h" #include "Instance.h" #include "MetaTransistor.h" @@ -16,6 +15,8 @@ #include "UpdateSession.h" #include "DtrAccess.h" + +#include "TrMos.h" using namespace Hurricane; @@ -27,7 +28,7 @@ namespace DEVICE { TrMos::TrMos(Library* library, const Name& name): Inherit(library, name), - _type('N'), + _polarity(Transistor::Polarity::N), _isBsConnected(false), _m(1), _sourceIsFirst(true), @@ -75,19 +76,14 @@ Transistors TrMos::getTransistors() const { } -void TrMos::create(const char type, const bool isbsconnected) -// ********************************************************** +void TrMos::create(const Transistor::Polarity& polarity, const bool isbsconnected) { if( _tr1 ) { throw Error("Can't Create Logical View of TrMos " + getString(getName()) + " : " + "it has already been created"); } - if( (type!=TRANSN) && (type!=TRANSP)) { - throw Error("Can't Create TrMos " + getString(getName()) + " : type " + getString(type) + " is invalid"); - } - - _type = type; + _polarity = polarity; _isBsConnected = isbsconnected; // MetaTransistor is in the same library than Trmos @@ -114,7 +110,7 @@ void TrMos::create(const char type, const bool isbsconnected) // The name of MetaTransistor is nameoftrmos_tr1 // **************************************************** - _tr1 = MetaTransistor::create(library, Name( getString(getName())+"_Mos1" ), _type); + _tr1 = MetaTransistor::create(library, Name( getString(getName())+"_Mos1" ), _polarity); Instance * instance = Instance::create(this, Name("Ins_" + getString(_tr1->getName())), _tr1); @@ -195,7 +191,7 @@ void TrMos::generate(const unsigned m, const bool sourceisfirst, const bool hasr for(unsigned i=0; igetName()) + "_Finger_" + getString(i), - _type); + _polarity); _transistorList.push_back(finger); Instance::create(_tr1, Name("Ins_" + getString(finger->getName())), finger); diff --git a/chamsin/src/device/TrMos.h b/chamsin/src/device/TrMos.h index 0bebf778..5ed8b894 100644 --- a/chamsin/src/device/TrMos.h +++ b/chamsin/src/device/TrMos.h @@ -7,34 +7,16 @@ #ifndef DEVICE_TRMOS #define DEVICE_TRMOS +#include "Net.h" +using namespace Hurricane; #include "Device.h" -#include "Transistors.h" +#include "Transistor.h" #include "MetaTransistor.h" -namespace Hurricane { - - class Library; - class Name; - class Record; - class Transistor; - - class Net; - class Pin; -} - namespace DEVICE { -using Hurricane::Library; -using Hurricane::Name; -using Hurricane::Record; -using Hurricane::MetaTransistor; -using Hurricane::Transistor; -using Hurricane::Transistors; -using Hurricane::Net; -using Hurricane::Pin; - class TrMos : public Device { // ************************** @@ -51,7 +33,7 @@ class TrMos : public Device { // Structural parameter. // ******************** - private : char _type; + private : Transistor::Polarity _polarity; private : bool _isBsConnected; private : unsigned _m; @@ -100,13 +82,13 @@ class TrMos : public Device { #endif - public : void create(const char type, const bool isbsconnected); + public : void create(const Transistor::Polarity& polarity, const bool isbsconnected); public : void generate(const unsigned m, const bool sourceisfirst, const bool hasring, const unsigned nbsourcecolumn, const unsigned nbdraincolumn); // Accessors // ********* - public : char getType() const { return _type; }; + public : const Transistor::Polarity& getPolarity() const { return _polarity; }; public : unsigned getM() const { return _m; }; public : const double getWidthOfSourceWire() const { return _widthOfSourceWire; }; public : const double getWidthOfDrainWire() const { return _widthOfDrainWire; }; diff --git a/chamsin/src/device/TrMos_PlaceRoute.cpp b/chamsin/src/device/TrMos_PlaceRoute.cpp index d7401569..6ff6caa5 100644 --- a/chamsin/src/device/TrMos_PlaceRoute.cpp +++ b/chamsin/src/device/TrMos_PlaceRoute.cpp @@ -44,11 +44,11 @@ void TrMos::_PlaceAndRoute() // ************************************************************** DtrAccess * dtraccess = DtrAccess::getDtrAccess(); - char type; - if(_type == 'P') type = 'N'; - else type = 'P'; + Transistor::Polarity polarity; + if(_polarity == Transistor::Polarity::P) polarity = Transistor::Polarity::N; + else polarity = Transistor::Polarity::P; - long minImpWidth = dtraccess->getSingleRdsRuleByLabel("RW_", getString(type), "IMP"); + long minImpWidth = dtraccess->getSingleRdsRuleByLabel("RW_", getString(polarity), "IMP"); long minContWidth = dtraccess->getSingleRdsRuleByLabel(string("RW_CONT")); long minAlu1Width = dtraccess->getSingleRdsRuleByLabel(string("RW_ALU1")); long minVia1Width = dtraccess->getSingleRdsRuleByLabel(string("RW_VIA1")); @@ -57,7 +57,7 @@ void TrMos::_PlaceAndRoute() long rdActive = dtraccess->getSingleRdsRuleByLabel(string("RD_ACTI")); long rdAlu2 = dtraccess->getSingleRdsRuleByLabel(string("RD_ALU1")); - long reImpActi = dtraccess->getSingleRdsRuleByLabel("RE_", getString(type), "IMP_CONT"); + long reImpActi = dtraccess->getSingleRdsRuleByLabel("RE_", getString(polarity), "IMP_CONT"); long reActiContact = dtraccess->getSingleRdsRuleByLabel("RE_ACTI_CONT"); long reAlu1Contact = dtraccess->getSingleRdsRuleByLabel("RE_ALU1_CONT"); long reAlu1Via1 = dtraccess->getSingleRdsRuleByLabel("RE_ALU1_VIA1"); @@ -235,7 +235,7 @@ void TrMos::_PlaceAndRoute() Layer * layerImp = NULL; - if(_type == 'P') + if(_polarity == Transistor::Polarity::P) layerImp = db->getTechnology()->getLayer(Name("NIMP")); else layerImp = db->getTechnology()->getLayer(Name("PIMP")); @@ -670,7 +670,7 @@ void TrMos::_PlaceAndRoute() // Create Caission NWELL if this is a PMOS. // **************************************** - if(_type == 'P') { + if(_polarity == Transistor::Polarity::P) { Net * netCaisson = Net::create(this, Name("CAISSON")); Contact::create(netCaisson, layerNwell , getAbutmentBox().getXCenter()