📄 oadefoutpin.cpp
字号:
// *****************************************************************************// *****************************************************************************// DefOutPins.cpp//// Functions to handle DEF PINS constructs for the 'DefOut' translator.//// *****************************************************************************// Except as specified in the OpenAccess terms of use of Cadence or Silicon// Integration Initiative, this material may not be copied, modified,// re-published, uploaded, executed, or distributed in any way, in any medium,// in whole or in part, without prior written permission from Cadence.//// Copyright 2002-2005 Cadence Design Systems, Inc.// All Rights Reserved.//// $Author: nitters $// $Revision: 1.35 $// $Date: 2005/05/30 06:50:19 $// $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefOutPin::DefOutPin()// DefOutPin::~DefOutPin()//// This is the constructor for the DefOutPin class. // *****************************************************************************DefOutPin::DefOutPin(DefOut &translator): defOut(translator){ translator.defOutPin = this;}DefOutPin::~DefOutPin(){}// *****************************************************************************// DefOutPin::write()//// This function writes the pin construct for this terminal.// Note: If there is more than one physical pin associated with the terminal,// we label the extra pins <termName>.extra<num>// *****************************************************************************voidDefOutPin::write(oaBitTerm *termIn){ term = termIn; oaName termName; oaString termStr; term->getName(termName); termName.get(defOut.getNS(), termStr); // Split in baseName and bus notation (for later .extra use) // Do not use vectorName.getBaseName because of possible // double vector notation. (baseName bus characters would // be escaped in that case) oaChar busChar = defOut.getNS().getOpenBusChar(); oaString busOpen(&busChar, 1); oaUInt4 busStart = termStr.substr(busOpen); oaString postFix; if (busStart != termStr.getLength()) { postFix = &termStr[busStart]; termStr[busStart] = 0; } if (!term->getPins().isEmpty()) { oaUInt4 pinNum(0); oaIter<oaPin> pinIter(term->getPins()); while (pin = pinIter.getNext()) { defOut.output("- %s", (const char*)termStr); if (pinNum) { defOut.outNoIndent(".extra%i", pinNum); } if (postFix.getLength() > 0) { defOut.outNoIndent("%s", (const char*)postFix); } pinNum++; origin.x() = INT_MAX; defOut.incIndent(); writeNet(); writeSpecial(); writeDirection(); writeUse(); writeShapes(); writePlacement(); writeAntenna(); defOut.outNoIndent(" ;\n" ); defOut.decIndent(); } } else { defOut.output("- %s", (const char*)termStr); if (postFix.getLength() > 0) { defOut.outNoIndent("%s", (const char*)postFix); } defOut.incIndent(); writeNet(); writeSpecial(); writeDirection(); writeUse(); writeAntenna(); defOut.outNoIndent(" ;\n"); defOut.decIndent(); }}// *****************************************************************************// DefOutPin::writeNet()//// This function outputs the netname for the current terminal// Syntax:// + NET <name>// *****************************************************************************voidDefOutPin::writeNet(){ oaNet *net = term->getNet(true); if (net) { oaString netName; net->getName(defOut.getNS(), netName); defOut.outNoIndent(" + NET %s", (const char*)netName); }}// *****************************************************************************// DefOutPin::writeSpecial()//// This function writes the routeMethod of the current terminal.// Only the routeMethod corresponding to the DEF SPECIAL attribute is written.// *****************************************************************************voidDefOutPin::writeSpecial(){ if (term->getRouteMethod() == oacGeometricRouteMethod) { defOut.outNoIndent("\n"); defOut.output("+ SPECIAL"); }}// *****************************************************************************// DefOutPin::writeDirection()//// This function writes the direction of the current terminal.// The direction is taken from termtype.// Syntax:// [+ DIRECTION {INPUT | OUTPUT | INOUT | FEEDTHRU}]// *****************************************************************************voidDefOutPin::writeDirection(){ oaString dir; switch (term->getTermType()) { case oacInputTermType : dir = "INPUT"; break; case oacOutputTermType : dir = "OUTPUT"; break; case oacInputOutputTermType : dir = "INOUT"; break; case oacJumperTermType : dir = "FEEDTHRU"; break; case oacTristateTermType : case oacSwitchTermType : case oacUnusedTermType : default: return; } defOut.outNoIndent("\n"); defOut.output("+ DIRECTION %s", (const char *) dir);}// *****************************************************************************// DefOutPin::writeUse()//// This function writes the use of the current terminal.// The use attribute is taken from the terminal net.// SIGNAL value is not output since considered as the default value.// Syntax:// [+ USE {SIGNAL | POWER | GROUND | CLOCK | TIEOFF | ANALOG// | SCAN | RESET}]// *****************************************************************************voidDefOutPin::writeUse(){ oaString use; oaNet *net = term->getNet(); oaSigType sigType = oacSignalSigType; if (net) { sigType = net->getSigType(); } switch (sigType) { case oacPowerSigType: use = "POWER"; break; case oacGroundSigType: use = "GROUND"; break; case oacClockSigType: use = "CLOCK"; break; case oacTieoffSigType: case oacTieHiSigType: case oacTieLoSigType: use = "TIEOFF"; break; case oacAnalogSigType: use = "ANALOG"; break; case oacScanSigType: use = "SCAN"; break; case oacResetSigType: use = "RESET"; break; case oacSignalSigType: default: return; } defOut.outNoIndent("\n"); defOut.output("+ USE %s", (const char *) use);}// *****************************************************************************// DefOutPin::writeAntenna()// // This function outputs the antenna constructs.// *****************************************************************************voidDefOutPin::writeAntenna(){ if (!term->isAntennaDataSet()) { return; } oaUInt4 i(0); oaAntennaData data; term->getAntennaData(data); writeAntennaGeneric(data); if (defOut.getOptions()->getVersion() < cLefDefVersion55) { writeAntennaModel(data); return; } defOut.outNoIndent("\n"); defOut.output("+ ANTENNAMODEL OXIDE1"); defOut.incIndent(); writeAntennaModel(data); defOut.decIndent(); if (term->isAntennaDataSet(oacSecondAntennaModel)) { term->getAntennaData(data, oacSecondAntennaModel); defOut.outNoIndent("\n"); defOut.output("+ ANTENNAMODEL OXIDE2"); defOut.incIndent(); writeAntennaModel(data); defOut.decIndent(); }}// *****************************************************************************// DefOutPin::writeGeneric()// // This function outputs the antenna constructs, syntax:// [+ ANTENNAPINPARTIALMETALAREA value [LAYER layerName] ]...// [+ ANTENNAPINPARTIALMETALSIDEAREA value [LAYER layerName] ]...// [+ ANTENNAPINDIFFAREA value [LAYER layerName] ]...// [+ ANTENNAPINPARTIALCUTAREA value [LAYER layerName] ]...// *****************************************************************************voidDefOutPin::writeAntennaGeneric(oaAntennaData &data){ // Partial Metal Area oaUInt4 i(0); for (i; i < data.partialMetal().getNumElements(); i++) { defOut.outNoIndent("\n"); defOut.output("+ ANTENNAPINPARTIALMETALAREA %llu", data.partialMetal()[i].area()); writeAntennaLayer(data.partialMetal()[i].layerNum()); } // Partial Metal Side Area for (i = 0; i < data.partialMetalSide().getNumElements(); i++) { defOut.outNoIndent("\n"); defOut.output("+ ANTENNAPINPARTIALMETALSIDEAREA %llu", data.partialMetalSide()[i].area()); writeAntennaLayer(data.partialMetalSide()[i].layerNum()); } // Patrial Cut Area for (i = 0; i < data.partialCut().getNumElements(); i++) { defOut.outNoIndent("\n"); defOut.output("+ ANTENNAPINPARTIALCUTAREA %llu", data.partialCut()[i].area()); writeAntennaLayer(data.partialCut()[i].layerNum()); } // Diff Area for (i = 0; i < data.diff().getNumElements(); i++) { defOut.outNoIndent("\n"); defOut.output("+ ANTENNAPINDIFFAREA %llu", data.diff()[i].area()); writeAntennaLayer(data.diff()[i].layerNum()); }}// *****************************************************************************// DefOutPin::writeAntennaModel()// // This function outputs the antenna constructs for the given model, syntax:// [+ ANTENNAPINGATEAREA value [LAYER layerName] ]...// [+ ANTENNAPINMAXAREACAR value LAYER layerName]// [+ ANTENNAPINMAXSIDEAREACAR value LAYER layerName]// [+ ANTENNAPINMAXCUTCAR value LAYER layerName]// *****************************************************************************voidDefOutPin::writeAntennaModel(oaAntennaData &data){ // Gate Area oaUInt4 i(0); for (i; i < data.gate().getNumElements(); i++) { defOut.outNoIndent("\n"); defOut.output("+ ANTENNAPINGATEAREA %llu", data.gate()[i].area()); writeAntennaLayer(data.gate()[i].layerNum()); } // Max Area CAR for (i = 0; i < data.maxCAR().getNumElements(); i++) { defOut.outNoIndent("\n"); defOut.output("+ ANTENNAPINMAXAREACAR %llu", data.maxCAR()[i].area()); writeAntennaLayer(data.maxCAR()[i].layerNum()); } // Max Side Area CAR for (i = 0; i < data.maxSideCAR().getNumElements(); i++) { defOut.outNoIndent("\n"); defOut.output("+ ANTENNAPINMAXSIDEAREACAR %llu", data.maxSideCAR()[i].area()); writeAntennaLayer(data.maxSideCAR()[i].layerNum()); } // Max Cut CAR for (i = 0; i < data.maxCutCAR().getNumElements(); i++) { defOut.outNoIndent("\n"); defOut.output("+ ANTENNAPINMAXCUTCAR %llu", data.maxCutCAR()[i].area()); writeAntennaLayer(data.maxCutCAR()[i].layerNum()); }}// *****************************************************************************// DefOutPin::writeAntennaLayer()// // This function writes a layer statement for the specified layerNum.// *****************************************************************************voidDefOutPin::writeAntennaLayer(oaLayerNum layerNum){ if (layerNum != oacNullIndex) { oaLayer *layer = defOut.getLayer(layerNum); oaString layerName; layer->getName(layerName); defOut.outNoIndent(" LAYER %s", (const char *) layerName); }}// *****************************************************************************// DefOutPin::writeShapes()//// This function writes the shapes for the current pin.// Syntax:// [+ LAYER layerName pt pt]// [+ POLYGON layerName pt pt ...]// *****************************************************************************voidDefOutPin::writeShapes(){ oaIter<oaPinFig> figIter(pin->getFigs()); while (oaFig *fig = figIter.getNext()) { if (!fig->isShape()) { continue; } oaBox bBox; fig->getBBox(bBox); if (origin.x() == INT_MAX) { origin = bBox.lowerLeft(); } oaString layerName; oaLayer *layer = defOut.getLayer(((oaShape*) fig)->getLayerNum()); layer->getName(layerName); defOut.outNoIndent("\n"); switch (fig->getType()) { case oacPathType: case oacPolygonType: if (defOut.getOptions()->getVersion() > cLefDefVersion55) { oaPointArray points; if (fig->getType() == oacPathType) { ((oaPath*) fig)->getBoundary(points); } else { ((oaPolygon*) fig)->getPoints(points); } defOut.output("+ POLYGON %s", (const char*)layerName); for (oaUInt4 i = 0; i < points.getNumElements(); i++) { defOut.outNoIndent(" ( %i %i )", points[i].x() - origin.x(), points[i].y() - origin.y()); } break; } case oacRectType: case oacLineType: case oacDotType: defOut.output("+ LAYER %s", (const char*)layerName); defOut.outNoIndent(" ( %i %i ) ( %i %i )", bBox.left() - origin.x(), bBox.bottom() - origin.y(), bBox.right() - origin.x(), bBox.top() - origin.y()); break; } }}// *****************************************************************************// DefOutPin::writePlacement()//// This function writes the placement status for the current pin.//// Syntax:// [+ COVER pt orient | FIXED pt orient | PLACED pt orient] ; ]... // *****************************************************************************voidDefOutPin::writePlacement(){ if (origin.x() != INT_MAX) { switch (pin->getPlacementStatus()) { case oacLockedPlacementStatus: defOut.outNoIndent("\n"); defOut.output("+ FIXED ( %i %i ) N", origin.x(), origin.y()); break; case oacPlacedPlacementStatus: defOut.outNoIndent("\n"); defOut.output("+ PLACED ( %i %i ) N", origin.x(), origin.y()); break; } }}END_LEFDEF_NAMESPACE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -