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)
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)

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
Transistor.cpp)
ADD_LIBRARY(analogic SHARED Transistor.cpp)
TARGET_LINK_LIBRARIES(analogic dtr ${HURRICANE_LIBRARIES})
TARGET_LINK_LIBRARIES(analogic atechnology ${HURRICANE_LIBRARIES})
INSTALL(TARGETS analogic DESTINATION /lib)

View File

@ -1,14 +1,57 @@
#include "UpdateSession.h"
using namespace Hurricane;
#include "AEnv.h"
#include "ATechnology.h"
#include "Transistor.h"
const Name Transistor::DrainName("DRAIN");
const Name Transistor::SourceName("SOURCE");
const Name Transistor::GridName("GRID");
const Name Transistor::BulkName("BULK");
Transistor::Transistor(Library* library, const Name& name, const Polarity& polarity):
Cell(library, name),
_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();
//Net* source = transistor->getSource();
//Net* drain = transistor->getDrain();
//Net* grid = transistor->getGrid();
UpdateSession::close();
}

View File

@ -1,6 +1,7 @@
#ifndef TRANSISTOR_H
#define TRANSISTOR_H
#include "Name.h"
#include "Cell.h"
using namespace Hurricane;
@ -8,24 +9,36 @@ namespace Hurricane {
class Transistor : public Cell {
public:
static const Name DrainName;
static const Name SourceName;
static const Name GridName;
static const Name BulkName;
enum Polarity {N=0, P=1};
enum AbutmentType { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3};
static Transistor* create(Library* library, const Name& name, const Polarity& polarity);
void createLayout();
bool isNmos() const { return polarity == N; };
bool isPmos() const { return 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; };
bool isNmos() const { return _polarity == N; };
bool isPmos() const { return _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; };
protected:
void _postCreate();
private:
Polarity polarity;
AbutmentType abutmentType;
double l;
double w;
Net* _drain;
Net* _source;
Net* _grid;
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 "Library.h"
#include "Technology.h"
using namespace Hurricane;
@ -13,6 +14,7 @@ void AEnv::create(const char* technoFilePath) {
throw Error("");
}
db = DataBase::create();
Library* rootLibrary = Library::create(db, Name("RootLibrary"));
Technology* techno = Technology::create(db, Name("AnalogicTechnology"));
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) {
PhysicalRules::iterator prit = physicalRules_.find(name);
if (prit != physicalRules_.end()) {
PhysicalRules::iterator prit = _physicalRules.find(name);
if (prit != _physicalRules.end()) {
throw Error("");
}
PhysicalRule* newPhysicalRule = new PhysicalRule(name, value, reference);
physicalRules_[newPhysicalRule->name_] = newPhysicalRule;
_physicalRules[newPhysicalRule->_name] = newPhysicalRule;
}
ATechnology* ATechnology::create(Technology* technology) {
@ -47,12 +47,20 @@ 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();
for (PhysicalRules::iterator prit = _physicalRules.begin();
prit != _physicalRules.end();
prit++) {
PhysicalRule* physicalRule = prit->second;
cout << " - name = " << physicalRule->name_ <<
", value = " << physicalRule->value_ <<
", ref = " << physicalRule->reference_ << endl;
cout << " - name = " << physicalRule->_name <<
", value = " << physicalRule->_value <<
", 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,
double value,
const string& reference):
name_(name),
value_(value),
reference_(reference) {}
_name(name),
_value(value),
_reference(reference) {}
PhysicalRule(const PhysicalRule& physicalRule):
name_(physicalRule.name_),
value_(physicalRule.value_),
reference_(physicalRule.reference_) {}
const string name_;
const double value_;
const string reference_;
_name(physicalRule._name),
_value(physicalRule._value),
_reference(physicalRule._reference) {}
const string _name;
const double _value;
const string _reference;
double getValue() const { return _value; }
};
typedef map<string, ATechnology::PhysicalRule*> PhysicalRules;
static ATechnology* create(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 print();
virtual Name getName() const;
virtual string _getTypeName() const;
ATechnology():
Inherit(),
physicalRules_() {}
_physicalRules() {}
private:
PhysicalRules physicalRules_;
PhysicalRules _physicalRules;
};
#endif /* ATECHNOLOGY_H_*/

View File

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