Technology in progress

This commit is contained in:
Christophe Alexandre 2008-05-19 19:32:21 +00:00
parent de62ff741d
commit ecef0bb749
11 changed files with 133 additions and 43 deletions

View File

@ -1,14 +1,15 @@
PROJECT(CHAMSIN)
project(CHAMSIN)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0)
cmake_minimum_required(VERSION 2.4.0)
SET(CMAKE_MODULE_PATH "$ENV{HURRICANE_TOP}/share/cmake_modules/"
set(CMAKE_MODULE_PATH "$ENV{HURRICANE_TOP}/share/cmake_modules/"
"$ENV{HURRICANE_TOP}/share/cmake_modules/")
FIND_PACKAGE(BISON REQUIRED)
FIND_PACKAGE(FLEX REQUIRED)
FIND_PACKAGE(HURRICANE REQUIRED)
FIND_PACKAGE(CORIOLIS REQUIRED)
FIND_PACKAGE(LibXml2 REQUIRED)
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(CORIOLIS REQUIRED)
find_package(Qt4 REQUIRED) # find and setup Qt4 for this project
find_package(LibXml2 REQUIRED)
ADD_SUBDIRECTORY(src)
add_subdirectory(src)

View File

@ -19,7 +19,11 @@ Transistor::Transistor(Library* library, const Name& name, const Polarity& polar
_polarity(polarity),
_abutmentType(),
_l(0.0),
_w(0.0)
_w(0.0),
_source20(NULL),
_source22(NULL),
_drain40(NULL),
_drain42(NULL)
{}
@ -41,6 +45,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);
}
void Transistor::createLayout() {

View File

@ -37,6 +37,10 @@ class Transistor : public Cell {
AbutmentType _abutmentType;
double _l;
double _w;
Contact* _source20;
Contact* _source22;
Contact* _drain40;
Contact* _drain42;
Transistor(Library* library, const Name& name, const Polarity& polarity);
};

View File

@ -3,20 +3,27 @@
#include "Technology.h"
using namespace Hurricane;
#include "crlcore/GraphicsParser.h"
#include "crlcore/TechnologyParser.h"
using namespace CRL;
#include "ATechnology.h"
#include "ATechnologyXmlParser.h"
#include "AEnv.h"
void AEnv::create(const char* technoFilePath) {
void AEnv::create(const char* technoFilePath, const char* graphicFilePath, const char* analogTechnoFilePath) {
DataBase* db = getDataBase();
if (db) {
throw Error("");
}
db = DataBase::create();
TechnologyParser::load(db, technoFilePath);
GraphicsParser::load(graphicFilePath);
Library* rootLibrary = Library::create(db, Name("RootLibrary"));
Technology* techno = Technology::create(db, Name("AnalogicTechnology"));
ATechnologyXmlParser::parse(technoFilePath, techno);
Technology* techno = db->getTechnology();
ATechnologyXmlParser::parse(analogTechnoFilePath, techno);
}
ATechnology* AEnv::getATechnology() {

View File

@ -5,7 +5,7 @@ class ATechnology;
class AEnv {
public:
static void create(const char* technoFilePath);
static void create(const char* technoFilePath, const char* graphicFilePath, const char* analogTechnoFilePath);
static ATechnology* getATechnology();
};

View File

@ -1,11 +1,11 @@
#include "Technology.h"
#include "Property.h"
using namespace Hurricane;
#include "ATechnology.h"
namespace {
static Name ATechnologyPropertyName("ATechnologyProperty");
}
Name ATechnology::getName() const {
@ -16,13 +16,37 @@ string ATechnology::_getTypeName() const {
return _TName("ATechnologyProperty");
}
void ATechnology::addPhysicalRule(const string& name, double value, const string& reference) {
PhysicalRules::iterator prit = _physicalRules.find(name);
if (prit != _physicalRules.end()) {
void ATechnology::addPhysicalRule(const Name& name, double value, const string& reference) {
PhysicalRules::iterator prit = _noLayerPhysicalRules.find(name);
if (prit != _noLayerPhysicalRules.end()) {
throw Error("");
}
PhysicalRule* newPhysicalRule = new PhysicalRule(name, value, reference);
_physicalRules[newPhysicalRule->_name] = newPhysicalRule;
_noLayerPhysicalRules[newPhysicalRule->_name] = newPhysicalRule;
}
void ATechnology::addPhysicalRule(const Name& name, const Name& layerName, double value, const string& reference) {
Layer* layer = getLayer(layerName);
OneLayerPhysicalRules::iterator olprit = _oneLayerPhysicalRules.find(layer);
if (olprit == _oneLayerPhysicalRules.end()) {
pair<OneLayerPhysicalRules::iterator, bool> result =
_oneLayerPhysicalRules.insert(make_pair(layer, PhysicalRules()));
assert(result.second);
olprit = result.first;
PhysicalRule* newPhysicalRule = new PhysicalRule(name, value, reference);
olprit->second[name] = newPhysicalRule;
} else {
PhysicalRules& physicalRules = olprit->second;
if (physicalRules.find(name) != physicalRules.end()) {
throw Error("duplicate rule");
}
PhysicalRule* newPhysicalRule = new PhysicalRule(name, value, reference);
physicalRules[name] = newPhysicalRule;
}
}
void ATechnology::addPhysicalRule(const Name& name, const Name& layer1Name,
const Name& layer2Name, double value, const string& reference) {
}
ATechnology* ATechnology::create(Technology* technology) {
@ -46,9 +70,9 @@ ATechnology* ATechnology::getATechnology(Technology* technology) {
void ATechnology::print() {
cout << "Printing ATechnology" << endl;
cout << " o Physical Rules" << endl;
for (PhysicalRules::iterator prit = _physicalRules.begin();
prit != _physicalRules.end();
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 <<
@ -57,10 +81,19 @@ void ATechnology::print() {
}
}
const ATechnology::PhysicalRule* ATechnology::getPhysicalRule(const string& name) {
PhysicalRules::iterator prit = _physicalRules.find(name);
if (prit == _physicalRules.end()) {
throw Error("Cannot find Physical Rule " + name);
const ATechnology::PhysicalRule* ATechnology::getPhysicalRule(const Name& name) {
PhysicalRules::iterator prit = _noLayerPhysicalRules.find(name);
if (prit == _noLayerPhysicalRules.end()) {
throw Error("Cannot find Physical Rule " + getString(name));
}
return prit->second;
}
Layer* ATechnology::getLayer(const Name& layerName) {
Technology* technology = static_cast<Technology*>(getOwner());
Layer* layer = technology->getLayer(layerName);
if (!layer) {
throw Error("cannot find layer");
}
return layer;
}

View File

@ -6,6 +6,7 @@ using namespace Hurricane;
namespace Hurricane {
class Technology;
class Layer;
}
class ATechnology : public PrivateProperty {
@ -14,7 +15,7 @@ class ATechnology : public PrivateProperty {
class PhysicalRule {
public:
PhysicalRule(const string& name,
PhysicalRule(const Name& name,
double value,
const string& reference):
_name(name),
@ -24,16 +25,23 @@ class ATechnology : public PrivateProperty {
_name(physicalRule._name),
_value(physicalRule._value),
_reference(physicalRule._reference) {}
const string _name;
const Name _name;
const double _value;
const string _reference;
double getValue() const { return _value; }
};
typedef map<string, ATechnology::PhysicalRule*> PhysicalRules;
typedef map<Name, ATechnology::PhysicalRule*> PhysicalRules;
typedef map<Layer*, PhysicalRules> OneLayerPhysicalRules;
typedef pair<Layer*, Layer*> LayerPair;
typedef map<LayerPair, PhysicalRules> TwoLayersPhysicalRules;
static ATechnology* create(Hurricane::Technology* technology);
static ATechnology* getATechnology(Hurricane::Technology* technology);
const PhysicalRule* getPhysicalRule(const string& name);
void addPhysicalRule(const string& name, double value, const string& reference);
const PhysicalRule* getPhysicalRule(const Name& name);
void addPhysicalRule(const Name& name, double value, const string& reference);
void addPhysicalRule(const Name& name, const Name& layerName, double value, const string& reference);
void addPhysicalRule(const Name& name, const Name& layer1Name,
const Name& layer2Name, double value, const string& reference);
Layer* getLayer(const Name& layerName);
void print();
virtual Name getName() const;
@ -42,10 +50,14 @@ class ATechnology : public PrivateProperty {
ATechnology():
Inherit(),
_physicalRules() {}
_noLayerPhysicalRules(),
_oneLayerPhysicalRules(),
_twoLayersPhysicalRules() {}
private:
PhysicalRules _physicalRules;
PhysicalRules _noLayerPhysicalRules;
OneLayerPhysicalRules _oneLayerPhysicalRules;
TwoLayersPhysicalRules _twoLayersPhysicalRules;
};
#endif /* ATECHNOLOGY_H_*/

View File

@ -11,6 +11,10 @@ using namespace Hurricane;
namespace {
void syntaxError(const string& reason) {
throw Error(reason);
}
void readPhysicalRules(xmlNode* node, ATechnology* aTechnology) {
if (node->type == XML_ELEMENT_NODE && node->children) {
for (xmlNode* ruleNode = node->children;
@ -21,11 +25,25 @@ void readPhysicalRules(xmlNode* node, ATechnology* aTechnology) {
xmlChar* ruleNameC = xmlGetProp(ruleNode, (xmlChar*)"name");
xmlChar* valueC = xmlGetProp(ruleNode, (xmlChar*)"value");
xmlChar* refC = xmlGetProp(ruleNode, (xmlChar*)"ref");
xmlChar* layerC = xmlGetProp(ruleNode, (xmlChar*)"layer");
xmlChar* layer1C = xmlGetProp(ruleNode, (xmlChar*)"layer1");
xmlChar* layer2C = xmlGetProp(ruleNode, (xmlChar*)"layer2");
if (ruleNameC && valueC && refC) {
string ruleName((const char*)ruleNameC);
double value = atof((const char*)valueC);
string reference((const char*)refC);
aTechnology->addPhysicalRule(ruleName, value, reference);
if (layerC) {
Name layerName((const char*)layerC);
aTechnology->addPhysicalRule(ruleName, layerName, value, reference);
} else if (layer1C && layer2C) {
Name layer1Name((const char*)layer1C);
Name layer2Name((const char*)layer2C);
aTechnology->addPhysicalRule(ruleName, layer1Name, layer2Name, value, reference);
} else {
aTechnology->addPhysicalRule(ruleName, value, reference);
}
} else {
syntaxError("");
}
}
}

View File

@ -1,8 +1,8 @@
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${HURRICANE_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${HURRICANE_INCLUDE_DIR} ${CORIOLIS_INCLUDE_DIR})
ADD_LIBRARY(atechnology SHARED
AEnv.cpp ATechnology.cpp ATechnologyXmlParser.cpp)
TARGET_LINK_LIBRARIES(atechnology ${HURRICANE_LIBRARIES} ${LIBXML2_LIBRARIES})
TARGET_LINK_LIBRARIES(atechnology ${HURRICANE_LIBRARIES} ${CORIOLIS_LIBRARIES} ${LIBXML2_LIBRARIES})
INSTALL(TARGETS atechnology DESTINATION /lib)

View File

@ -1,5 +1,7 @@
#include <iostream>
#include <QApplication>
#include "Warning.h"
#include "Error.h"
#include "DataBase.h"
@ -13,12 +15,15 @@ using namespace Hurricane;
int main(int argc, char* argv[]) {
try {
QApplication* qa = new QApplication(argc, argv);
cout << "simple analogic test" << endl;
if (argc != 2) {
cerr << "atest techno.xml";
if (argc != 4) {
cerr << "atest techno.xml graphic.xml anatechno.xml";
exit(56);
}
AEnv::create(argv[1]);
AEnv::create(argv[1], argv[2], argv[3]);
DataBase* db = getDataBase();
Library* rootLibrary = db->getRootLibrary();
Library* userLibrary = Library::create(rootLibrary, Name("USER"));

View File

@ -1,9 +1,11 @@
INCLUDE_DIRECTORIES(${HURRICANE_INCLUDE_DIR} ${CORIOLIS_INCLUDE_DIR}
include(${QT_USE_FILE})
include_directories(${HURRICANE_INCLUDE_DIR} ${CORIOLIS_INCLUDE_DIR}
${CHAMSIN_SOURCE_DIR}/src/technology
${CHAMSIN_SOURCE_DIR}/src/analogic ${CHAMSIN_SOURCE_DIR}/src/device)
ADD_EXECUTABLE(atest AnalogicTest.cpp)
add_executable(atest AnalogicTest.cpp)
TARGET_LINK_LIBRARIES(atest atechnology analogic ${HURRICANE_LIBRARIES})
target_link_libraries(atest atechnology analogic ${HURRICANE_LIBRARIES} ${QT_LIBRARIES})
INSTALL(TARGETS atest DESTINATION /bin)
install(TARGETS atest DESTINATION /bin)