📄 oadefoutnet.cpp
字号:
// Start a new route if layer number or style has changed. if (layerNum != currentLayerNum || styleNum != currentStyleNum) { if (!first) { defOut.outNoIndent("\n"); defOut.output("NEW"); } oaLayer *layer = defOut.getLayer(layerNum); oaString layerName; layer->getName(layerName); defOut.outNoIndent(" %s", (const char *) layerName); writeRouteTaper(route); if (styleNum != oacNullIndex) { defOut.outNoIndent(" STYLE %i ( %i %i )", styleNum, beginPoint.x(), beginPoint.y()); } else if (style.getBeginStyle() == oacVariableEndStyle || style.getBeginStyle() == oacTruncateEndStyle) { defOut.outNoIndent(" ( %i %i %i )", beginPoint.x(), beginPoint.y(), style.getBeginExt()); } else { defOut.outNoIndent(" ( %i %i )", beginPoint.x(), beginPoint.y()); } currentPoint = beginPoint; currentLayerNum = layerNum; currentStyleNum = styleNum; } // Add a fake segment to simulate wire-extention after vias. if (i && (objects[i - 1]->getType() == oacCustomViaType || objects[i - 1]->getType() == oacStdViaType) && (style.getBeginStyle() == oacTruncateEndStyle || style.getBeginStyle() == oacVariableEndStyle)) { defOut.outNoIndent( " ( * * %i )", style.getBeginExt()); } defOut.outNoIndent(" ( "); if (currentPoint.x() == endPoint.x()) { defOut.outNoIndent("*"); } else { defOut.outNoIndent("%i", endPoint.x()); } if (currentPoint.y() == endPoint.y()) { defOut.outNoIndent(" *"); } else { defOut.outNoIndent(" %i", endPoint.y()); } if (styleNum == oacNullIndex && (style.getEndStyle() == oacVariableEndStyle || style.getEndStyle() == oacTruncateEndStyle)) { defOut.outNoIndent(" %i", style.getEndExt()); } defOut.outNoIndent(" )"); currentPoint = endPoint; } break; case oacCustomViaType: case oacStdViaType: { oaVia *via = (oaVia *) objects[i]; if (!i) { if (!first) { defOut.outNoIndent("\n"); defOut.output("NEW"); } currentLayerNum = getFirstViaLayer(objects); oaLayer *layer = defOut.getLayer(currentLayerNum); oaString layerName; layer->getName(layerName); defOut.outNoIndent(" %s", (const char*) layerName); writeRouteTaper(route); via->getOrigin(currentPoint); defOut.outNoIndent(" ( %i %i )", currentPoint.x(), currentPoint.y()); } oaString viaName; if (via->getType() == oacStdViaType) { defOut.getGenVia((oaStdViaHeader*) via->getHeader(), viaName); } else { via->getViaDefName(viaName); } defOut.outNoIndent(" %s", (const char*) viaName); currentLayerNum = getOtherViaLayer(via, currentLayerNum); } break; } first = false; }}voidDefOutNet::writeRouteTaper(oaRoute *route){ oaConstraintGroup *rules = defOut.getRules(route); if (rules) { if (rules == defOut.getDefaultRules()) { return defOut.outNoIndent(" TAPER"); } oaString name; rules->getName(name); defOut.outNoIndent(" TAPERRULE %s", (const char *) name); }}// *****************************************************************************// DefOutNet::writeSpecialRoutes()//// This function writes out routes in the special routes syntax//// {+ COVER | + FIXED | + ROUTED | + SHIELD shieldNetName}// <specialWire>... // *****************************************************************************voidDefOutNet::writeSpecialRoutes(){ writeSpecialRoutes(net); oaIter<oaBitNet> equivNetIter(net->getEquivalentNets()); while (oaBitNet *equivNet = equivNetIter.getNext()) { writeSpecialRoutes(equivNet); }}voidDefOutNet::writeSpecialRoutes(oaBitNet *bNet){ oaBoolean first = true; oaRouteStatus currentRouteStatus(oacNormalRouteStatus); oaNet *currentShield = NULL; oaIter<oaShape> shapeIter(bNet->getShapes(oacShapeIterNetOnly)); while (oaShape *shape = shapeIter.getNext()) { switch(shape->getType()) { case oacRectType: writeSpecialRect((oaRect*) shape); first = true; break; case oacPolygonType: if (defOut.getOptions()->getVersion() > cLefDefVersion55) { writeSpecialPolygon((oaPolygon*) shape); } first = true; break; case oacPathSegType: case oacPathType: defOut.outNoIndent("\n"); if (first || shape->getRouteStatus() != currentRouteStatus || shape->getShieldedNet1() != currentShield) { first = false; currentRouteStatus = shape->getRouteStatus(); currentShield = shape->getShieldedNet1(); writeSpecialRouteStatus(currentRouteStatus, currentShield); } else { defOut.output("NEW"); } defOut.incIndent(); if (shape->getType() == oacPathType) { writeSpecialPath((oaPath*) shape); } else { writeSpecialPathSeg((oaPathSeg*) shape); } defOut.decIndent(); } } oaIter<oaVia> viaIter(bNet->getVias(oacViaIterNetOnly)); while (oaVia *via = viaIter.getNext()) { defOut.outNoIndent("\n"); if (first || via->getRouteStatus() != currentRouteStatus || via->getShieldedNet1() != currentShield) { first = false; currentRouteStatus = via->getRouteStatus(); currentShield = via->getShieldedNet1(); writeSpecialRouteStatus(currentRouteStatus, currentShield); } else { defOut.output("NEW"); } defOut.incIndent(); writeSpecialVia(via); defOut.decIndent(); }}// *****************************************************************************// DefOutNet::writeSpecialRouteStatus()//// This function writes out a special route status// *****************************************************************************voidDefOutNet::writeSpecialRouteStatus(const oaRouteStatus &status, const oaNet *shieldNet){ switch (status) { case oacFixedRouteStatus: defOut.output("+ FIXED"); break; case oacLockedRouteStatus: defOut.output("+ COVER"); break; case oacNormalRouteStatus: default: if (shieldNet) { oaName shieldName; shieldNet->getName(shieldName); oaString shield; shieldName.get(defOut.getNS(), shield); defOut.output("+ SHIELD %s", (const char *) shield); } else { defOut.output("+ ROUTED"); } }}// *****************************************************************************// DefOutNet::writeSpecialPathSeg()// DefOutNet::writeSpecialVia()//// These functions write out a special route shape// Syntax:// [NEW] layerName width <shape>// ( x y ) { ( x * ) | ( * y ) | viaName} ...// *****************************************************************************voidDefOutNet::writeSpecialPathSeg(oaPathSeg *pathSeg){ oaPoint point; oaPoint endPoint; oaSegStyle style; pathSeg->getPoints(point, endPoint); pathSeg->getStyle(style); oaLayerNum layerNum = pathSeg->getLayerNum(); oaLayer *layer = defOut.getLayer(layerNum); oaPurposeNum purposeNum = pathSeg->getPurposeNum(); oaUInt4 width = style.getWidth(); oaUInt4 dir = defOut.getDirection(point, endPoint); oaUInt4 styleNum = oacNullIndex; if (defOut.getOptions()->getVersion() > cLefDefVersion55) { styleNum = defOut.defOutStyle->findStyle(style, dir); } if (!pathSeg->isOrthogonal()) { width = defOut.diagToOrthoDBU(width); } oaString layerName; layer->getName(layerName); defOut.outNoIndent(" %s %i", (const char*) layerName, width); writeSpecialRouteShape(pathSeg->getRouteTopology(), purposeNum); if (styleNum != oacNullIndex) { defOut.outNoIndent(" + STYLE %i ( %i %i )", styleNum, point.x(), point.y()); } else if (style.getBeginStyle() == oacExtendEndStyle || style.getBeginStyle() == oacVariableEndStyle) { defOut.outNoIndent(" ( %i %i %i )", point.x(),point.y(), style.getBeginExt()); } else { defOut.outNoIndent(" ( %i %i )", point.x(),point.y()); } defOut.outNoIndent(" ( "); if (point.x() == endPoint.x()) { defOut.outNoIndent("*"); } else { defOut.outNoIndent("%i", endPoint.x()); } if (point.y() == endPoint.y()) { defOut.outNoIndent(" *"); } else { defOut.outNoIndent(" %i", endPoint.y()); } if (styleNum == oacNullIndex && (style.getEndStyle() == oacExtendEndStyle || style.getBeginStyle() == oacVariableEndStyle)) { defOut.outNoIndent(" %i", style.getEndExt()); } defOut.outNoIndent(" )");}voidDefOutNet::writeSpecialVia(oaVia *via){ oaPoint point; via->getOrigin(point); oaLayer *layer = via->getViaDef()->getLayer1(); oaString layerName; layer->getName(layerName); defOut.outNoIndent(" %s 0", (const char*) layerName); writeSpecialRouteShape(via->getRouteTopology(), oavPurposeNumberDrawing); defOut.outNoIndent(" ( %i %i )", point.x(), point.y()); oaString viaName; if (via->getType() != oacStdViaType || !defOut.getGenVia((oaStdViaHeader*) via->getHeader(), viaName)) { via->getViaDefName(viaName); } defOut.outNoIndent(" %s", (const char *) viaName);} // *****************************************************************************// DefOutNet::writeSpecialRect()//// [+ RECT layerName xl yl xh yh ;]// *****************************************************************************voidDefOutNet::writeSpecialRect(oaRect *rect){ oaLayer *layer = defOut.getLayer(rect->getLayerNum()); oaString layerName; oaBox box; layer->getName(layerName); rect->getBBox(box); defOut.outNoIndent("\n"); if (defOut.getOptions()->getVersion() > cLefDefVersion55) { defOut.output("+ RECT %s ( %i %i ) ( %i %i )", (const char*) layerName, box.left(), box.bottom(), box.right(), box.top()); } else { oaUInt4 width = box.right() - box.left(); oaUInt4 height = box.top() - box.bottom(); if (width > height) { oaInt4 center = box.bottom() + height/2; defOut.output("+ ROUTED %s %i ( %i %i ) ( %i %i )", (const char*) layerName, height, box.left(), center, box.right(), center); } else { oaInt4 center = box.left() + width/2; defOut.output("+ ROUTED %s %i ( %i %i ) ( %i %i )", (const char*) layerName, width, center, box.bottom(), center, box.top()); } }}// *****************************************************************************// DefOutNet::writeSpecialPolygon()//// [+ POLYGON layerName xl yl xh yh ;]// *****************************************************************************voidDefOutNet::writeSpecialPolygon(oaPolygon *polygon){ oaLayer *layer = defOut.getLayer(polygon->getLayerNum()); oaString layerName; oaPointArray points(polygon->getNumPoints()); layer->getName(layerName); polygon->getPoints(points); defOut.outNoIndent("\n"); defOut.output("+ POLYGON %s", (const char*) layerName); for (oaUInt4 i = 0; i < points.getNumElements(); i++) { defOut.outNoIndent(" ( %i %i )", points[i].x(), points[i].y()); }}// *****************************************************************************// DefOutNet::writeSpecialPath()//// [+ ROUTED layerName xl yl xh yh ;]// *****************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -