progressing with Transistor Layout

This commit is contained in:
Christophe Alexandre 2008-05-19 11:34:13 +00:00
parent 53af9ae3b1
commit de62ff741d
9 changed files with 119 additions and 42 deletions

View File

@ -2,7 +2,8 @@ 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(BISON REQUIRED)
FIND_PACKAGE(FLEX REQUIRED) FIND_PACKAGE(FLEX REQUIRED)

View File

@ -1,8 +1,7 @@
INCLUDE_DIRECTORIES(${CHAMSIN_SOURCE_DIR}/src/dtr ${HURRICANE_INCLUDE_DIR} ${source_dir}) INCLUDE_DIRECTORIES(${CHAMSIN_SOURCE_DIR}/src/technology ${HURRICANE_INCLUDE_DIR})
ADD_LIBRARY(analogic SHARED ADD_LIBRARY(analogic SHARED Transistor.cpp)
Transistor.cpp)
TARGET_LINK_LIBRARIES(analogic dtr ${HURRICANE_LIBRARIES}) TARGET_LINK_LIBRARIES(analogic atechnology ${HURRICANE_LIBRARIES})
INSTALL(TARGETS analogic DESTINATION /lib) INSTALL(TARGETS analogic DESTINATION /lib)

View File

@ -1,14 +1,57 @@
#include "UpdateSession.h" #include "UpdateSession.h"
using namespace Hurricane; using namespace Hurricane;
#include "AEnv.h"
#include "ATechnology.h"
#include "Transistor.h" #include "Transistor.h"
void Transistor::createLayout() { const Name Transistor::DrainName("DRAIN");
UpdateSession::open(); const Name Transistor::SourceName("SOURCE");
const Name Transistor::GridName("GRID");
const Name Transistor::BulkName("BULK");
//Net* source = transistor->getSource(); Transistor::Transistor(Library* library, const Name& name, const Polarity& polarity):
//Net* drain = transistor->getDrain(); Cell(library, name),
//Net* grid = transistor->getGrid(); _drain(NULL),
_source(NULL),
_grid(NULL),
_bulk(NULL),
_polarity(polarity),
_abutmentType(),
_l(0.0),
_w(0.0)
{}
Transistor* Transistor::create(Library* library, const Name& name, const Polarity& polarity) {
Transistor* transistor = new Transistor(library, name, polarity);
transistor->_postCreate();
return transistor;
}
void Transistor::_postCreate() {
Inherit::_postCreate();
_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);
}
void Transistor::createLayout() {
ATechnology* techno = AEnv::getATechnology();
Unit rwCont = getUnit(techno->getPhysicalRule("RW_CONT")->getValue());
Unit rdCont = getUnit(techno->getPhysicalRule("RD_CONT")->getValue());
UpdateSession::open();
UpdateSession::close(); UpdateSession::close();
} }

View File

@ -1,6 +1,7 @@
#ifndef TRANSISTOR_H #ifndef TRANSISTOR_H
#define TRANSISTOR_H #define TRANSISTOR_H
#include "Name.h"
#include "Cell.h" #include "Cell.h"
using namespace Hurricane; using namespace Hurricane;
@ -8,24 +9,36 @@ namespace Hurricane {
class Transistor : public Cell { class Transistor : public Cell {
public: public:
static const Name DrainName;
static const Name SourceName;
static const Name GridName;
static const Name BulkName;
enum Polarity {N=0, P=1}; enum Polarity {N=0, P=1};
enum AbutmentType { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3}; enum AbutmentType { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3};
static Transistor* create(Library* library, const Name& name, const Polarity& polarity); static Transistor* create(Library* library, const Name& name, const Polarity& polarity);
void createLayout(); void createLayout();
bool isNmos() const { return polarity == N; }; bool isNmos() const { return _polarity == N; };
bool isPmos() const { return polarity == P; }; bool isPmos() const { return _polarity == P; };
bool isInternal() const { return abutmentType == INTERNAL; }; bool isInternal() const { return _abutmentType == INTERNAL; };
bool isLeft() const { return abutmentType == LEFT; }; bool isLeft() const { return _abutmentType == LEFT; };
bool isRight() const { return abutmentType == RIGHT; }; bool isRight() const { return _abutmentType == RIGHT; };
bool isSingle() const { return abutmentType == SINGLE; }; bool isSingle() const { return _abutmentType == SINGLE; };
protected:
void _postCreate();
private: private:
Polarity polarity; Net* _drain;
AbutmentType abutmentType; Net* _source;
double l; Net* _grid;
double w; Net* _bulk;
Polarity _polarity;
AbutmentType _abutmentType;
double _l;
double _w;
Transistor(Library* library, const Name& name, const Polarity& polarity);
}; };
} }

View File

@ -1,4 +1,5 @@
#include "DataBase.h" #include "DataBase.h"
#include "Library.h"
#include "Technology.h" #include "Technology.h"
using namespace Hurricane; using namespace Hurricane;
@ -13,6 +14,7 @@ void AEnv::create(const char* technoFilePath) {
throw Error(""); throw Error("");
} }
db = DataBase::create(); db = DataBase::create();
Library* rootLibrary = Library::create(db, Name("RootLibrary"));
Technology* techno = Technology::create(db, Name("AnalogicTechnology")); Technology* techno = Technology::create(db, Name("AnalogicTechnology"));
ATechnologyXmlParser::parse(technoFilePath, techno); ATechnologyXmlParser::parse(technoFilePath, techno);
} }

