From 643477f270a5b9adc34a19ecfbe09a4df367bab8 Mon Sep 17 00:00:00 2001 From: Christophe Alexandre Date: Mon, 26 May 2008 16:37:14 +0000 Subject: [PATCH] Technology in progress beginning layout of transistor --- chamsin/CMakeLists.txt | 1 + chamsin/etc/CMakeLists.txt | 1 + chamsin/etc/technology.hcmos9.dtr.xml | 7 +++ chamsin/src/analogic/Transistor.cpp | 22 +++++-- chamsin/src/technology/ATechnology.cpp | 57 ++++++++++++++----- chamsin/src/technology/ATechnology.h | 11 +++- .../src/technology/ATechnologyXmlParser.cpp | 2 + 7 files changed, 81 insertions(+), 20 deletions(-) create mode 100644 chamsin/etc/CMakeLists.txt create mode 100644 chamsin/etc/technology.hcmos9.dtr.xml diff --git a/chamsin/CMakeLists.txt b/chamsin/CMakeLists.txt index a62983c1..22a992dc 100644 --- a/chamsin/CMakeLists.txt +++ b/chamsin/CMakeLists.txt @@ -13,3 +13,4 @@ find_package(Qt4 REQUIRED) # find and setup Qt4 for this project find_package(LibXml2 REQUIRED) add_subdirectory(src) +add_subdirectory(etc) diff --git a/chamsin/etc/CMakeLists.txt b/chamsin/etc/CMakeLists.txt new file mode 100644 index 00000000..373440f6 --- /dev/null +++ b/chamsin/etc/CMakeLists.txt @@ -0,0 +1 @@ +install(FILES technology.hcmos9.dtr.xml DESTINATION /share/etc) diff --git a/chamsin/etc/technology.hcmos9.dtr.xml b/chamsin/etc/technology.hcmos9.dtr.xml new file mode 100644 index 00000000..a07f4e53 --- /dev/null +++ b/chamsin/etc/technology.hcmos9.dtr.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/chamsin/src/analogic/Transistor.cpp b/chamsin/src/analogic/Transistor.cpp index 2d2c952b..b2684234 100644 --- a/chamsin/src/analogic/Transistor.cpp +++ b/chamsin/src/analogic/Transistor.cpp @@ -1,3 +1,5 @@ +#include "hurricane/DataBase.h" +#include "hurricane/Technology.h" #include "hurricane/UpdateSession.h" using namespace Hurricane; @@ -5,11 +7,21 @@ using namespace Hurricane; #include "ATechnology.h" #include "Transistor.h" +namespace { + const Name Transistor::DrainName("DRAIN"); const Name Transistor::SourceName("SOURCE"); const Name Transistor::GridName("GRID"); const Name Transistor::BulkName("BULK"); +Contact* createContact(Technology* technology, Net* net, const string& layerName) { + Layer* layer = technology->getLayer(Name(layerName)); + Contact* contact = Contact::create(net, layer, 0, 0); + return contact; +} + +} + Transistor::Transistor(Library* library, const Name& name, const Polarity& polarity): Cell(library, name), _drain(NULL), @@ -37,6 +49,8 @@ Transistor* Transistor::create(Library* library, const Name& name, const Polarit void Transistor::_postCreate() { Inherit::_postCreate(); + DataBase* db = getDataBase(); + Technology* technology = db->getTechnology(); _drain = Net::create(this, DrainName); _drain->setExternal(true); _source = Net::create(this, SourceName); @@ -45,10 +59,10 @@ void Transistor::_postCreate() { _grid->setExternal(true); _bulk = Net::create(this, BulkName); _bulk->setExternal(true); - //_source20 = Contact::create(_source); - //_source22 = Contact::create(_source); - //_drain40 = Contact::create(_drain); - //_drain42 = Contact::create(_drain); + _source20 = createContact(technology, _source, "cut0"); + _source22 = createContact(technology, _source, "cut1"); + _drain40 = createContact(technology, _drain, "cut0"); + _drain42 = createContact(technology, _drain, "cut1"); } void Transistor::createLayout() { diff --git a/chamsin/src/technology/ATechnology.cpp b/chamsin/src/technology/ATechnology.cpp index b771c0ef..b23d7d0f 100644 --- a/chamsin/src/technology/ATechnology.cpp +++ b/chamsin/src/technology/ATechnology.cpp @@ -6,6 +6,17 @@ using namespace Hurricane; namespace { static Name ATechnologyPropertyName("ATechnologyProperty"); +void printPhysicalRules(ATechnology::PhysicalRules& physicalRules) { + for (ATechnology::PhysicalRules::iterator prit = physicalRules.begin(); + prit != physicalRules.end(); + prit++) { + ATechnology::PhysicalRule* physicalRule = *prit; + cout << " - name = " << physicalRule->_name << + ", value = " << physicalRule->_value << + ", ref = " << physicalRule->_reference << endl; + } +} + } Name ATechnology::getName() const { @@ -17,12 +28,13 @@ string ATechnology::_getTypeName() const { } void ATechnology::addPhysicalRule(const Name& name, double value, const string& reference) { - PhysicalRules::iterator prit = _noLayerPhysicalRules.find(name); + PhysicalRule searchPR(name, 0, ""); + PhysicalRules::iterator prit = _noLayerPhysicalRules.find(&searchPR); if (prit != _noLayerPhysicalRules.end()) { throw Error(""); } PhysicalRule* newPhysicalRule = new PhysicalRule(name, value, reference); - _noLayerPhysicalRules[newPhysicalRule->_name] = newPhysicalRule; + _noLayerPhysicalRules.insert(newPhysicalRule); } void ATechnology::addPhysicalRule(const Name& name, const Name& layerName, double value, const string& reference) { @@ -34,14 +46,15 @@ void ATechnology::addPhysicalRule(const Name& name, const Name& layerName, doubl assert(result.second); olprit = result.first; PhysicalRule* newPhysicalRule = new PhysicalRule(name, value, reference); - olprit->second[name] = newPhysicalRule; + olprit->second.insert(newPhysicalRule); } else { PhysicalRules& physicalRules = olprit->second; - if (physicalRules.find(name) != physicalRules.end()) { + PhysicalRule searchPR(name, 0, ""); + if (physicalRules.find(&searchPR) != physicalRules.end()) { throw Error("duplicate rule"); } PhysicalRule* newPhysicalRule = new PhysicalRule(name, value, reference); - physicalRules[name] = newPhysicalRule; + physicalRules.insert(newPhysicalRule); } } @@ -71,29 +84,43 @@ ATechnology* ATechnology::getATechnology(Technology* technology) { void ATechnology::print() { cout << "Printing ATechnology" << endl; cout << " o No Layer Physical Rules" << endl; - for (PhysicalRules::iterator prit = _noLayerPhysicalRules.begin(); - prit != _noLayerPhysicalRules.end(); - prit++) { - PhysicalRule* physicalRule = prit->second; - cout << " - name = " << physicalRule->_name << - ", value = " << physicalRule->_value << - ", ref = " << physicalRule->_reference << endl; + printPhysicalRules(_noLayerPhysicalRules); + cout << endl; + cout << " o One Layer Physical Rules" << endl; + for (OneLayerPhysicalRules::iterator olprit = _oneLayerPhysicalRules.begin(); + olprit != _oneLayerPhysicalRules.end(); + olprit++) { + Layer* layer = olprit->first; + cout << " o layer " << layer << endl; + printPhysicalRules(olprit->second); + cout << endl; + } + for (TwoLayersPhysicalRules::iterator tlprit = _twoLayersPhysicalRules.begin(); + tlprit != _twoLayersPhysicalRules.end(); + tlprit++) { + Layer* layer1 = tlprit->first.first; + Layer* layer2 = tlprit->first.second; + cout << " o layer1 " << layer1 << endl; + cout << " o layer2 " << layer2 << endl; + printPhysicalRules(tlprit->second); + cout << endl; } } const ATechnology::PhysicalRule* ATechnology::getPhysicalRule(const Name& name) { - PhysicalRules::iterator prit = _noLayerPhysicalRules.find(name); + PhysicalRule searchPR(name, 0, ""); + PhysicalRules::iterator prit = _noLayerPhysicalRules.find(&searchPR); if (prit == _noLayerPhysicalRules.end()) { throw Error("Cannot find Physical Rule " + getString(name)); } - return prit->second; + return *prit; } Layer* ATechnology::getLayer(const Name& layerName) { Technology* technology = static_cast(getOwner()); Layer* layer = technology->getLayer(layerName); if (!layer) { - throw Error("cannot find layer"); + throw Error("cannot find layer " + getString(layerName)); } return layer; } diff --git a/chamsin/src/technology/ATechnology.h b/chamsin/src/technology/ATechnology.h index 1bc34ee6..fccbb4fb 100644 --- a/chamsin/src/technology/ATechnology.h +++ b/chamsin/src/technology/ATechnology.h @@ -30,10 +30,19 @@ class ATechnology : public PrivateProperty { const string _reference; double getValue() const { return _value; } }; - typedef map PhysicalRules; + + struct PhysicalRuleNameCompare: + public std::binary_function { + bool operator()(const PhysicalRule* pr1, const PhysicalRule* pr2) const { + return pr1->_name < pr2->_name; + } + }; + + typedef set PhysicalRules; typedef map OneLayerPhysicalRules; typedef pair LayerPair; typedef map TwoLayersPhysicalRules; + static ATechnology* create(Hurricane::Technology* technology); static ATechnology* getATechnology(Hurricane::Technology* technology); const PhysicalRule* getPhysicalRule(const Name& name); diff --git a/chamsin/src/technology/ATechnologyXmlParser.cpp b/chamsin/src/technology/ATechnologyXmlParser.cpp index 9003afb9..a414f699 100644 --- a/chamsin/src/technology/ATechnologyXmlParser.cpp +++ b/chamsin/src/technology/ATechnologyXmlParser.cpp @@ -74,6 +74,8 @@ ATechnology* parseFileAsTechnology(const char* filePath, Technology* technology) if (node->type == XML_ELEMENT_NODE) { if (xmlStrEqual(node->name, (xmlChar*)"physical_rules")) { readPhysicalRules(node, aTechnology); + } else { + syntaxError("unknown tag"); } } }