oaPinFig and oaVia creation ...

This commit is contained in:
Jean-Manuel Caba 2010-08-17 11:09:26 +00:00
parent 10a91d7d68
commit 3d09907286
3 changed files with 597 additions and 555 deletions

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-12 23:50:52" - OpenAccessCommon.h
// Time-stamp: "2010-08-16 16:52:02" - OpenAccessCommon.h
// x-----------------------------------------------------------------x
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-16 13:05:27" - OpenAccessDriver.cpp
// Time-stamp: "2010-08-17 13:07:48" - OpenAccessDriver.cpp
// x-----------------------------------------------------------------x
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -27,6 +27,7 @@ using namespace std;
#include "hurricane/Instance.h"
#include "hurricane/Component.h"
#include "hurricane/Segment.h"
#include "hurricane/Horizontal.h"
#include "hurricane/Vertical.h"
#include "hurricane/Pad.h"
// Layer
@ -56,9 +57,9 @@ namespace {
typedef map<const Cell*, oaCell*> Cell2OACellMap;
typedef map<const Instance*, oaInst*> Instance2OAInstsMap;
typedef map<const Layer*, oaLayer*> Layer2OALayerMap;
typedef map<const ViaLayer*, oaViaDef*> ViaLayer2OAViaDefMap;
typedef map<const Pad*, oaRect*> Pad2OARectMap;
typedef map<const Component*, oaPathSeg*> Component2OAPathSegMap;
typedef map<const ViaLayer*, oaStdViaDef*> ViaLayer2OAViaDefMap;
typedef map<const Component*, oaRect*> Component2OARectMap;
typedef map<const Segment*, oaPathSeg*> Segment2OAPathSegMap;
string _path;
oaTech* _oaTech;
@ -71,8 +72,8 @@ namespace {
Instance2OAInstsMap _instance2OAInst;
Layer2OALayerMap _layer2OALayer;
ViaLayer2OAViaDefMap _viaLayer2OAViaDef;
Pad2OARectMap _pad2OARect;
Component2OAPathSegMap _component2OAPathSeg;
Component2OARectMap _component2OARect;
Segment2OAPathSegMap _segment2OAPathSeg;
set<int> _layerIDS;
int _layerID;
oaLayer* _layerDev;
@ -94,8 +95,8 @@ namespace {
_instance2OAInst(),
_layer2OALayer(),
_viaLayer2OAViaDef(),
_pad2OARect(),
_component2OAPathSeg(),
_component2OARect(),
_segment2OAPathSeg(),
_layerIDS(),
_layerID(0),
_layerDev(NULL),
@ -168,7 +169,6 @@ namespace {
end_for;
}
}
// 4) create, update library list file
oaFuncs::createCDS(infos,_path);
infos.second.clear();
@ -261,8 +261,35 @@ namespace {
if(!bLayer){
cerr << "NOT A BASICLAYER " << layerName;
const ViaLayer* vLayer = dynamic_cast<const ViaLayer*>(layer);
if(vLayer)
if(vLayer){
cerr << " but is a ViaLayer" << endl;
const Layer* hBottom=vLayer->getBottom();
const Layer* hTop=vLayer->getTop();
assert(hBottom);
assert(hTop);
oaPhysicalLayer* bottom = static_cast<oaPhysicalLayer*>(toOALayer(hBottom,theOATech));
oaPhysicalLayer* top = static_cast<oaPhysicalLayer*>(toOALayer(hTop,theOATech));
oaLayer* cut = NULL;
for_each_basic_layer(l,vLayer->getBasicLayers()){
if(l != vLayer->getTop() && l != vLayer->getBottom()){
cut = toOALayer(l,theOATech);
break;
}
end_for;
}
assert(cut);
oaViaParam stdViaDefParam;
stdViaDefParam.setCutLayer(cut->getNumber());
stdViaDefParam.setCutWidth(Hurricane::DbU::getDb(vLayer->getEnclosure()));
stdViaDefParam.setCutHeight(Hurricane::DbU::getDb(vLayer->getEnclosure()));
oaStdViaDef* vDef = oaStdViaDef::create(theOATech, layerName,
bottom,
top,
stdViaDefParam);
_viaLayer2OAViaDef[vLayer] = vDef;
}
const ContactLayer* cLayer = dynamic_cast<const ContactLayer*>(layer);
if(cLayer)
cerr << " but is a ContactLayer" << endl;
@ -342,12 +369,8 @@ namespace {
//create and add foundry constraint group for General manufacturing rules
//and add oaSimpleConstraintType too
assert(theOATech);
theOATech->getDefaultConstraintGroup();
theOATech->getDefaultConstraintGroup();//add the constraint group for oa2lef
oaConstraintGroup *cgFoundry = theOATech->getFoundryRules();
/*
add the constraint group LEFDefaultRouteSpec for oa2lef
*/
}
// get or create physical layer
@ -388,7 +411,7 @@ namespace {
assert(_layerWire);
_layerIDS.insert(_layerWire->getNumber());
}catch(oaException&e ){
cerr << "OA:" << e.getMsg() << endl;
cerr << "OA_TEST:" << e.getMsg() << endl;
exit(-2);
}catch(std::exception&e ){
cerr << "STD:" << e.what() << endl;
@ -444,10 +467,8 @@ namespace {
cerr << "toOAInst " << instance << endl;
assert(instance);
Instance2OAInstsMap::iterator it = _instance2OAInst.find(instance);
if (it != _instance2OAInst.end()) {
if (it != _instance2OAInst.end())
return it->second;
}
assert(topBlock);
// 1) get the master cell for the instance
Cell* masterCell = instance->getMasterCell();
@ -461,13 +482,12 @@ namespace {
oaString strMasterName;
scMasterName.get(strMasterName);
oaScalarName scInstName(ns, getString( instance->getName()).c_str());
oaScalarInst* blockInst = oaScalarInst::find(topBlock,
scInstName);
if(!blockInst){
oaTransform transform = toOATransform(instance->getTransformation());
blockInst = oaScalarInst::create(topBlock, masterDesign, scInstName, transform);
blockInst = oaScalarInst::create(topBlock,
masterDesign, scInstName, transform);
}
_instance2OAInst[instance] = blockInst;
return blockInst;
@ -486,7 +506,7 @@ namespace {
assert(it != _instance2OAInst.end());
oaInst* blockInst = it->second;
oaName instTermName(toOAName( getString(plug->getMasterNet()->getName()) ));
oaName instTermName(toOAName( plug->getMasterNet()->getName() ));
oaInstTerm* instTerm = oaInstTerm::find(blockInst, instTermName);
if (instTerm)
return instTerm;
@ -535,19 +555,19 @@ namespace {
/**
Used to convert Pad
*/
oaRect* toOARect(Pad* pad,oaNet* blockNet){
oaRect* toOARect(Component* component,oaNet* blockNet){
cerr << "toOARect" << endl;
assert(pad);
assert(component);
assert(blockNet);
Pad2OARectMap::iterator it = _pad2OARect.find(pad);
if (it != _pad2OARect.end())
Component2OARectMap::iterator it = _component2OARect.find(component);
if (it != _component2OARect.end())
return it->second;
oaRect* rect = oaRect::create(blockNet->getBlock(),
toOALayerNum( pad->getLayer() ),
toOALayerNum( component->getLayer() ),
oacDrawingPurposeType,
toOABox(pad->getBoundingBox()) );
toOABox(component->getBoundingBox()) );
return rect;
}
@ -559,9 +579,17 @@ namespace {
assert(segment);
assert(blockNet);
Component2OAPathSegMap::iterator it = _component2OAPathSeg.find(segment);
if (it != _component2OAPathSeg.end())
Segment2OAPathSegMap::iterator it = _segment2OAPathSeg.find(segment);
if (it != _segment2OAPathSeg.end())
return it->second;
oaPathSeg* res = NULL;
try{
Horizontal* hSeg = dynamic_cast<Horizontal*>(segment);
if(hSeg)
cerr << "Horizontal" << endl;
Vertical* vSeg = dynamic_cast<Vertical*>(segment);
if(vSeg)
cerr << "Vertical" << endl;
oaSegStyle style(segment->getWidth(), oacTruncateEndStyle, oacTruncateEndStyle);
oaPathSeg* res = oaPathSeg::create(blockNet->getBlock(),
@ -570,15 +598,19 @@ namespace {
toOAPoint(segment->getSourcePosition()),
toOAPoint(segment->getTargetPosition()),
style);
}catch (oaException &e) {
cerr << "OA::ERROR => " << e.getMsg() << endl;
exit(1);
}
assert(res);
return res;
}
/**
Used to convert Pin
*/
oaPin* toOAPin(Pin* hpin,oaNet* blockNet){
oaPin* toOAPin(oaNet* blockNet){
cerr << "toOAPin" << endl;
assert(hpin);
assert(blockNet);
oaName pinName;
blockNet->getName(pinName);
@ -598,37 +630,25 @@ namespace {
@todo implement me ...
*/
oaVia* toOAVia(Contact* contact,oaNet* blockNet){
//TODO
#if 0
// Get via layers from the technology database oaPhysicalLayer *poly = oaPhysicalLayer::find(tech, "Poly");
ViaLayer::ViaLayer
oaPhysicalLayer *imp1 = oaPhysicalLayer::find(_oaTech, "Nimp");
oaPhysicalLayer *imp2 = oaPhysicalLayer::find(_oaTech, "Pimp");
oaPhysicalLayer *metal1 = oaPhysicalLayer::find(tech, "Metal1");
oaPhysicalLayer *cut = oaPhysicalLayer::find(tech, "Via1");
cerr << "toOAVia" << endl;
assert(contact);
assert(blockNet);
// Create the oaStdVia
const Layer* layer = contact->getLayer();
const ViaLayer* vLayer = dynamic_cast<const ViaLayer*>(layer);
assert(vLayer);
// Set up the oaStdViaDef parameters
oaViaParam stdViaDefParam;
stdViaDefParam.setCutLayer(cut->getNumber());
stdViaDefParam.setCutWidth(1000);
stdViaDefParam.setCutHeight(1000);
stdViaDefParam.setCutSpacing(100);
stdViaDefParam.setCutColumns(4);
oaStdViaDef* myStdViaDef = NULL;
ViaLayer2OAViaDefMap::iterator it = _viaLayer2OAViaDef.find(vLayer);
if (it != _viaLayer2OAViaDef.end())
myStdViaDef = it->second;
assert(myStdViaDef);
// Create the oaStdViaDef oaStdViaDef *myStdViaDef =
oaStdViaDef::create(tech, oaString("myStdViaDef"), poly, metal1,
stdViaDefParam, imp1, imp2);
// Create the oaStdViaDef
oaTransform zeroTrans(oaPoint(0, 0), oacR0);
oaStdVia* via = oaStdVia::create(blk, myStdViaDef, zeroTrans);
oaStdVia* via = oaStdVia::create(blockNet->getBlock(), myStdViaDef, zeroTrans);
return via;
#endif
return NULL;
}
/**
@ -673,6 +693,17 @@ namespace {
}
}
oaPinFig* toOAPinFig(Component* component,oaNet* blockNet){
Contact* hContact = dynamic_cast<Contact*>(component);
Segment* hSegment = dynamic_cast<Segment*>(component);
if(hContact)
return toOAVia(hContact,blockNet);
if(hSegment)
return toOAPathSeg(hSegment,blockNet);
return toOARect(component,blockNet);
}
/**
convert Hurricane::Net to oaNet
always return a non NULL value
@ -693,23 +724,31 @@ namespace {
blockNet->setGlobal(net->isGlobal());
blockNet->scalarize();//ensure we can add shape ..
//logical part
cerr << " o transformation of plugs" << endl;
for_each_plug(plug, net->getPlugs()) {
oaInstTerm* term = toOAInstTerm(plug, blockNet);
term->addToNet(blockNet);
end_for;
}
if(net->isExternal()){
oaPin* pin = toOAPin(blockNet);
Components externalComponents = NetExternalComponents::get(net);
for_each_component(component, externalComponents) {
oaPinFig* pinFig = toOAPinFig(component,blockNet);
pinFig->addToPin(pin);
end_for;
}
}else{
cerr << " o transformation of contacts" << endl;
for_each_contact(contact, net->getContacts()) {
Pin* hPin = dynamic_cast<Pin*>(contact);
oaPin* pin = NULL;
if(hPin)
pin = toOAPin(hPin, blockNet);
#if 0
oaVia* via = toOAVia(contact, blockNet);
if(via){
via->addToNet(blockNet);
#endif
}else{
oaRect* rect = toOARect(contact,blockNet);
rect->addToNet(blockNet);
}
end_for;
}
cerr << " o transformation of pads" << endl;
@ -724,6 +763,7 @@ namespace {
shape->addToNet(blockNet);
end_for;
}
}
return blockNet;
}
@ -943,7 +983,7 @@ namespace {
//3) we check it's the same oaCell for all designs
assert(c1 == c2 && c2 == c3 && c3 == c4);
return netlistView;
return layoutView;
}
/**

View File

@ -102,7 +102,7 @@ int main(int argc,char** argv) {
if(argc != 3)
exit(-5);
testAnalog(argv[1],argv[2]);
testNum(argv[1],argv[2],"a2_x2");
testNum(argv[1],argv[2],"a2_x4");
@ -200,6 +200,8 @@ int main(int argc,char** argv) {
testNum(argv[1],argv[2],"xr2_x4");
testNum(argv[1],argv[2],"zero_x0");
testAnalog(argv[1],argv[2]);
DataBase::getDB()->destroy();
cerr << "ending normally" << endl;
return 0;