diff --git a/chamsin/src/analogic/AnalogicalCommons.h b/chamsin/src/analogic/AnalogicalCommons.h deleted file mode 100644 index 97444067..00000000 --- a/chamsin/src/analogic/AnalogicalCommons.h +++ /dev/null @@ -1,38 +0,0 @@ -// **************************************************************************************************** -// File: AnalogicalCommons.h -// Authors: Wu YiFei -// Date : 21/12/2006 -// **************************************************************************************************** - -#ifndef HURRICANE_ANALOGICALCOMMONS -#define HURRICANE_ANALOGICALCOMMONS - - - -// ********************************************************************* -// Macros Declaration. -// ********************************************************************* - -#define IF_DEBUG_HUR_ANALOG \ - if(getenv("DEBUG_HUR_ANALOG")) { - -#ifndef END_IF -#define END_IF \ - } -#endif - - -// ********************************************************************* -// Analogical Unit declaration. -// ********************************************************************* -#if !defined(__DOXYGEN_PROCESSOR__) - -typedef double Micro; -typedef double MicroPower2; -typedef long Nano; - -#endif - - - -#endif // HURRICANE_ANALOGICALCOMMONS diff --git a/chamsin/src/analogic/ChoiceParameter.h b/chamsin/src/analogic/ChoiceParameter.h index 87905f80..36a5cb95 100644 --- a/chamsin/src/analogic/ChoiceParameter.h +++ b/chamsin/src/analogic/ChoiceParameter.h @@ -3,11 +3,13 @@ #include "DeviceParameter.h" -class ChoiceParameter : public DeviceParameter { +template +class ChoiceParameter : public Parameter { public: typedef vector Choices; - ChoiceParameter(string id, Choices& choices, unsigned value): - DeviceParameter(id), _choices(), _value(value) { + ChoiceParameter(string id, Choices& choices, + unsigned value, CallBack* callBack): + Parameter(id, callBack), _choices(), _value(value) { if (_value > choices.size()) { throw Error(""); } diff --git a/chamsin/src/analogic/Device.h b/chamsin/src/analogic/Device.h index 526c2178..644eb9f8 100644 --- a/chamsin/src/analogic/Device.h +++ b/chamsin/src/analogic/Device.h @@ -1,26 +1,33 @@ #ifndef DEVICE_H #define DEVICE_H -#include "DeviceParameter.h" #include "hurricane/Cell.h" +using namespace Hurricane; + +//#include "DeviceParameter.h" class Device : public Cell { +#if 0 public: - struct DeviceParameterCompare: - public std::binary_function { - bool operator()(const DeviceParameter& dp1, const DeviceParameter& dp2) const { - return dp1._id < dp2._id; + struct ParameterCompare: + public std::binary_function { + bool operator()(const Parameter<>* dp1, const Parameter<>* dp2) const { + return dp1->_id < dp2->_id; } }; - typedef set DeviceParameterSet; - DeviceParameter& getParameter(const string& parameterId) const; + + typedef set, ParameterCompare> ParameterSet; + Parameter* getParameter(const string& parameterId) const; +#endif protected: Device(Library* library, const Name& name): Cell(library, name) {} - void addParameter(const DeviceParameter& deviceParameter) { - _parameterSet.insert(deviceParameter); +#if 0 + void addParameter(const Parameter* parameter) { + _parameterSet.insert(parameter); } private: - DeviceParameterSet _parameterSet; + ParameterSet _parameterSet; +#endif }; diff --git a/chamsin/src/analogic/DeviceParameter.h b/chamsin/src/analogic/DeviceParameter.h index 0181ae91..f9fef02a 100644 --- a/chamsin/src/analogic/DeviceParameter.h +++ b/chamsin/src/analogic/DeviceParameter.h @@ -1,13 +1,15 @@ -#ifndef DEVICEPARAMETER_H -#define DEVICEPARAMETER_H +#ifndef PARAMETER_H +#define PARAMETER_H -class DeviceParameter { +#include "CallBack.h" + +class Parameter { public: const string _id; - string _getString() const; - Record* _getRecord() const; protected: - DeviceParameter(string id): _id(id) {} + Parameter(string id, CallBack* callBack): _id(id), _callBack(callBack) {} + private: + CallBack* _callBack; }; -#endif // DEVICEPARAMETER_H +#endif // PARAMETER_H diff --git a/chamsin/src/analogic/GenTrans.h b/chamsin/src/analogic/GenTrans.h deleted file mode 100644 index 08412edb..00000000 --- a/chamsin/src/analogic/GenTrans.h +++ /dev/null @@ -1,60 +0,0 @@ -// **************************************************************************************************** -// File: GenTrans.h -// Authors: Wu YiFei -// Date : 04/04/2007 -// **************************************************************************************************** - - -#ifndef HURRICANE_GENTRANS -#define HURRICANE_GENTRANS - - -#include "Transistor.h" -#include "Box.h" - - -namespace Hurricane { - -class GenTrans { -// ************* - -// Attributes -// ********** - protected : map _mapString2Box; - - -// Constructors -// ************* - public : GenTrans() {}; - -// Destructors -// *********** - public : virtual ~GenTrans() {}; - -// Operators -// ********** - public : virtual void Calculate(Transistor*) = 0; - public : virtual void Generate(Transistor*) = 0; - -}; - - -class GenV1Trans : public GenTrans { - public: - typedef GenTrans Inherit; - - const Transistor::MaskV1Info* _masqueV1Info; - static const int maxNbContacts = 8; - - GenV1Trans(Transistor::MaskV1Info*); - - virtual ~GenV1Trans() {}; - - virtual void Calculate(Transistor*) ; - virtual void Generate(Transistor*) ; - -}; - -} - -#endif diff --git a/chamsin/src/analogic/MetaTransistor.h b/chamsin/src/analogic/MetaTransistor.h index 7d41b461..4d3ee6a0 100644 --- a/chamsin/src/analogic/MetaTransistor.h +++ b/chamsin/src/analogic/MetaTransistor.h @@ -1,30 +1,9 @@ -// **************************************************************************************************** -// File: MetaTransistor.h -// Authors: Wu YiFei -// Date : 21/12/2006 -// **************************************************************************************************** +#ifndef METATRANSISTOR_H +#define METATRANSISTOR_H -#ifndef HURRICANE_METATRANSISTOR -#define HURRICANE_METATRANSISTOR +#include "AnalogComponent.h" -#include "Cell.h" -using namespace Hurricane; -#include "AnalogicalCommons.h" - -namespace Hurricane { - -class MetaTransistor: public Cell { -// ******************************** - - -// Types -// ***** - public : typedef Cell Inherit; - -# if !defined(__DOXYGEN_PROCESSOR__) - -// Logicals Attributes -// ******************* +class MetaTransistor: public AnalogComponent { private : char _type; private : unsigned _m; private : Micro _le, _we; // length and width expected @@ -37,38 +16,13 @@ class MetaTransistor: public Cell { private : double _cgb, _cgs, _cdb, _cds, _csb, _cgd; -// Behaviorals attributes -// ********************** - private : double _temp, _vds, _vgs; // DC - private : double _vg, _vd, _vs, _vb; - private : char _region; - private : double _ids; - private : double _vth, _vdsat; // AC - -# endif - -// Constructors -// ************ -# if !defined(__DOXYGEN_PROCESSOR__) protected : MetaTransistor(Library* library, const Name& name, char type); -# endif public : static MetaTransistor* create(Library* library, const Name& name, char type); -# if !defined(__DOXYGEN_PROCESSOR__) protected : virtual void _postCreate(); -// Destructors -// *********** - protected : ~MetaTransistor() {}; - protected : virtual void _preDestroy(); -# endif - -// Operations -// ********** - - // Create the connection between all instances. // ******************************************** public : void createConnection(); @@ -77,17 +31,6 @@ class MetaTransistor: public Cell { public : void createLayout(); -# if !defined(__DOXYGEN_PROCESSOR__) - // get all paramters after generation of Layout (capa..). - // ***************************************************** - public : void getParameterOfGeneration() { /* to do */}; - - // Delete all instances and all motifs in this metatransistor. - // *********************************************************** - public : void Flush(); -# endif - - // Accessors // ********* public : const Micro& getLe() const { return _le; }; @@ -104,16 +47,6 @@ class MetaTransistor: public Cell { public : void setM (const unsigned m) { _m=m; }; -//#endif - -# if !defined(__DOXYGEN_PROCESSOR__) -// Others -// ****** - public: virtual string _getTypeName() const {return _TName("MetaTransistor");}; - public: virtual string _getString() const; - public: virtual Record* _getRecord() const; -# endif - }; diff --git a/chamsin/src/analogic/MetaTransistors.h b/chamsin/src/analogic/MetaTransistors.h deleted file mode 100644 index f3067f37..00000000 --- a/chamsin/src/analogic/MetaTransistors.h +++ /dev/null @@ -1,55 +0,0 @@ - -// **************************************************************************************************** -// File: MetaTransistors.h -// Authors: YIFEI WU -// Date : 21/12/2006 -// **************************************************************************************************** - -#ifndef HURRICANE_METATRANSISTORS -#define HURRICANE_METATRANSISTORS - -#include "Collection.h" - -class MetaTransistor; - - -// **************************************************************************************************** -// MetaTransistors declaration -// **************************************************************************************************** - -typedef GenericCollection MetaTransistors; - - - -// **************************************************************************************************** -// MetaTransistorLocator declaration -// **************************************************************************************************** - -typedef GenericLocator MetaTransistorLocator; - - - -// **************************************************************************************************** -// MetaTransistorFilter declaration -// **************************************************************************************************** - -typedef GenericFilter MetaTransistorFilter; - - - -// **************************************************************************************************** -// for_each_metatransistor declaration -// **************************************************************************************************** - -#define for_each_metatransistor(metatransistor, metatransistors)\ -/******************************/\ -{\ - MetaTransistorLocator _locator = metatransistors.GetLocator();\ - while (_locator.IsValid()) {\ - MetaTransistor* metatransistor = _locator.GetElement();\ - _locator.Progress(); - - - -#endif // HURRICANE_METATRANSISTORS - diff --git a/chamsin/src/analogic/Transistor.cpp b/chamsin/src/analogic/Transistor.cpp index ae0cacaf..fcdd3fde 100644 --- a/chamsin/src/analogic/Transistor.cpp +++ b/chamsin/src/analogic/Transistor.cpp @@ -6,38 +6,10 @@ using namespace Hurricane; #include "AEnv.h" #include "ATechnology.h" -#include "ChoiceParameter.h" #include "Transistor.h" namespace { -void createContactMatrix(Net* net, const Layer* layer, const Box& box, unsigned columns, - const DbU::Unit& rwCont, const DbU::Unit& rdCont) { - unsigned contacts = 0; - if (box.getHeight() < rwCont) { - contacts = 0; - } else { - contacts = (box.getHeight() - rwCont) / (rwCont + rdCont) + 1; - } - - Point padMin(box.getXMin(), box.getYMin()); - Point padMax(padMin); - padMax += Point(rwCont, rwCont); - - for (unsigned i=0; igetLayer(layerStr); if (!layer) { @@ -62,40 +34,29 @@ const Name Transistor::GridName("GRID"); const Name Transistor::BulkName("BULK"); const Name Transistor::AnonymousName("ANONYMOUS"); +Transistor::Type::Type(const Code& code): + _code(code) +{} -string Transistor::Polarity::_getString() const { - return getString(&_code); +Transistor::Type::Type(const Type& type): + _code(type._code) +{} + +Transistor::Type& Transistor::Type::operator=(const Type& type) { + _code = type._code; + return *this; } -Record* Transistor::Polarity::_getRecord() const { - Record* record = new Record(getString(this)); - record->add(getSlot("Code", &_code)); - return record; -} - -string Transistor::AbutmentType::_getString() const { - return getString(&_code); -} - -Record* Transistor::AbutmentType::_getRecord() const { - Record* record = new Record(getString(this)); - record->add(getSlot("Code", &_code)); - return record; -} - -Transistor::Transistor(Library* library, const Name& name, - const Polarity& polarity, DbU::Unit l, DbU::Unit w, - const AbutmentType& abutmentType): +Transistor::Transistor(Library* library, const Name& name): Device(library, name), _drain(NULL), _source(NULL), _grid(NULL), _bulk(NULL), _anonymous(NULL), - _polarity(polarity), - _abutmentType(abutmentType), - _l(l), - _w(w), + _type(), + _l(0), + _w(0), _source20(NULL), _source22(NULL), _drain40(NULL), _drain42(NULL), _grid00(NULL), _grid01(NULL), _grid30(NULL), _grid31(NULL), @@ -103,11 +64,8 @@ Transistor::Transistor(Library* library, const Name& name, {} -Transistor* Transistor::create(Library* library, const Name& name, - const Polarity& polarity, - DbU::Unit l, DbU::Unit w, - const AbutmentType& abutmentType) { - Transistor* transistor = new Transistor(library, name, polarity, l, w, abutmentType); +Transistor* Transistor::create(Library* library, const Name& name) { + Transistor* transistor = new Transistor(library, name); transistor->_postCreate(); @@ -115,62 +73,62 @@ Transistor* Transistor::create(Library* library, const Name& name, } void Transistor::_postCreate() { - Inherit::_postCreate(); + Inherit::_postCreate(); - ChoiceParameter::Choices choices; - choices.push_back(string("N")); - choices.push_back(string("P")); - addParameter(ChoiceParameter("polarity", choices, 0)); + //ChoiceParameter::Choices choices; + //choices.push_back(string("N")); + //choices.push_back(string("P")); + //addParameter(ChoiceParameter("type", choices, 0, new CallBack(this, &Transistor::updateType))); - DataBase* db = DataBase::getDB(); - Technology* technology = db->getTechnology(); - _drain = Net::create(this, DrainName); - _drain->setExternal(true); - _source = Net::create(this, SourceName); - _source->setExternal(true); - _grid = Net::create(this, GridName); - _grid->setExternal(true); - _bulk = Net::create(this, BulkName); - _bulk->setExternal(true); - _anonymous = Net::create(this, AnonymousName); - _source20 = createPad(technology, _source, "cut0"); - _source22 = createPad(technology, _source, "cut1"); - _drain40 = createPad(technology, _drain, "cut0"); - _drain42 = createPad(technology, _drain, "cut1"); - _grid00 = createPad(technology, _grid, "poly"); - _grid01 = createPad(technology, _grid, "poly"); - _grid30 = createPad(technology, _grid, "cut0"); - _grid31 = createPad(technology, _grid, "metal1"); - _anonymous10 = createPad(technology, _anonymous, "active"); - if (_polarity == Polarity::N) { - _anonymous11 = createPad(technology, _anonymous, "nImplant"); - _anonymous12 = createPad(technology, _anonymous, "nImplant"); - } else { - _anonymous11 = createPad(technology, _anonymous, "pImplant"); - _anonymous12 = createPad(technology, _anonymous, "pImplant"); - } - setTerminal(false); + DataBase* db = DataBase::getDB(); + Technology* technology = db->getTechnology(); + _drain = Net::create(this, DrainName); + _drain->setExternal(true); + _source = Net::create(this, SourceName); + _source->setExternal(true); + _grid = Net::create(this, GridName); + _grid->setExternal(true); + _bulk = Net::create(this, BulkName); + _bulk->setExternal(true); + _anonymous = Net::create(this, AnonymousName); + _source20 = createPad(technology, _source, "cut0"); + _source22 = createPad(technology, _source, "cut1"); + _drain40 = createPad(technology, _drain, "cut0"); + _drain42 = createPad(technology, _drain, "cut1"); + _grid00 = createPad(technology, _grid, "poly"); + _grid01 = createPad(technology, _grid, "poly"); + _grid30 = createPad(technology, _grid, "cut0"); + _grid31 = createPad(technology, _grid, "metal1"); + _anonymous10 = createPad(technology, _anonymous, "active"); + if (_type == Type::NMOS) { + _anonymous11 = createPad(technology, _anonymous, "nImplant"); + _anonymous12 = createPad(technology, _anonymous, "nImplant"); + } else { + _anonymous11 = createPad(technology, _anonymous, "pImplant"); + _anonymous12 = createPad(technology, _anonymous, "pImplant"); + } + setTerminal(false); } -void Transistor::setPolarity(const Polarity& polarity) { +void Transistor::setType(Type type) { UpdateSession::open(); - if (polarity != _polarity) { - _polarity = polarity; + if (type != _type) { + _type = type; DataBase* db = DataBase::getDB(); Technology* technology = db->getTechnology(); - if (_polarity == Polarity::N) { + if (_type == Type::NMOS) { _anonymous11->setLayer(getLayer(technology, "nImplant")); _anonymous12->setLayer(getLayer(technology, "nImplant")); } else { _anonymous11->setLayer(getLayer(technology, "pImplant")); _anonymous12->setLayer(getLayer(technology, "pImplant")); } - createLayout(); + updateLayout(); } UpdateSession::close(); } -void Transistor::createLayout() { +void Transistor::updateLayout() { DataBase* db = DataBase::getDB(); if (!db) { throw Error("Error : no DataBase"); @@ -203,7 +161,8 @@ void Transistor::createLayout() { DbU::Unit enclosureGateImplant = 0; DbU::Unit extImplantActive = 0; DbU::Unit extImplantCut0 = 0; - if (_polarity == Polarity::N) { + + if (_type == Type::NMOS) { enclosureImplantPoly = atechno->getPhysicalRule("minEnclosure", getLayer(techno, "nImplant"), getLayer(techno, "poly"))->getValue(); enclosureGateImplant = atechno->getPhysicalRule("minGateEnclosure", @@ -340,7 +299,7 @@ void Transistor::createLayout() { Box box11(x11, y11, x11 + dx11, y11 + dy11); _anonymous11->setBoundingBox(box11); - if (_polarity == Polarity::P) { + if (_type == Type::PMOS) { DbU::Unit x50 = x10 - enclosurePPlusActive; DbU::Unit y50 = y10 - enclosurePPlusActive; DbU::Unit dx50 = dx10 + 2 * enclosurePPlusActive; @@ -368,8 +327,6 @@ Record* Transistor::_getRecord() const { record->add(getSlot("Source", _source)); record->add(getSlot("Grid", _grid)); record->add(getSlot("Bulk", _bulk)); - record->add(getSlot("Polarity", &_polarity)); - record->add(getSlot("AbutmentType", &_abutmentType)); record->add(getSlot("L", &_l)); record->add(getSlot("W", &_w)); record->add(getSlot("Source20", _source20)); diff --git a/chamsin/src/analogic/Transistor.h b/chamsin/src/analogic/Transistor.h index a4e9abed..2dbd2998 100644 --- a/chamsin/src/analogic/Transistor.h +++ b/chamsin/src/analogic/Transistor.h @@ -1,40 +1,23 @@ #ifndef TRANSISTOR_H #define TRANSISTOR_H -#include "hurricane/Name.h" -using namespace Hurricane; - #include "Device.h" -namespace Hurricane { - class Transistor : public Device { public: - class Polarity { + class Type { public: - enum Code {N=0, P=1}; - - Polarity(const Code& code): _code(code) {} - operator const Code&() const { return _code; }; - string _getString() const; - Record* _getRecord() const; + enum Code {UNDEFINED=0, NMOS=1, PMOS=2}; + + Type(const Code& code = UNDEFINED); + Type(const Type& type); + + Type& operator=(const Type& type); + operator const Code&() const {return _code;}; + + const Code& getCode() const {return _code;}; private: - Polarity() {} - Code _code; - }; - - class AbutmentType { - public: - enum Code {INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3}; - - AbutmentType(const Code& code): _code(code) {} - operator const Code&() const { return _code; }; - string _getString() const; - Record* _getRecord() const; - - private: - AbutmentType() {} Code _code; }; @@ -44,23 +27,12 @@ class Transistor : public Device { static const Name BulkName; static const Name AnonymousName; + static Transistor* create(Library* library, const Name& name); + void updateLayout(); + void setType(Type type); - static Transistor* create(Library* library, const Name& name, - const Polarity& polarity, - DbU::Unit l, DbU::Unit w, - const AbutmentType& abutmentType=AbutmentType::SINGLE); - void createLayout(); - - bool isNmos() const { return _polarity == Polarity::N; }; - bool isPmos() const { return _polarity == Polarity::P; }; - bool isInternal() const { return _abutmentType == AbutmentType::INTERNAL; }; - bool isLeft() const { return _abutmentType == AbutmentType::LEFT; }; - bool isRight() const { return _abutmentType == AbutmentType::RIGHT; }; - bool isSingle() const { return _abutmentType == AbutmentType::SINGLE; }; - - void setW(DbU::Unit value) { _w = value; createLayout(); } - void setL(DbU::Unit value) { _l = value; createLayout(); } - void setPolarity(const Polarity& polarity); + void setW(DbU::Unit value) { _w = value; updateLayout(); } + void setL(DbU::Unit value) { _l = value; updateLayout(); } virtual Record* _getRecord() const; @@ -73,8 +45,7 @@ class Transistor : public Device { Net* _grid; Net* _bulk; Net* _anonymous; - Polarity _polarity; - AbutmentType _abutmentType; + Type _type; DbU::Unit _l; DbU::Unit _w; Pad *_source20, *_source22; @@ -82,50 +53,9 @@ class Transistor : public Device { Pad *_grid00, *_grid01, *_grid30, *_grid31; Pad *_anonymous10, *_anonymous11, *_anonymous12, *_anonymous50; - Transistor(Library* library, const Name& name, - const Polarity& polarity, - DbU::Unit l, DbU::Unit w, - const AbutmentType& abutmentType); + Transistor(Library* library, const Name& name); }; -} - -template<> inline std::string getString -(const Hurricane::Transistor::Polarity::Code* object ) { - switch (*object) { - case Hurricane::Transistor::Polarity::N: return "N"; - case Hurricane::Transistor::Polarity::P: return "P"; - default: return "ABNORMAL"; - } -} - -template<> inline Hurricane::Record* getRecord -(const Hurricane::Transistor::Polarity::Code* object) { - Hurricane::Record* record = new Hurricane::Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; -} - -template<> inline std::string getString -(const Hurricane::Transistor::AbutmentType::Code* object ) { - switch (*object) { - case Hurricane::Transistor::AbutmentType::INTERNAL: return "INTERNAL"; - case Hurricane::Transistor::AbutmentType::LEFT: return "LEFT"; - case Hurricane::Transistor::AbutmentType::RIGHT: return "RIGHT"; - case Hurricane::Transistor::AbutmentType::SINGLE: return "SINGLE"; - default: return "ABNORMAL"; - } -} - -template<> inline Hurricane::Record* getRecord -(const Hurricane::Transistor::AbutmentType::Code* object) { - Hurricane::Record* record = new Hurricane::Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; -} - -INSPECTOR_P_SUPPORT(Hurricane::Transistor); -INSPECTOR_P_SUPPORT(Hurricane::Transistor::Polarity); -INSPECTOR_P_SUPPORT(Hurricane::Transistor::AbutmentType); +//INSPECTOR_P_SUPPORT(Transistor); #endif // TRANSISTOR_H diff --git a/chamsin/src/analogic/Transistor.h.backup b/chamsin/src/analogic/Transistor.h.backup deleted file mode 100644 index 7a36a96d..00000000 --- a/chamsin/src/analogic/Transistor.h.backup +++ /dev/null @@ -1,378 +0,0 @@ -// **************************************************************************************************** -// File: Transistor.h -// Authors: Wu YiFei -// Date : 21/12/2006 -// **************************************************************************************************** - -#ifndef HURRICANE_TRANSISTOR -#define HURRICANE_TRANSISTOR - -#include "Cell.h" -using namespace Hurricane; - -#include "Transistors.h" - -namespace Hurricane { - -class GenTrans; - - - -class Transistor : public Cell { - -//# if !defined(__DOXYGEN_PROCESSOR__) - -// Types -// ***** - - 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; - - public : explicit MaskVersion(const Code& code=VERSION1); - public : MaskVersion(const MaskVersion&); - public : MaskVersion& operator=(const MaskVersion&); - - public : operator const Code& () const { return _code; }; - public : const Code& getCode() const { return _code; }; - - public : string _getTypeName() const { return _TName("Transistor::MaskVersion"); }; - public : string _getString() const; - public : Record* _getRecord() const; - - }; - - - public : class Type { - // ********* - - public : enum Code { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3}; - - private: Code _code; - - public : explicit Type(const Code& code=INTERNAL); - public : Type(const Type& type); - public : Type& operator=(const Type& type); - public : operator const Code&() const { return _code; }; - - public : void setCode(const Code& code) { _code = code; }; - - public : const Code& getCode() const { return _code; }; - - public : string _getTypeName() const { return _TName("Transistor::Type"); }; - public : string _getString() const; - public : Record* _getRecord() const; - - }; - - - public : class MaskInfo { - // *************** - - // Attributs - // ********* - private : double _l; - private : double _w ; - private : Type _type; - private : unsigned _nbDrainColumn; - private : unsigned _nbSourceColumn; - - // Constructors - // ************ - public : MaskInfo(const double& l, const double& w, const Type::Code& type=Type::INTERNAL - , const unsigned& nbDrainColumn=1 - , const unsigned& nbSourceColumn=1); - - public : virtual MaskInfo& operator=(const MaskInfo&); - - private : MaskInfo(const MaskInfo& ); - - - // Destructors - // *********** - public: virtual ~MaskInfo() {}; - - // Accessors - // ********* - public : const double& getL() const { return _l; }; - public : const double& getW() const { return _w; }; - public : const unsigned & getNbDrainColumn() const { return _nbDrainColumn; }; - public : const unsigned & getNbSourceColumn() const { return _nbSourceColumn; }; - public : const Type& getType() const { return _type; }; - - // Update - // ****** - public : void setL(const double& l) { _l=l;}; - public : void setW(const double& w) { _w=w;}; - public : void setNbDrainColumn(const unsigned& column) { _nbDrainColumn=column; }; - public : void setNbSourceColumn(const unsigned& column) { _nbSourceColumn=column; }; - public : void setType(const Type::Code& code) { _type.setCode(code); }; - public : void setType(const Type& type) { _type = type; }; - - // Predicats - // ********* - - // Operators - // ********* - public : virtual bool operator==(const MaskInfo&); - - // Others - // ****** - public : virtual string _getTypeName() const =0; - public : virtual string _getString() const; - public : virtual Record* _getRecord() const; - - }; - - - public : class MaskV1Info : public MaskInfo { - // ************************************* - - // type - // ***** - public : typedef MaskInfo Inherit ; - - // Attributs - // ********* - - // Constructors - // ************ - public: MaskV1Info(const double& l, const double& w, const Type::Code& type=Type::INTERNAL - , const unsigned& nbDrainColumn = 1 - , const unsigned& nbSourceColumn = 1); - - public : MaskInfo& operator=(const MaskInfo&); - - - // Destructor - // *********** - public : virtual ~MaskV1Info() {}; - - // Operators - // ********* - public : bool operator==(const MaskInfo&); - - // Others - // ********* - public : virtual string _getTypeName() const { return _TName("Transistor::MaskV1Info"); }; - public : virtual string _getString() const; - public : virtual Record* _getRecord() const; - }; - - -# if !defined(__DOXYGEN_PROCESSOR__) - -// Attributes -// ******************* - private : Polarity _polarity; - private : MaskInfo* _masqueInfo; - private : GenTrans * _genTrans; - //public : RealInfo * _realInfo; - - private : map _mapNet2Box; // This Map Is For localize The Position Of Routing. - -# endif - -// Constructors -// ************ -# if !defined(__DOXYGEN_PROCESSOR__) - protected : Transistor(Library* library, const Name& name, const Polarity& polarity); -# endif - - public : static Transistor* create(Library* library, const Name& name, const Polarity& polarity); - -# if !defined(__DOXYGEN_PROCESSOR__) - protected : virtual void _postCreate(); - - -// Destructors -// *********** - protected : ~Transistor() {}; - protected : virtual void _preDestroy(); -# endif - -// Accessors -// ********* - 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 unsigned& getNbDrainColumn() const { return _masqueInfo->getNbDrainColumn(); }; - public : const unsigned& getNbSourceColumn() const { return _masqueInfo->getNbSourceColumn(); }; - public : const char* getDrainName() const { return "DRAIN"; }; - public : const char* getSourceName() const { return "SOURCE"; }; - public : const char* getGridName() const { return "GRID"; }; - public : Net* getDrain() const { return getNet(getDrainName()); }; - public : Net* getSource() const { return getNet(getSourceName()); }; - public : Net* getGrid() const { return getNet(getGridName()); }; - public : const Type& getAbutmentType() const { return _masqueInfo->getType(); }; - -// Predicats -// ********* - 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; }; - public : bool isSingle() const { return getAbutmentType().getCode()==Type::SINGLE; }; - -// Updators -// ******** - public : void setL(const double& l) { _masqueInfo->setL(l); }; - public : void setW(const double& w) { _masqueInfo->setW(w); }; - -//# endif - -# if !defined(__DOXYGEN_PROCESSOR__) -// Others -// ****** - public : virtual string _getTypeName() const {return _TName("Transistor");}; - public : virtual string _getString() const; - public : virtual Record* _getRecord() const; - public : const GenTrans* _getGenTrans() const {return _genTrans; }; - public : static MaskVersion _getMaskInfoVersion(MaskInfo*) ; - public : static MaskInfo* _createMaskInfo(const MaskVersion&) ; - public : map* _getMapNet2Box() { return &_mapNet2Box; }; - -# endif - -// Operators -// ********* - public : void setMaskInfo(MaskInfo*); - public : void createLayout(); - public : void duplicateLayout(Transistor* transistor) ; - - -}; -#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; - } - - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName - ( const Transistor::MaskVersion::Code* object ) - { return ">"; } - -template<> - inline string ProxyString - ( const Transistor::MaskVersion::Code* object ) - { - switch ( *object ) { - case Transistor::MaskVersion::VERSION1: return "VERSION1"; - } - return "ABNORMAL"; - } - -template<> - inline Record* ProxyRecord - ( const Transistor::MaskVersion::Code* object ) - { - Record* record = new Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; - } - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName - ( const Transistor::Type::Code* object ) - { return ">"; } - -template<> - inline string ProxyString - ( const Transistor::Type::Code* object ) - { - switch ( *object ) { - case Transistor::Type::LEFT : return "LEFT"; - case Transistor::Type::SINGLE: return "SINGLE"; - case Transistor::Type::RIGHT: return "RIGHT"; - case Transistor::Type::INTERNAL: return "INTERNAL"; - } - return "ABNORMAL"; - } - -template<> - inline Record* ProxyRecord - ( const Transistor::Type::Code* object ) - { - Record* record = new Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; - } - - -#endif - -} - - - -// **************************************************************************************************** -// Generic functions -// **************************************************************************************************** - -string getString(const Hurricane::Transistor::MaskInfo&); - - - - -#endif // HURRICANE_TRANSISTOR diff --git a/chamsin/src/tests/AnalogicViewer.cpp b/chamsin/src/tests/AnalogicViewer.cpp index 42e8870b..baa24c18 100644 --- a/chamsin/src/tests/AnalogicViewer.cpp +++ b/chamsin/src/tests/AnalogicViewer.cpp @@ -2,13 +2,13 @@ #include #include #include -#include "AnalogicViewer.h" #include "Transistor.h" #include "hurricane/viewer/CellWidget.h" #include "AEnv.h" #include "ATechnology.h" +#include "AnalogicViewer.h" AnalogicViewer::AnalogicViewer(Library* library) { @@ -22,8 +22,12 @@ AnalogicViewer::AnalogicViewer(Library* library) { DbU::Unit transistorMinW = aTechnology->getPhysicalRule("transistorMinW")->getValue(); DbU::Unit transistorMaxW = aTechnology->getPhysicalRule("transistorMaxW")->getValue(); - _transistor = Transistor::create(library, Name("TEST"), Transistor::Polarity::N, transistorMinL, transistorMinW); - _transistor->createLayout(); + _transistor = Transistor::create(library, Name("TEST")); + _transistor->setL(transistorMinL); + _transistor->setW(transistorMinW); + _transistor->setType(Transistor::Type::NMOS); + + _transistor->updateLayout(); _cellWidget = new CellWidget; _cellWidget->setCell(_transistor); _cellWidget->fitToContents(); @@ -36,16 +40,11 @@ AnalogicViewer::AnalogicViewer(Library* library) { lSlider->setRange(transistorMinL, 4 * transistorMinL); lSlider->setPageStep(DbU::grid(1)); lSlider->setSliderPosition(transistorMinL); - QStringList choices; - choices << "N" << "P"; - QComboBox* choiceBox = new QComboBox; - choiceBox->addItems(choices); QWidget* slidersWidget = new QWidget; QGridLayout* layout = new QGridLayout; layout->addWidget(wSlider, 0, 0); layout->addWidget(lSlider, 1, 0); - layout->addWidget(choiceBox, 2, 0); slidersWidget->setLayout(layout); QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this); @@ -56,7 +55,6 @@ AnalogicViewer::AnalogicViewer(Library* library) { connect(wSlider, SIGNAL(valueChanged(int)), this, SLOT(wvalueChanged(int))); connect(lSlider, SIGNAL(valueChanged(int)), this, SLOT(lvalueChanged(int))); - connect(choiceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(transistorTypeChanged(int))); } void AnalogicViewer::wvalueChanged(int value) { @@ -68,13 +66,3 @@ void AnalogicViewer::lvalueChanged(int value) { _transistor->setL(value); _cellWidget->redraw(); } - -void AnalogicViewer::transistorTypeChanged(int value) { - if (value == 0) { - _transistor->setPolarity(Transistor::Polarity::N); - _cellWidget->redraw(); - } else if (value == 1) { - _transistor->setPolarity(Transistor::Polarity::P); - _cellWidget->redraw(); - } -} diff --git a/chamsin/src/tests/AnalogicViewer.h b/chamsin/src/tests/AnalogicViewer.h index 53b9c986..3bf9975a 100644 --- a/chamsin/src/tests/AnalogicViewer.h +++ b/chamsin/src/tests/AnalogicViewer.h @@ -5,11 +5,12 @@ namespace Hurricane { class Library; - class Transistor; class CellWidget; } using namespace Hurricane; +class Transistor; + class AnalogicViewer : public QMainWindow { Q_OBJECT public: @@ -17,7 +18,6 @@ class AnalogicViewer : public QMainWindow { private slots: void lvalueChanged(int value); void wvalueChanged(int value); - void transistorTypeChanged(int value); private: AnalogicViewer();