📄 oalefingeom.cpp
字号:
// This is the constructor for the LefInGeomPin class. // *****************************************************************************LefInGeomPin::LefInGeomPin(LefIn &translator, oaPurposeNum purposeNumIn): LefInGeom(translator), purposeNum(purposeNumIn), classCore(false), pin(NULL){ translator.lefInGeomPin = this;}// *****************************************************************************// LefInGeomPin::parse()//// This is the constructor for the LefInGeom class. // *****************************************************************************voidLefInGeomPin::parse(lefiGeometries *data, oaPin *pinIn){ classCore = false; pin = pinIn; parseGeometries(data);}// *****************************************************************************// LefInGeomPin::parseGeom()//// This function parses item types specific to pin geometry, and calls the// base class for any other types.// *****************************************************************************voidLefInGeomPin::parseGeom(oaInt4 itemNum){ if (lefGeom->itemType(itemNum) == lefiGeomClassE) { return parseClass(lefGeom->getClass(itemNum)); } return LefInGeom::parseGeom(itemNum);}// *****************************************************************************// LefInGeomPin::parseClass()//// This function sets the classCore variable.// *****************************************************************************voidLefInGeomPin::parseClass(const oaString &c){ if (strcmp(c, "CORE") == 0) { classCore = true; }}// *****************************************************************************// LefInGeomPin::parseLayer()//// This function will set the layernumber and layerwidth for pins. If layer// is NULL an error message is printed.// *****************************************************************************voidLefInGeomPin::parseLayer(const oaString &layerName){ currentLayerNum = lefIn.getLayerNum(layerName); currentWidth = lefIn.getLayerWidth(lefIn.getDefaultRules(), currentLayerNum); hasLayer = true;}// *****************************************************************************// LefInGeomPin::createRect()//// This function creates an oaRect for the specified bbox// Any spacing and width values for this shape are stored as properties// *****************************************************************************voidLefInGeomPin::createRect(const oaBox &box){ oaPinFig *fig = oaRect::create(lefIn.design()->getTopBlock(), getLayerNum(), purposeNum, box); createConstraints(fig); fig->addToPin(pin);}// *****************************************************************************// LefInGeomPin::createDot()//// This function creates an oaDot at the specified location// Any spacing and width values for this shape are stored as properties// *****************************************************************************voidLefInGeomPin::createDot(const oaPoint &point){ oaPinFig *fig = oaDot::create(lefIn.design()->getTopBlock(), getLayerNum(), purposeNum, point); createConstraints(fig); fig->addToPin(pin);}// *****************************************************************************// LefInGeomPin::createLine()//// This function creates an oaLine for the specified pointArray// Any spacing and width values for this shape are stored as properties// *****************************************************************************voidLefInGeomPin::createLine(const oaPointArray &pointArray){ oaPinFig *fig = oaLine::create(lefIn.design()->getTopBlock(), getLayerNum(), purposeNum, pointArray); createConstraints(fig); fig->addToPin(pin);}// *****************************************************************************// LefInGeomPin::createPath()//// This function creates an oaPath for the specified pointArray.// Any spacing and width values for this shape are stored as properties// ***************************************************************************** voidLefInGeomPin::createPath(const oaPointArray &pointArray){ if (pointArray.getNumElements() == 1) { return createRect(oaBox(pointArray[0].x() - currentWidth/2, pointArray[0].y() - currentWidth/2, pointArray[0].x() + currentWidth/2, pointArray[0].y() + currentWidth/2)); } oaPinFig *fig = oaPath::create(lefIn.design()->getTopBlock(), getLayerNum(), purposeNum, currentWidth, pointArray, oacVariablePathStyle, currentWidth/2, currentWidth/2); createConstraints(fig); fig->addToPin(pin);}// *****************************************************************************// LefInGeomPin::createVia()//// This function creates a new oaVia, for the given oaCustomViaDef, at the// given point.// *****************************************************************************voidLefInGeomPin::createVia(oaVia *via, const oaPoint &point){ via->addToPin(pin);} // *****************************************************************************// LefInGeomPin::createPolygon()//// This function returns a new oaPolygon for the given pointarray.// Any spacing and width values for this shape are stored as properties// *****************************************************************************voidLefInGeomPin::createPolygon(const oaPointArray &pointArray){ oaPinFig *fig = oaPolygon::create(lefIn.design()->getTopBlock(), getLayerNum(), purposeNum, pointArray); createConstraints(fig); fig->addToPin(pin);}// *****************************************************************************// LefInGeomObs::LefInGeomObs()//// This is the constructor for the LefInGeom class. // *****************************************************************************LefInGeomObs::LefInGeomObs(LefIn &translator): LefInGeom(translator){ translator.lefInGeomObs = this;}// *****************************************************************************// LefInGeomObs::parse()//// This is the constructor for the LefInGeom class. // *****************************************************************************voidLefInGeomObs::parse(lefiGeometries *data){ overlap = false; parseGeometries(data);}// *****************************************************************************// LefInGeomObs::parseLayer()// // This function sets the layernumber and layerwidth for obstructions. In case// the layer is an overlap layer the overlap variable will be set.// *****************************************************************************voidLefInGeomObs::parseLayer(const oaString &layerName){ if (layerName == lefIn.getOverlapLayer()) { hasLayer = true; overlap = true; return; } currentLayerNum = lefIn.getLayerNum(layerName); currentWidth = lefIn.getLayerWidth(lefIn.getDefaultRules(), currentLayerNum); hasLayer = true; overlap = false;}// *****************************************************************************// LefInGeomObs::createRect()//// This function creates an pointarray from the specified bbox and creates// a blockages.// *****************************************************************************voidLefInGeomObs::createRect(const oaBox &box){ oaPointArray pointArray(4); pointArray[0].x() = box.left(); pointArray[0].y() = box.bottom(); pointArray[1].x() = box.left(); pointArray[1].y() = box.top(); pointArray[2].x() = box.right(); pointArray[2].y() = box.top(); pointArray[3].x() = box.right(); pointArray[3].y() = box.bottom(); pointArray.setNumElements(4); createBlockage(pointArray);}// *****************************************************************************// LefInGeomObs::createDot()// // It is not possible to creates a blockage on a single point.// *****************************************************************************voidLefInGeomObs::createDot(const oaPoint &point){}// *****************************************************************************// LefInGeomObs::createLine()//// It is not possible to creates a blockage on a single line.// *****************************************************************************voidLefInGeomObs::createLine(const oaPointArray &pointArray){} // *****************************************************************************// LefInGeomObs::createPath()// // This function creates a pointarray from the given pointArray and the path// width and it creates a blockage.// ***************************************************************************** voidLefInGeomObs::createPath(const oaPointArray &pointArray){ oaPointArray blockagePointArray(4); if (pointArray.getNumElements() == 1) { blockagePointArray[0].x() = pointArray[0].x() - currentWidth/2; blockagePointArray[0].y() = pointArray[0].y() - currentWidth/2; blockagePointArray[1].x() = pointArray[0].x() - currentWidth/2; blockagePointArray[1].y() = pointArray[0].y() + currentWidth/2; blockagePointArray[2].x() = pointArray[0].x() + currentWidth/2; blockagePointArray[2].y() = pointArray[0].y() + currentWidth/2; blockagePointArray[3].x() = pointArray[0].x() + currentWidth/2; blockagePointArray[3].y() = pointArray[0].y() - currentWidth/2; blockagePointArray.setNumElements(4); } else { oaPath::genBoundary(pointArray, currentWidth, oacVariablePathStyle, currentWidth/2, currentWidth/2, blockagePointArray); blockagePointArray.compress(); } createBlockage(blockagePointArray); }// *****************************************************************************// LefInGeomObs::createVia()//// This function creates separate oaBlockages for each of the shapes found// in the given oaCustomViaDef.// *****************************************************************************voidLefInGeomObs::createVia(oaVia *via, const oaPoint &point){ oaDesign *viaDesign = via->getMaster(); if (!viaDesign || !viaDesign->getTopBlock()) { oaString viaName; via->getViaDefName(viaName); throw LefDefError(cViaMasterNotFound, (const char*) viaName); } oaIter<oaShape> iter(viaDesign->getTopBlock()->getShapes()); oaShape *shape; oaBox box; oaFig *fig = NULL; while (shape = iter.getNext()) { shape->getBBox(box); if ((box.left() != box.right()) && (box.top() != box.bottom())) { oaPointArray pointArray(4); pointArray[0].x() = point.x() + box.left(); pointArray[0].y() = point.y() + box.bottom(); pointArray[1].x() = point.x() + box.left(); pointArray[1].y() = point.y() + box.top(); pointArray[2].x() = point.x() + box.right(); pointArray[2].y() = point.y() + box.top(); pointArray[3].x() = point.x() + box.right(); pointArray[3].y() = point.y() + box.bottom(); pointArray.setNumElements(4); oaLayerBlockage::create(lefIn.topBlock(), oacRoutingBlockageType, shape->getLayerNum(), pointArray); } } via->destroy();}// *****************************************************************************// LefInGeomObs::createPolygon()//// This function creates a blockage for a given pointArray// *****************************************************************************voidLefInGeomObs::createPolygon(const oaPointArray &pointArray){ createBlockage(pointArray);}// *****************************************************************************// LefInGeomObs::createConstraints()//// This function creates constraints on the given shape, // for any current object based spacing rules.// *****************************************************************************voidLefInGeomObs::createConstraints(oaFig *fig){ if (currentEffectiveWidth) { ((oaLayerBlockage*) fig)->setEffectiveWidth(currentEffectiveWidth); } LefInGeom::createConstraints(fig);} // *****************************************************************************// LefInGeom::createBlockage()//// This function creates an oaBlockage for the given pointArray,// and stores spacing/width values if set.// *****************************************************************************voidLefInGeomObs::createBlockage(const oaPointArray &pointArray){ if (overlap) { lefIn.getLefInMacro()->addOverlapPoints(pointArray); return; } oaBlockage *fig = oaLayerBlockage::create(lefIn.design()->getTopBlock(), oacRoutingBlockageType, getLayerNum(), pointArray); createConstraints(fig);}END_LEFDEF_NAMESPACE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -