get rid of is_a, dynamic_cast is far more powerful then #define...
This commit is contained in:
parent
4c4c8d3553
commit
4e134275f6
|
@ -18,7 +18,8 @@ Pad* createPad(Technology* technology, Net* net, const string& layerName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void createContactMatrix(Net* net, const Layer* layer, const Box& box, unsigned columns, const Unit& rwCont, const Unit& rdCont) {
|
void createContactMatrix(Net* net, const Layer* layer, const Box& box, unsigned columns,
|
||||||
|
const DbU::Unit& rwCont, const DbU::Unit& rdCont) {
|
||||||
unsigned contacts = 0;
|
unsigned contacts = 0;
|
||||||
if (box.getHeight() < rwCont) {
|
if (box.getHeight() < rwCont) {
|
||||||
contacts = 0;
|
contacts = 0;
|
||||||
|
@ -63,8 +64,8 @@ Transistor::Transistor(Library* library, const Name& name, const Polarity& polar
|
||||||
_bulk(NULL),
|
_bulk(NULL),
|
||||||
_polarity(polarity),
|
_polarity(polarity),
|
||||||
_abutmentType(),
|
_abutmentType(),
|
||||||
_l(0.0),
|
_l(DbU::Min),
|
||||||
_w(0.0),
|
_w(DbU::Min),
|
||||||
_source20(NULL), _source22(NULL),
|
_source20(NULL), _source22(NULL),
|
||||||
_drain40(NULL), _drain42(NULL),
|
_drain40(NULL), _drain42(NULL),
|
||||||
_grid00(NULL), _grid01(NULL), _grid30(NULL), _grid31(NULL)
|
_grid00(NULL), _grid01(NULL), _grid30(NULL), _grid31(NULL)
|
||||||
|
@ -105,57 +106,57 @@ void Transistor::_postCreate() {
|
||||||
void Transistor::createLayout() {
|
void Transistor::createLayout() {
|
||||||
ATechnology* techno = AEnv::getATechnology();
|
ATechnology* techno = AEnv::getATechnology();
|
||||||
|
|
||||||
Unit rwCont = getUnit(techno->getPhysicalRule("RW_CONT")->getValue());
|
DbU::Unit rwCont = DbU::real(techno->getPhysicalRule("RW_CONT")->getValue());
|
||||||
Unit rdCont = getUnit(techno->getPhysicalRule("RD_CONT")->getValue());
|
DbU::Unit rdCont = DbU::real(techno->getPhysicalRule("RD_CONT")->getValue());
|
||||||
Unit reGateActiv = getUnit(techno->getPhysicalRule("RE", getLayer("poly"), getLayer("active"))->getValue());
|
DbU::Unit reGateActiv = DbU::real(techno->getPhysicalRule("RE", getLayer("poly"), getLayer("active"))->getValue());
|
||||||
Unit rePolyCont = getUnit(techno->getPhysicalRule("RE", getLayer("poly"), getLayer("cut"))->getValue());
|
DbU::Unit rePolyCont = DbU::real(techno->getPhysicalRule("RE", getLayer("poly"), getLayer("cut"))->getValue());
|
||||||
Unit rdActiveCont = getUnit("RD", getLayer("active"), getLayer("cut"));
|
DbU::Unit rdActiveCont = DbU::real(techno->getPhysicalRule("RD", getLayer("active"), getLayer("cut"))->getValue());
|
||||||
Unit rdActivePoly = getUnit("RD", getLayer("active"), getLayer("poly"));
|
DbU::Unit rdActivePoly = DbU::real(techno->getPhysicalRule("RD", getLayer("active"), getLayer("poly"))->getValue());
|
||||||
|
|
||||||
UpdateSession::open();
|
UpdateSession::open();
|
||||||
|
|
||||||
//grid 00
|
//grid 00
|
||||||
Unit y00 = -reGateActiv;
|
DbU::Unit x00 = 0;
|
||||||
Unit dx00 = _l;
|
DbU::Unit y00 = -reGateActiv;
|
||||||
Unit dy00 = _w - y00*2;
|
DbU::Unit dx00 = _l;
|
||||||
Box box00(0, y00, dx00, dy00);
|
DbU::Unit dy00 = _w - y00*2;
|
||||||
|
Box box00(x00, y00, dx00, dy00);
|
||||||
_grid00->setBoundingBox(box00);
|
_grid00->setBoundingBox(box00);
|
||||||
|
|
||||||
//grid30
|
//grid30
|
||||||
Unit toto = rwCont + 2*rePolyCont;
|
DbU::Unit toto = rwCont + 2*rePolyCont;
|
||||||
Unit dx30 = 0, dy30 = 0;
|
DbU::Unit x30 = 0, dx30 = 0, y30 = 0, dy30 = 0;
|
||||||
if (toto > _l) {
|
if (toto > _l) {
|
||||||
dx30 = rwCont;
|
dx30 = rwCont;
|
||||||
dy30 = dx30;
|
dy30 = dx30;
|
||||||
y30 = _w + Unit::max(rdActiveCont, rdAvtivePoly + rePolyCont);
|
y30 = _w + DbU::max(rdActiveCont, rdActivePoly + rePolyCont);
|
||||||
} else {
|
} else {
|
||||||
dx30 = dx00 - 2*rePolyCont;
|
dx30 = dx00 - 2*rePolyCont;
|
||||||
dy30 = rwCont;
|
dy30 = rwCont;
|
||||||
y30 = _w + rdActiveCont;
|
y30 = _w + rdActiveCont;
|
||||||
}
|
}
|
||||||
Unit x30 = x00 + dx00/2 - dx30/2;
|
x30 = x00 + dx00/2 - dx30/2;
|
||||||
Box box30(x30, y30, dx30, dy30);
|
Box box30(x30, y30, dx30, dy30);
|
||||||
_grid30->setBoundingBox(box30);
|
_grid30->setBoundingBox(box30);
|
||||||
|
|
||||||
//grid31
|
//grid31
|
||||||
Unit dx31 = dx30 + 2*rePolyCont;
|
DbU::Unit dx31 = dx30 + 2*rePolyCont;
|
||||||
Unit dy31 = dy30 + 2*rePolyCont;
|
DbU::Unit dy31 = dy30 + 2*rePolyCont;
|
||||||
Unit x31 = x30 - rePolyCont;
|
DbU::Unit x31 = x30 - rePolyCont;
|
||||||
Unit y31 = y30 - rePolyCont;
|
DbU::Unit y31 = y30 - rePolyCont;
|
||||||
Box box31(x31, y31, dx31, dy31);
|
Box box31(x31, y31, dx31, dy31);
|
||||||
_grid31->setBoundingBox(box31);
|
_grid31->setBoundingBox(box31);
|
||||||
|
|
||||||
//grid01
|
//grid01
|
||||||
|
DbU::Unit x01 = 0, y01 = 0, dx01 = 0, dy01 = 0;
|
||||||
if (y31 <= y00+dy00) {
|
if (y31 <= y00+dy00) {
|
||||||
x01 = 0; y01 = 0; dx01 = 0; dy01 = 0;
|
x01 = 0; y01 = 0; dx01 = 0; dy01 = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
x01 = x00;
|
x01 = x00;
|
||||||
y01 = y00 + dy00;
|
y01 = y00 + dy00;
|
||||||
dx01 = dx00;
|
dx01 = dx00;
|
||||||
dy01 = y31 - (y00 + dy00);
|
dy01 = y31 - (y00 + dy00);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UpdateSession::close();
|
UpdateSession::close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,14 +29,15 @@ class Transistor : public Cell {
|
||||||
void _postCreate();
|
void _postCreate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Net* _drain;
|
Net* _drain;
|
||||||
Net* _source;
|
Net* _source;
|
||||||
Net* _grid;
|
Net* _grid;
|
||||||
Net* _bulk;
|
Net* _bulk;
|
||||||
Polarity _polarity;
|
Polarity _polarity;
|
||||||
AbutmentType _abutmentType;
|
AbutmentType _abutmentType;
|
||||||
double _l;
|
DbU::Unit _l;
|
||||||
double _w;
|
DbU::Unit _w;
|
||||||
Pad *_source20, *_source22;
|
Pad *_source20, *_source22;
|
||||||
Pad *_drain40, *_drain42;
|
Pad *_drain40, *_drain42;
|
||||||
Pad *_grid00, *_grid01, *_grid30, *_grid31;
|
Pad *_grid00, *_grid01, *_grid30, *_grid31;
|
||||||
|
|
|
@ -95,6 +95,7 @@ void ATechnology::print() {
|
||||||
printPhysicalRules(olprit->second);
|
printPhysicalRules(olprit->second);
|
||||||
cout << endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
|
cout << " o Two Layers Physical Rules" << endl;
|
||||||
for (TwoLayersPhysicalRules::iterator tlprit = _twoLayersPhysicalRules.begin();
|
for (TwoLayersPhysicalRules::iterator tlprit = _twoLayersPhysicalRules.begin();
|
||||||
tlprit != _twoLayersPhysicalRules.end();
|
tlprit != _twoLayersPhysicalRules.end();
|
||||||
tlprit++) {
|
tlprit++) {
|
||||||
|
@ -107,7 +108,7 @@ void ATechnology::print() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ATechnology::PhysicalRule* ATechnology::getPhysicalRule(const Name& name) {
|
const ATechnology::PhysicalRule* ATechnology::getPhysicalRule(const Name& name) const {
|
||||||
PhysicalRule searchPR(name, 0, "");
|
PhysicalRule searchPR(name, 0, "");
|
||||||
PhysicalRules::iterator prit = _noLayerPhysicalRules.find(&searchPR);
|
PhysicalRules::iterator prit = _noLayerPhysicalRules.find(&searchPR);
|
||||||
if (prit == _noLayerPhysicalRules.end()) {
|
if (prit == _noLayerPhysicalRules.end()) {
|
||||||
|
@ -116,6 +117,37 @@ const ATechnology::PhysicalRule* ATechnology::getPhysicalRule(const Name& name)
|
||||||
return *prit;
|
return *prit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ATechnology::PhysicalRule* ATechnology::getPhysicalRule(const Name& name, const Layer* layer) const {
|
||||||
|
OneLayerPhysicalRules::iterator olprit = _oneLayerPhysicalRules.find(layer);
|
||||||
|
if (olprit == _oneLayerPhysicalRules.end()) {
|
||||||
|
throw Error("Cannot find Physical Rules for layer " + getString(layer->getName()));
|
||||||
|
}
|
||||||
|
PhysicalRules& physicalRules = olprit->second;
|
||||||
|
PhysicalRule searchPR(name, 0, "");
|
||||||
|
PhysicalRules::iterator prit = physicalRules.find(&searchPR);
|
||||||
|
if (prit == physicalRules.end()) {
|
||||||
|
throw Error("Cannot find Physical Rule " + getString(name));
|
||||||
|
}
|
||||||
|
return *prit;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ATechnology::PhysicalRule* ATechnology::getPhysicalRule(
|
||||||
|
const Name& name,
|
||||||
|
const Layer* layer1,
|
||||||
|
const Layer* layer2) const {
|
||||||
|
TwoLayerPhysicalRules::iterator tlprit = _twoLayerPhysicalRules.find(layer);
|
||||||
|
if (olprit == _oneLayerPhysicalRules.end()) {
|
||||||
|
throw Error("Cannot find Physical Rules for layer " + getString(layer->getName()));
|
||||||
|
}
|
||||||
|
PhysicalRules& physicalRules = olprit->second;
|
||||||
|
PhysicalRule searchPR(name, 0, "");
|
||||||
|
PhysicalRules::iterator prit = physicalRules.find(&searchPR);
|
||||||
|
if (prit == physicalRules.end()) {
|
||||||
|
throw Error("Cannot find Physical Rule " + getString(name));
|
||||||
|
}
|
||||||
|
return *prit;
|
||||||
|
}
|
||||||
|
|
||||||
Layer* ATechnology::getLayer(const Name& layerName) {
|
Layer* ATechnology::getLayer(const Name& layerName) {
|
||||||
Technology* technology = static_cast<Technology*>(getOwner());
|
Technology* technology = static_cast<Technology*>(getOwner());
|
||||||
Layer* layer = technology->getLayer(layerName);
|
Layer* layer = technology->getLayer(layerName);
|
||||||
|
|
|
@ -38,14 +38,36 @@ class ATechnology : public PrivateProperty {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef pair<Layer*, Layer*> LayerPair;
|
||||||
|
|
||||||
|
struct LayerPairCompare:
|
||||||
|
public std::binary_function<const LayerPair&, const LayerPair&, bool> {
|
||||||
|
bool operator()(const LayerPair& lp1, const LayerPair& lp2) const {
|
||||||
|
if (lp1->first < lp2->first) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (lp1->first > lp2->first) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (lp1->second < lp2->second) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (lp1->second > lp2->second) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
typedef set<ATechnology::PhysicalRule*, PhysicalRuleNameCompare> PhysicalRules;
|
typedef set<ATechnology::PhysicalRule*, PhysicalRuleNameCompare> PhysicalRules;
|
||||||
typedef map<Layer*, PhysicalRules> OneLayerPhysicalRules;
|
typedef map<Layer*, PhysicalRules> OneLayerPhysicalRules;
|
||||||
typedef pair<Layer*, Layer*> LayerPair;
|
typedef map<LayerPair, PhysicalRules, LayerPairCompare> TwoLayersPhysicalRules;
|
||||||
typedef map<LayerPair, PhysicalRules> TwoLayersPhysicalRules;
|
|
||||||
|
|
||||||
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(const Name& name);
|
const PhysicalRule* getPhysicalRule(const Name& name) const;
|
||||||
|
const PhysicalRule* getPhysicalRule(const Name& name, const Layer* layer) const;
|
||||||
|
const PhysicalRule* getPhysicalRule(const Name& name, const Layer* layer1, const Layer* layer2) const;
|
||||||
void addPhysicalRule(const Name& name, double value, const string& reference);
|
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& layerName, double value, const string& reference);
|
||||||
void addPhysicalRule(const Name& name, const Name& layer1Name,
|
void addPhysicalRule(const Name& name, const Name& layer1Name,
|
||||||
|
|
Loading…
Reference in New Issue