From 2d08ea4f632f755c6c87bdd28b316abf02cc296a Mon Sep 17 00:00:00 2001 From: Christophe Alexandre Date: Mon, 23 Jun 2008 11:23:22 +0000 Subject: [PATCH] New DbU::Units using the new Inspector framework --- chamsin/src/analogic/Transistor.cpp | 43 +++++++++++++++++-- chamsin/src/analogic/Transistor.h | 42 ++++++++++++++++-- .../src/technology/ATechnologyXmlParser.cpp | 4 +- chamsin/src/tests/AnalogicTest.cpp | 2 +- 4 files changed, 80 insertions(+), 11 deletions(-) diff --git a/chamsin/src/analogic/Transistor.cpp b/chamsin/src/analogic/Transistor.cpp index 2f703e99..3f1c34d1 100644 --- a/chamsin/src/analogic/Transistor.cpp +++ b/chamsin/src/analogic/Transistor.cpp @@ -10,8 +10,6 @@ using namespace Hurricane; namespace { - - void createContactMatrix(Net* net, const Layer* layer, const Box& box, unsigned columns, const DbU::Unit& rwCont, const DbU::Unit& rdCont) { unsigned contacts = 0; @@ -63,6 +61,17 @@ const Name Transistor::GridName("GRID"); const Name Transistor::BulkName("BULK"); const Name Transistor::AnonymousName("ANONYMOUS"); + +string Transistor::Polarity::_getString() const { + return getString(&_code); +} + +Record* Transistor::Polarity::_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): Cell(library, name), _drain(NULL), @@ -112,7 +121,7 @@ void Transistor::_postCreate() { _grid30 = createPad(technology, _grid, "cut0"); _grid31 = createPad(technology, _grid, "metal1"); _anonymous10 = createPad(technology, _anonymous, "active"); - if (_polarity == N) { + if (_polarity == Polarity::N) { _anonymous11 = createPad(technology, _anonymous, "nImplant"); _anonymous12 = createPad(technology, _anonymous, "nImplant"); } else { @@ -145,7 +154,7 @@ void Transistor::createLayout() { DbU::Unit enclosureImplantPoly = 0; DbU::Unit extImplantActive = 0; DbU::Unit extImplantCut0 = 0; - if (_polarity == N) { + if (_polarity == Polarity::N) { enclosureImplantPoly = atechno->getPhysicalRule("minEnclosure", getLayer(techno, "nImplant"), getLayer(techno, "poly"))->getValue(); extImplantActive = atechno->getPhysicalRule("minExtension", @@ -224,3 +233,29 @@ void Transistor::createLayout() { //setAbutmentBox(getAbutmentBox()); UpdateSession::close(); } + +Record* Transistor::_getRecord() const { + Record* record = Inherit::_getRecord(); + if (record) { + record->add(getSlot("Drain", _drain)); + 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)); + record->add(getSlot("Source22", _source22)); + record->add(getSlot("Drain40", _drain40)); + record->add(getSlot("Drain42", _drain42)); + record->add(getSlot("Grid00", _grid00)); + record->add(getSlot("Grid01", _grid01)); + record->add(getSlot("Grid30", _grid30)); + record->add(getSlot("Grid31", _grid31)); + record->add(getSlot("10", _anonymous10)); + record->add(getSlot("11", _anonymous11)); + record->add(getSlot("12", _anonymous12)); + } + return record; +} diff --git a/chamsin/src/analogic/Transistor.h b/chamsin/src/analogic/Transistor.h index 9d0fa99b..d991fecc 100644 --- a/chamsin/src/analogic/Transistor.h +++ b/chamsin/src/analogic/Transistor.h @@ -9,12 +9,25 @@ namespace Hurricane { class Transistor : public Cell { public: + class Polarity { + 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; + private: + Code _code; + }; + static const Name DrainName; static const Name SourceName; static const Name GridName; static const Name BulkName; static const Name AnonymousName; - enum Polarity {N=0, P=1}; + enum AbutmentType { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3}; static Transistor* create(Library* library, const Name& name, @@ -22,17 +35,19 @@ class Transistor : public Cell { DbU::Unit l, DbU::Unit w); void createLayout(); - bool isNmos() const { return _polarity == N; }; - bool isPmos() const { return _polarity == P; }; + bool isNmos() const { return _polarity == Polarity::N; }; + bool isPmos() const { return _polarity == Polarity::P; }; bool isInternal() const { return _abutmentType == INTERNAL; }; bool isLeft() const { return _abutmentType == LEFT; }; bool isRight() const { return _abutmentType == RIGHT; }; bool isSingle() const { return _abutmentType == SINGLE; }; + + virtual Record* _getRecord() const; + protected: void _postCreate(); private: - Net* _drain; Net* _source; Net* _grid; @@ -54,4 +69,23 @@ class Transistor : public Cell { } +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; +} + +INSPECTOR_P_SUPPORT(Hurricane::Transistor); +INSPECTOR_P_SUPPORT(Hurricane::Transistor::Polarity); + #endif // TRANSISTOR_H diff --git a/chamsin/src/technology/ATechnologyXmlParser.cpp b/chamsin/src/technology/ATechnologyXmlParser.cpp index 171578d2..49cb1972 100644 --- a/chamsin/src/technology/ATechnologyXmlParser.cpp +++ b/chamsin/src/technology/ATechnologyXmlParser.cpp @@ -32,7 +32,7 @@ void readPhysicalRules(xmlNode* node, ATechnology* aTechnology) { if (ruleNameC && valueC && refC && layer1C && layer2C) { string ruleName((const char*)ruleNameC); double value = atof((const char*)valueC); - DbU::Unit unitValue= DbU::real(value); + DbU::Unit unitValue= DbU::grid(value); string reference((const char*)refC); Name layer1Name((const char*)layer1C); Name layer2Name((const char*)layer2C); @@ -48,7 +48,7 @@ void readPhysicalRules(xmlNode* node, ATechnology* aTechnology) { if (ruleNameC && valueC && refC) { string ruleName((const char*)ruleNameC); double value = atof((const char*)valueC); - DbU::Unit unitValue= DbU::real(value); + DbU::Unit unitValue= DbU::grid(value); string reference((const char*)refC); if (layerC) { Name layerName((const char*)layerC); diff --git a/chamsin/src/tests/AnalogicTest.cpp b/chamsin/src/tests/AnalogicTest.cpp index c66ad3c8..c3d1063c 100644 --- a/chamsin/src/tests/AnalogicTest.cpp +++ b/chamsin/src/tests/AnalogicTest.cpp @@ -36,7 +36,7 @@ int main(int argc, char* argv[]) { exit(56); } aTechnology->print(); - Transistor* trans = Transistor::create(userLibrary, Name("TEST"), Transistor::P, 10, 10); + Transistor* trans = Transistor::create(userLibrary, Name("TEST"), Transistor::Polarity::P, 10, 10); trans->createLayout(); CellViewer* viewer = new CellViewer ( trans ); viewer->show();