work in progress: create oaViadef from ViaLayer, more advanced Component convertion ...

This commit is contained in:
Jean-Manuel Caba 2010-08-13 16:05:58 +00:00
parent dd47776631
commit b6048dab6f
2 changed files with 652 additions and 582 deletions

View File

@ -1,5 +1,5 @@
// -*-compile-command:"cd ../../../../.. && make"-*-
// Time-stamp: "2010-08-12 20:20:45" - OpenAccessDriver.cpp
// Time-stamp: "2010-08-13 18:02:10" - OpenAccessDriver.cpp
// x-----------------------------------------------------------------x
// | This file is part of the hurricaneAMS Software. |
// | Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved |
@ -22,10 +22,21 @@ using namespace std;
#include "hurricane/Library.h"
#include "hurricane/Cell.h"
#include "hurricane/NetExternalComponents.h"
// Go
#include "hurricane/Instance.h"
#include "hurricane/Component.h"
#include "hurricane/Segment.h"
#include "hurricane/Vertical.h"
#include "hurricane/Pad.h"
// Layer
#include "hurricane/BasicLayer.h"
#include "hurricane/Slice.h"
#include "hurricane/ContactLayer.h"
#include "hurricane/ViaLayer.h"
#include "hurricane/TransistorLayer.h"
#include "hurricane/DiffusionLayer.h"
#include "hurricane/RegularLayer.h"
using namespace Hurricane;
#include "OpenAccess.h"
@ -43,10 +54,11 @@ namespace {
typedef map<const Library*, oaLib*> Library2OALibMap;
typedef map<const Cell*, oaDesign*> Cell2OADesignMap;
typedef map<const Cell*, oaCell*> Cell2OACellMap;
typedef map<Instance*, oaInst*> Instance2OAInstsMap;
typedef map<Layer*, oaPhysicalLayer*> Layer2OAPhysicalLayerMap;
typedef map<Pad*, oaRect*> Pad2OARectMap;
typedef map<Component*, oaPathSeg*> Component2OAPathSegMap;
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;
string _path;
oaTech* _oaTech;
@ -57,7 +69,8 @@ namespace {
Cell2OADesignMap _cell2OADesign4Layout;
Cell2OACellMap _cell2OAcell;
Instance2OAInstsMap _instance2OAInst;
Layer2OAPhysicalLayerMap _layer2OAPhysicalLayer;
Layer2OALayerMap _layer2OALayer;
ViaLayer2OAViaDefMap _viaLayer2OAViaDef;
Pad2OARectMap _pad2OARect;
Component2OAPathSegMap _component2OAPathSeg;
set<int> _layerIDS;
@ -79,7 +92,8 @@ namespace {
_cell2OADesign4Layout(),
_cell2OAcell(),
_instance2OAInst(),
_layer2OAPhysicalLayer(),
_layer2OALayer(),
_viaLayer2OAViaDef(),
_pad2OARect(),
_component2OAPathSeg(),
_layerIDS(),
@ -166,7 +180,7 @@ namespace {
handle layerID i.e: get extractNumber in Hurricane world if
possible ...
*/
int generateLayerID(BasicLayer* bLayer){
int generateLayerID(const BasicLayer* bLayer){
// the layer number is unique to a particular layer
cerr << "generateLayerID -> ";
int numLayer = _layerID;
@ -212,33 +226,62 @@ namespace {
}
}
/**
helper function
technology MUST exist first
*/
oaLayerNum toOALayerNum(const Layer* hLayer){
assert(hLayer);
oaLayer* layer = toOALayer(hLayer,_oaTech);
assert(layer);
return layer->getNumber();
}
/**
convert oaLayer from a Layer ...
*/
oaPhysicalLayer* toOALayer(Layer* layer,oaTech* theOATech) {
oaLayer* toOALayer(const Layer* layer,oaTech* theOATech) {
assert(layer);
cerr << "toOALayer " << getString(layer->getName()) << endl;
Layer2OAPhysicalLayerMap::iterator it = _layer2OAPhysicalLayer.find(layer);
if (it != _layer2OAPhysicalLayer.end())
Layer2OALayerMap::iterator it = _layer2OALayer.find(layer);
if (it != _layer2OALayer.end())
return it->second;
assert(theOATech);
// 1) get or create layer
oaString layerName = getString(layer->getName()).c_str();
oaPhysicalLayer* aOALayer = NULL;
oaLayer* aOALayer = NULL;
aOALayer = oaPhysicalLayer::find(theOATech, layerName, true);
if(aOALayer){
_layer2OAPhysicalLayer[layer] = aOALayer;
_layer2OALayer[layer] = aOALayer;
_layerIDS.insert(aOALayer->getNumber());
return aOALayer;
}
BasicLayer* bLayer = dynamic_cast<BasicLayer*>(layer);
const BasicLayer* bLayer = dynamic_cast<const BasicLayer*>(layer);
if(!bLayer){
cerr << "NOT A BASICLAYER " << layerName;
const ViaLayer* vLayer = dynamic_cast<const ViaLayer*>(layer);
if(vLayer)
cerr << " but is a ViaLayer" << endl;
const ContactLayer* cLayer = dynamic_cast<const ContactLayer*>(layer);
if(cLayer)
cerr << " but is a ContactLayer" << endl;
const DiffusionLayer* dLayer = dynamic_cast<const DiffusionLayer*>(layer);
if(dLayer)
cerr << " but is a DiffusionLayer" << endl;
const TransistorLayer* tLayer = dynamic_cast<const TransistorLayer*>(layer);
if(tLayer)
cerr << " but is a TransistorLayer" << endl;
const RegularLayer* rLayer = dynamic_cast<const RegularLayer*>(layer);
if(rLayer)
cerr << " but is a RegularLayer" << endl;
}
aOALayer = oaPhysicalLayer::create(theOATech, layerName, generateLayerID(bLayer),
bLayer ? toOAMaterial(bLayer->getMaterial())
: oaMaterial(oacOtherMaterial));
assert(aOALayer);
_layer2OAPhysicalLayer[layer] = aOALayer;
_layer2OALayer[layer] = aOALayer;
#if 0
//create and add layer constraint for Layer specific manufacturing rules
@ -253,7 +296,7 @@ namespace {
try{
cMinSize = oaLayerConstraint::create(aOALayer->getNumber(),
oaLayerConstraintDef::get(oacMinSize),
oaIntValue::create(theOATech,500))
oaIntValue::create(theOATech,500));
}catch(oaException& e){
cerr << "ERROR oaLayer: " << e.getMsg() << endl;
exit(-2);
@ -279,6 +322,7 @@ namespace {
oaIntValue::create(theOATech->getLib(),pitch));
assert(cPitchV);
#endif
return aOALayer;
}
@ -509,58 +553,51 @@ namespace {
return box;
}
oaRect* toOARect(Pad* component,oaBlock* topBlock){
cerr << "toOARect" << endl;
assert(component);
assert(topBlock);
Pad2OARectMap::iterator it = _pad2OARect.find(component);
/**
Used to convert Pad
*/
oaRect* toOARect(Pad* pad,oaNet* blockNet){
cerr << "toOARect" << endl;
assert(pad);
assert(blockNet);
Pad2OARectMap::iterator it = _pad2OARect.find(pad);
if (it != _pad2OARect.end())
return it->second;
oaBox box = toOABox(component->getBoundingBox());
Layer* layer = (Layer*) component->getLayer();
assert(layer);
oaPhysicalLayer* physLayer = toOALayer(layer,_oaTech);
assert(physLayer);
oaLayerNum layerNum = physLayer->getNumber();
oaRect* rect = oaRect::create(topBlock,
layerNum,
oaRect* rect = oaRect::create(blockNet->getBlock(),
toOALayerNum( pad->getLayer() ),
oacDrawingPurposeType,
box);
toOABox(pad->getBoundingBox()) );
return rect;
}
/**
Used to convert Segment
*/
oaPathSeg* toOAPathSeg(Segment* segment,oaNet* blockNet){
#if 0
cerr << "toOAPathSeg" << endl;
assert(component);
assert(segment);
assert(blockNet);
Component2OAPathSegMap::iterator it = _component2OAPathSeg.find(component);
Component2OAPathSegMap::iterator it = _component2OAPathSeg.find(segment);
if (it != _component2OAPathSeg.end())
return it->second;
oaBox box = toOABox(component->getBoundingBox());
Layer* layer = (Layer*) component->getLayer();
assert(layer);
oaPhysicalLayer* physLayer = toOALayer(layer,_oaTech);
assert(physLayer);
oaLayerNum layerNum = physLayer->getNumber();
oaSegStyle style(, oacTruncateEndStyle, oacTruncateEndStyle);
res = oaPathSeg::created(blockNet->getBlock(),
,
oaSegStyle style(segment->getWidth(), oacTruncateEndStyle, oacTruncateEndStyle);
oaPathSeg* res = oaPathSeg::create(blockNet->getBlock(),
toOALayerNum( segment->getLayer() ),
oacDrawingPurposeType,
toOAPoint(),
toOAPoint(),
);
toOAPoint(segment->getSourcePosition()),
toOAPoint(segment->getTargetPosition()),
style);
return res;
#endif
return NULL;
}
/**
create a Pin from Pin
Used to convert Pin
*/
oaPin* toOAPin(Pin* hpin,oaNet* blockNet){
cerr << "toOAPin" << endl;
@ -579,8 +616,41 @@ namespace {
return pin;
}
/**
used to convert Via
@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");
// Set up the oaStdViaDef parameters
oaViaParam stdViaDefParam;
stdViaDefParam.setCutLayer(cut->getNumber());
stdViaDefParam.setCutWidth(1000);
stdViaDefParam.setCutHeight(1000);
stdViaDefParam.setCutSpacing(100);
stdViaDefParam.setCutColumns(4);
// 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);
return via;
#endif
return NULL;
}
@ -646,37 +716,37 @@ namespace {
blockNet->setGlobal(net->isGlobal());
blockNet->scalarize();//ensure we can add shape ..
#if 0
//logical part
cerr << " o transformation of plugs" << endl;
for_each_plug(plug, net->getPlugs()) {
InstTerm* term = toOAInstTerm(plug, blockNet);
oaInstTerm* term = toOAInstTerm(plug, blockNet);
term->addToNet(blockNet);
end_for;
}
cerr << " o transformation of contacts" << endl;
for_each_contact(contact, getContacts()) {
for_each_contact(contact, net->getContacts()) {
Pin* hPin = dynamic_cast<Pin*>(contact);
oaPin* pin = NULL;
if(hPin)
pin = toOAPin(pin, blockNet);
pin = toOAPin(hPin, blockNet);
#if 0
oaVia* via = toOAVia(contact, blockNet);
via->addToNet(blockNet);
#endif
end_for;
}
cerr << " o transformation of pads" << endl;
for_each_pad(pads, getPads()){
oaRect* rect = toOARect(contact, blockNet);
for_each_pad(pad, net->getPads()){
oaRect* rect = toOARect(pad, blockNet);
rect->addToNet(blockNet);
end_for;
}
cerr << " o transformation of segments" << endl;
for_each_segments(component, net->getSegments()) {
oaShape* shape = toOAPathSeg(component,blockNet);
for_each_segment(component, net->getSegments()) {
oaPathSeg* shape = toOAPathSeg(component,blockNet);
shape->addToNet(blockNet);
end_for;
}
#endif
return blockNet;
}
@ -828,7 +898,7 @@ namespace {
}
assert(topBlock);
// 4) convert each OA object
// 4) convert each instance, net to OA
cerr << "transformation of instances" << endl;
for_each_instance(instance, cell->getInstances()){
toOAInst(instance,topBlock);

View File

@ -1,6 +1,6 @@
TESTDIR= ./testOA
TECHNOFILE= /asim/chams/etc/chams/config.freePDK45.xml
TECHNOFILE= /dsk/l1/misc/caba/coriolis-2.x/Linux.SLSoC5x/Release.Shared/install/etc/chams/config.freePDK45.xml
M=$$(uname -m)
all: compile lefTest run