View File

@ -17,12 +17,12 @@ string ATechnology::_getTypeName() const {
} }
void ATechnology::addPhysicalRule(const string& name, double value, const string& reference) { void ATechnology::addPhysicalRule(const string& name, double value, const string& reference) {
PhysicalRules::iterator prit = physicalRules_.find(name); PhysicalRules::iterator prit = _physicalRules.find(name);
if (prit != physicalRules_.end()) { if (prit != _physicalRules.end()) {
throw Error(""); throw Error("");
} }
PhysicalRule* newPhysicalRule = new PhysicalRule(name, value, reference); PhysicalRule* newPhysicalRule = new PhysicalRule(name, value, reference);
physicalRules_[newPhysicalRule->name_] = newPhysicalRule; _physicalRules[newPhysicalRule->_name] = newPhysicalRule;
} }
ATechnology* ATechnology::create(Technology* technology) { ATechnology* ATechnology::create(Technology* technology) {
@ -47,12 +47,20 @@ ATechnology* ATechnology::getATechnology(Technology* technology) {
void ATechnology::print() { void ATechnology::print() {
cout << "Printing ATechnology" << endl; cout << "Printing ATechnology" << endl;
cout << " o Physical Rules" << endl; cout << " o Physical Rules" << endl;
for (PhysicalRules::iterator prit = physicalRules_.begin(); for (PhysicalRules::iterator prit = _physicalRules.begin();
prit != physicalRules_.end(); prit != _physicalRules.end();
prit++) { prit++) {
PhysicalRule* physicalRule = prit->second; PhysicalRule* physicalRule = prit->second;
cout << " - name = " << physicalRule->name_ << cout << " - name = " << physicalRule->_name <<
", value = " << physicalRule->value_ << ", value = " << physicalRule->_value <<
", ref = " << physicalRule->reference_ << endl; ", ref = " << physicalRule->_reference << endl;
} }
} }
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);
}
return prit->second;
}

View File

@ -17,32 +17,35 @@ class ATechnology : public PrivateProperty {
PhysicalRule(const string& name, PhysicalRule(const string& name,
double value, double value,
const string& reference): const string& reference):
name_(name), _name(name),
value_(value), _value(value),
reference_(reference) {} _reference(reference) {}
PhysicalRule(const PhysicalRule& physicalRule): PhysicalRule(const PhysicalRule& physicalRule):
name_(physicalRule.name_), _name(physicalRule._name),
value_(physicalRule.value_), _value(physicalRule._value),
reference_(physicalRule.reference_) {} _reference(physicalRule._reference) {}
const string name_; const string _name;
const double value_; const double _value;
const string reference_; const string _reference;
double getValue() const { return _value; }
}; };
typedef map<string, ATechnology::PhysicalRule*> PhysicalRules; typedef map<string, ATechnology::PhysicalRule*> PhysicalRules;
static ATechnology* create(Hurricane::Technology* technology); static ATechnology* create(Hurricane::Technology* technology);
static ATechnology* getATechnology(Hurricane::Technology* technology); static ATechnology* getATechnology(Hurricane::Technology* technology);
const PhysicalRule* getPhysicalRule(string name); const PhysicalRule* getPhysicalRule(const string& name);
void addPhysicalRule(const string& name, double value, const string& reference); void addPhysicalRule(const string& name, double value, const string& reference);
void print(); void print();
virtual Name getName() const; virtual Name getName() const;
virtual string _getTypeName() const; virtual string _getTypeName() const;
ATechnology(): ATechnology():
Inherit(), Inherit(),
physicalRules_() {} _physicalRules() {}
private: private:
PhysicalRules physicalRules_; PhysicalRules _physicalRules;
}; };
#endif /* ATECHNOLOGY_H_*/ #endif /* ATECHNOLOGY_H_*/

View File

@ -1,12 +1,14 @@
#include <iostream> #include <iostream>
#include "DBo.h"
#include "Warning.h" #include "Warning.h"
#include "Error.h" #include "Error.h"
#include "DataBase.h"
#include "Library.h"
using namespace Hurricane; using namespace Hurricane;
#include "AEnv.h" #include "AEnv.h"
#include "ATechnology.h" #include "ATechnology.h"
#include "Transistor.h"
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@ -17,11 +19,17 @@ int main(int argc, char* argv[]) {
exit(56); exit(56);
} }
AEnv::create(argv[1]); AEnv::create(argv[1]);
DataBase* db = getDataBase();
Library* rootLibrary = db->getRootLibrary();
Library* userLibrary = Library::create(rootLibrary, Name("USER"));
ATechnology* aTechnology = AEnv::getATechnology(); ATechnology* aTechnology = AEnv::getATechnology();
if (!aTechnology) { if (!aTechnology) {
exit(56); exit(56);
} }
aTechnology->print(); aTechnology->print();
Transistor* trans = Transistor::create(userLibrary, Name("TEST"), Transistor::P);
cerr << trans << endl;
exit(0); exit(0);
} catch (Hurricane::Warning& w) { } catch (Hurricane::Warning& w) {
cerr << w.what() << endl; cerr << w.what() << endl;

View File

@ -4,6 +4,6 @@ ${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 ${HURRICANE_LIBRARIES}) TARGET_LINK_LIBRARIES(atest atechnology analogic ${HURRICANE_LIBRARIES})
INSTALL(TARGETS atest DESTINATION /bin) INSTALL(TARGETS atest DESTINATION /bin)