Inspector for AbutmentType

This commit is contained in:
The Coriolis Project 2008-06-23 12:50:47 +00:00
parent 2d08ea4f63
commit b558804b3c
2 changed files with 62 additions and 13 deletions

View File

@ -72,7 +72,19 @@ Record* Transistor::Polarity::_getRecord() const {
return record;
}
Transistor::Transistor(Library* library, const Name& name, const Polarity& polarity, DbU::Unit l, DbU::Unit w):
string Transistor::AbutmentType::_getString() const {
return getString(&_code);
}
Record* Transistor::AbutmentType::_getRecord() const {
Record* record = new Record(getString(this));
record->add(getSlot("Code", &_code));
return record;
}
Transistor::Transistor(Library* library, const Name& name,
const Polarity& polarity, DbU::Unit l, DbU::Unit w,
const AbutmentType& abutmentType):
Cell(library, name),
_drain(NULL),
_source(NULL),
@ -80,7 +92,7 @@ Transistor::Transistor(Library* library, const Name& name, const Polarity& polar
_bulk(NULL),
_anonymous(NULL),
_polarity(polarity),
_abutmentType(),
_abutmentType(abutmentType),
_l(l),
_w(w),
_source20(NULL), _source22(NULL),
@ -90,9 +102,11 @@ Transistor::Transistor(Library* library, const Name& name, const Polarity& polar
{}
Transistor* Transistor::create(Library* library, const Name& name, const Polarity& polarity,
DbU::Unit l, DbU::Unit w) {
Transistor* transistor = new Transistor(library, name, polarity, l, w);
Transistor* Transistor::create(Library* library, const Name& name,
const Polarity& polarity,
DbU::Unit l, DbU::Unit w,
const AbutmentType& abutmentType) {
Transistor* transistor = new Transistor(library, name, polarity, l, w, abutmentType);
transistor->_postCreate();

View File

@ -14,11 +14,26 @@ class Transistor : public Cell {
enum Code {N=0, P=1};
Polarity(const Code& code): _code(code) {}
operator const Code&() const { return _code; };
string _getString() const;
Record* _getRecord() const;
private:
Polarity() {}
Code _code;
};
class AbutmentType {
public:
enum Code {INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3};
AbutmentType(const Code& code): _code(code) {}
operator const Code&() const { return _code; };
string _getString() const;
Record* _getRecord() const;
private:
AbutmentType() {}
Code _code;
};
@ -28,19 +43,19 @@ class Transistor : public Cell {
static const Name BulkName;
static const Name AnonymousName;
enum AbutmentType { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3};
static Transistor* create(Library* library, const Name& name,
const Polarity& polarity,
DbU::Unit l, DbU::Unit w);
DbU::Unit l, DbU::Unit w,
const AbutmentType& abutmentType=AbutmentType::SINGLE);
void createLayout();
bool isNmos() const { return _polarity == Polarity::N; };
bool isPmos() const { return _polarity == 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 isInternal() const { return _abutmentType == AbutmentType::INTERNAL; };
bool isLeft() const { return _abutmentType == AbutmentType::LEFT; };
bool isRight() const { return _abutmentType == AbutmentType::RIGHT; };
bool isSingle() const { return _abutmentType == AbutmentType::SINGLE; };
virtual Record* _getRecord() const;
@ -64,7 +79,8 @@ class Transistor : public Cell {
Transistor(Library* library, const Name& name,
const Polarity& polarity,
DbU::Unit l, DbU::Unit w);
DbU::Unit l, DbU::Unit w,
const AbutmentType& abutmentType);
};
}
@ -85,7 +101,26 @@ template<> inline Hurricane::Record* getRecord<const Hurricane::Transistor::Pola
return record;
}
template<> inline std::string getString<const Hurricane::Transistor::AbutmentType::Code*>
(const Hurricane::Transistor::AbutmentType::Code* object ) {
switch (*object) {
case Hurricane::Transistor::AbutmentType::INTERNAL: return "INTERNAL";
case Hurricane::Transistor::AbutmentType::LEFT: return "LEFT";
case Hurricane::Transistor::AbutmentType::RIGHT: return "RIGHT";
case Hurricane::Transistor::AbutmentType::SINGLE: return "SINGLE";
default: return "ABNORMAL";
}
}
template<> inline Hurricane::Record* getRecord<const Hurricane::Transistor::AbutmentType::Code*>
(const Hurricane::Transistor::AbutmentType::Code* object) {
Hurricane::Record* record = new Hurricane::Record(getString(object));
record->add(getSlot("Code", (unsigned int*)object));
return record;
}
INSPECTOR_P_SUPPORT(Hurricane::Transistor);
INSPECTOR_P_SUPPORT(Hurricane::Transistor::Polarity);
INSPECTOR_P_SUPPORT(Hurricane::Transistor::AbutmentType);
#endif // TRANSISTOR_H