From 14090f45ab4ec11501d8c7d6ae20a3af4d8f7b1e Mon Sep 17 00:00:00 2001 From: Christophe Alexandre Date: Tue, 24 Jun 2008 11:14:40 +0000 Subject: [PATCH] using the new Inspector Framework --- chamsin/src/technology/AEnv.cpp | 9 +++- chamsin/src/technology/AEnv.h | 5 ++- chamsin/src/technology/ATechnology.cpp | 42 +++++++++++++++++++ chamsin/src/technology/ATechnology.h | 32 ++++++++++++++ .../src/technology/ATechnologyXmlParser.cpp | 10 ++++- chamsin/src/tests/AnalogicTest.cpp | 6 +-- 6 files changed, 96 insertions(+), 8 deletions(-) diff --git a/chamsin/src/technology/AEnv.cpp b/chamsin/src/technology/AEnv.cpp index 02599b3d..1a945483 100644 --- a/chamsin/src/technology/AEnv.cpp +++ b/chamsin/src/technology/AEnv.cpp @@ -5,6 +5,7 @@ using namespace Hurricane; #include "crlcore/GraphicsParser.h" #include "crlcore/SymbolicTechnologyParser.h" +#include "crlcore/RealTechnologyParser.h" using namespace CRL; #include "ATechnology.h" @@ -12,13 +13,17 @@ using namespace CRL; #include "AEnv.h" -void AEnv::create(const char* technoFilePath, const char* graphicFilePath, const char* analogTechnoFilePath) { +void AEnv::create(const char* symbTechnoFilePath, + const char* realTechnoFilePath, + const char* graphicFilePath, + const char* analogTechnoFilePath) { DataBase* db = DataBase::getDB(); if (db) { throw Error(""); } db = DataBase::create(); - SymbolicTechnologyParser::load(db, technoFilePath); + SymbolicTechnologyParser::load(db, symbTechnoFilePath); + RealTechnologyParser::load(db, realTechnoFilePath); GraphicsParser::load(graphicFilePath); Library* rootLibrary = Library::create(db, Name("RootLibrary")); diff --git a/chamsin/src/technology/AEnv.h b/chamsin/src/technology/AEnv.h index 585f87ed..0d412da9 100644 --- a/chamsin/src/technology/AEnv.h +++ b/chamsin/src/technology/AEnv.h @@ -5,7 +5,10 @@ class ATechnology; class AEnv { public: - static void create(const char* technoFilePath, const char* graphicFilePath, const char* analogTechnoFilePath); + static void create(const char* symbTechnoFilePath, + const char* realTechnoFilePath, + const char* graphicFilePath, + const char* analogTechnoFilePath); static ATechnology* getATechnology(); }; diff --git a/chamsin/src/technology/ATechnology.cpp b/chamsin/src/technology/ATechnology.cpp index 2c56e529..143aa51a 100644 --- a/chamsin/src/technology/ATechnology.cpp +++ b/chamsin/src/technology/ATechnology.cpp @@ -32,6 +32,38 @@ void printPhysicalRules(const ATechnology::TwoLayersPhysicalRulesSet& physicalRu } +string ATechnology::PhysicalRule::_getTypeName() const { + return "PhysicalRule"; +} + +string ATechnology::PhysicalRule::_getString() const { + return "<" + _getTypeName() + " " + getString(_name) + ">"; +} + +Record* ATechnology::PhysicalRule::_getRecord() const { + Record* record = new Record(getString(this)); + record->add(getSlot("Name", &_name)); + record->add(getSlot("Value", &_value)); + record->add(getSlot("Reference", &_reference)); + return record; +} + +string ATechnology::TwoLayersPhysicalRule::_getTypeName() const { + return "TwoLayersPhysicalRule"; +} + +string ATechnology::TwoLayersPhysicalRule::_getString() const { + return "<" + _getTypeName() + " " + getString(_name) + ">"; +} + +Record* ATechnology::TwoLayersPhysicalRule::_getRecord() const { + Record* record = Inherit::_getRecord(); + if (record) { + record->add(getSlot("Symetric", _symetric)); + } + return record; +} + Name ATechnology::getName() const { return ATechnologyPropertyName; } @@ -40,6 +72,16 @@ string ATechnology::_getTypeName() const { return _TName("ATechnologyProperty"); } +Record* ATechnology::_getRecord() const { + Record* record = Inherit::_getRecord(); + if (record) { + record->add(getSlot("NoLayerPhysicalRules", &_noLayerPhysicalRules)); + record->add(getSlot("OneLayerPhysicalRules", &_oneLayerPhysicalRules)); + record->add(getSlot("TwoLayersPhysicalRules", &_twoLayersPhysicalRules)); + } + return record; +} + void ATechnology::addPhysicalRule(const Name& name, DbU::Unit value, const string& reference) { PhysicalRule searchPR(name, 0, ""); PhysicalRules::iterator prit = _noLayerPhysicalRules.find(&searchPR); diff --git a/chamsin/src/technology/ATechnology.h b/chamsin/src/technology/ATechnology.h index f8167034..f68e1872 100644 --- a/chamsin/src/technology/ATechnology.h +++ b/chamsin/src/technology/ATechnology.h @@ -29,10 +29,16 @@ class ATechnology : public PrivateProperty { const DbU::Unit _value; const string _reference; double getValue() const { return _value; } + + string _getTypeName() const; + string _getString() const; + Record* _getRecord() const; }; class TwoLayersPhysicalRule : public PhysicalRule { public: + typedef PhysicalRule Inherit; + TwoLayersPhysicalRule(const Name& name, DbU::Unit value, const string& reference, @@ -42,6 +48,10 @@ class ATechnology : public PrivateProperty { bool isSymetric() const { return _symetric; } const bool _symetric; + + string _getTypeName() const; + string _getString() const; + Record* _getRecord() const; }; struct PhysicalRuleNameCompare: @@ -73,6 +83,7 @@ class ATechnology : public PrivateProperty { virtual Name getName() const; virtual string _getTypeName() const; + virtual Record* _getRecord() const; ATechnology(): Inherit(), @@ -86,4 +97,25 @@ class ATechnology : public PrivateProperty { TwoLayersPhysicalRules _twoLayersPhysicalRules; }; + +// ------------------------------------------------------------------- +// Inspector Support for : "ATechnology::LayerPair&". + +template<> +inline std::string getString (ATechnology::LayerPair& lp) { + return "add(getSlot("Layer2", lp.second)); + return record; +} + +INSPECTOR_P_SUPPORT(ATechnology); +INSPECTOR_P_SUPPORT(ATechnology::PhysicalRule); +INSPECTOR_P_SUPPORT(ATechnology::TwoLayersPhysicalRule); + #endif /* ATECHNOLOGY_H_*/ diff --git a/chamsin/src/technology/ATechnologyXmlParser.cpp b/chamsin/src/technology/ATechnologyXmlParser.cpp index 49cb1972..a1a4eab4 100644 --- a/chamsin/src/technology/ATechnologyXmlParser.cpp +++ b/chamsin/src/technology/ATechnologyXmlParser.cpp @@ -17,6 +17,11 @@ void syntaxError(const string& reason) { throw Error(reason); } +DbU::Unit getUnitValue(double physicalValue) { + cerr << "akecoucou : " << DbU::getPhysicalsPerGrid() << endl; + return DbU::grid(DbU::physicalToGrid(physicalValue, DbU::Micro)); +} + void readPhysicalRules(xmlNode* node, ATechnology* aTechnology) { if (node->type == XML_ELEMENT_NODE && node->children) { for (xmlNode* ruleNode = node->children; @@ -32,7 +37,8 @@ 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::grid(value); + DbU::Unit unitValue = getUnitValue(value); + cerr << value << ", " << unitValue << endl; string reference((const char*)refC); Name layer1Name((const char*)layer1C); Name layer2Name((const char*)layer2C); @@ -48,7 +54,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::grid(value); + DbU::Unit unitValue = getUnitValue(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 c3d1063c..5fc0add6 100644 --- a/chamsin/src/tests/AnalogicTest.cpp +++ b/chamsin/src/tests/AnalogicTest.cpp @@ -22,11 +22,11 @@ int main(int argc, char* argv[]) { QApplication* qa = new QApplication(argc, argv); cout << "simple analogic test" << endl; - if (argc != 4) { - cerr << "atest techno.xml graphic.xml anatechno.xml"; + if (argc != 5) { + cerr << "atest symbtechno.xml s2rtechno.xml graphic.xml anatechno.xml"; exit(56); } - AEnv::create(argv[1], argv[2], argv[3]); + AEnv::create(argv[1], argv[2], argv[3], argv[4]); DataBase* db = DataBase::getDB(); Library* rootLibrary = db->getRootLibrary(); Library* userLibrary = Library::create(rootLibrary, Name("USER"));