📄 oalefout.cpp
字号:
// *****************************************************************************// *****************************************************************************// LefOut.cpp//// This file contains the member functions for the LefOut class.//// *****************************************************************************// 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.112 $// $Date: 2005/06/17 14:29:53 $// $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// LefOut::LefOut()// LefOut::~LefOut()//// These are the constructor destructor functions for the LefOut class. // *****************************************************************************LefOut::LefOut(oaUtil::MsgAdapter &msgAdapterIn): LefDefOut(msgAdapterIn, lefNS), options(NULL), legacy(NULL), overlapName(cLefOverlapLayerName), dbuPerUU(cLefDefaultDBUPerUU), lefOutGeom(NULL), lefOutLayer(NULL), lefOutMacro(NULL), lefOutNDR(NULL), lefOutPin(NULL), lefOutSite(NULL), lefOutVia(NULL), lefOutViaRule(NULL){}LefOut::~LefOut(){ delete lefOutGeom; delete lefOutLayer; delete lefOutMacro; delete lefOutNDR; delete lefOutPin; delete lefOutSite; delete lefOutVia; delete lefOutViaRule;}// *****************************************************************************// LefOut::run()//// Checks arguments, opens the library and tech db and output LEF file.// The design data is generated by the writer objects registered with the // translator// *****************************************************************************voidLefOut::run(LefOutOptions *optionsIn){ FILE *fileIn = fopen(optionsIn->getFileName(), "w"); if (!fileIn) { throw LefDefError(cCannotOpenFile, (const char*) options->getFileName()); } run(fileIn, optionsIn); fclose(fileIn);}voidLefOut::run(FILE *fileIn, LefOutOptions *optionsIn){ options = optionsIn; options->checkArgs(); init(); initLib(options->getLibName()); initDesigns(); initTechDB(); initNameSpace(); initPropDefs(); initFile(fileIn); try { write(); } catch (oaException &err) { error(cGeneric, (const char*) err.getMsg()); } close();}// *****************************************************************************// LefOut::write()//// This function opens the specified output file and writes out the LEF// sections for the open design.// *****************************************************************************voidLefOut::write(){ writeVersion(); writeCaseSensitive(); writeWireExtension(); writeBusBitChars(); writeDividerChar(); writePropDef(); if (options->writeTech()) { writeUnits(); writeManufGrid(); writeUseMinSpacing(); writeClearanceMeasure(); if (getOptions()->getVersion() > cLefDefVersion53) { writeAntennaSize(); } writeLayers(); if (getOptions()->getVersion() > cLefDefVersion54) { writeMaxViaStack(); } writeVias(); writeViaRules(); writeSpacing(); writeNonDefaultRules(); writeSites(); } if (options->writeCells()) { writeMacros(); } writeEnd();}// *****************************************************************************// LefOut::writeVersion()// // This function outputs the LEF version number (always output), syntax:// VERSION number ; // *****************************************************************************voidLefOut::writeVersion(){ switch(options->getVersion()) { case cLefDefVersion53: output("VERSION 5.3 ;\n"); break; case cLefDefVersion54: output("VERSION 5.4 ;\n"); break; case cLefDefVersion55: output("VERSION 5.5 ;\n"); break; case cLefDefVersion56: output("VERSION 5.6 ;\n"); }}// *****************************************************************************// LefOut::writeCaseSensitive()//// This function outputs the namecasesensive statement (always on in OA),// syntax:// NAMESCASESENSITIVE {ON | OFF} ;// *****************************************************************************voidLefOut::writeCaseSensitive(){ output("NAMESCASESENSITIVE ON ;\n");}// *****************************************************************************// LefOut::writeWireExtension()//// This function outputs the wireextention construct, syntax:// NOWIREEXTENSIONATPIN {ON | OFF} ; // *****************************************************************************voidLefOut::writeWireExtension(){ if (getLegacyProp()) { oaProp *prop = oaProp::find(getLegacyProp(), cLefNoWireExtention); if (prop && prop->getType() == oacBooleanPropType && ((oaBooleanProp*) prop)->getValue()) { output("NOWIREEXTENSIONATPIN ON ;\n"); } }}// *****************************************************************************// LefOut::writeBusBitChars()//// This function outputs the busbit chars used in the current namespace, syntax:// BUSBITCHARS "delimiterPair " ; // *****************************************************************************voidLefOut::writeBusBitChars(){ oaString busBitChars("[]"); if (getLegacyProp()) { oaProp *prop = oaProp::find(getLegacyProp(), cLefBusBitChars); if (prop && prop->getType() == oacStringPropType) { ((oaStringProp*) prop)->getValue(busBitChars); } } output("BUSBITCHARS \"%s\" ;\n", (const char*) busBitChars);}// *****************************************************************************// LefOut::writeDividerChar()//// This function outputs the hierarchy delimiter character used in the current// namespace, // syntax:// DIVIDERCHAR "character" ; // *****************************************************************************voidLefOut::writeDividerChar(){ oaString dividerChar("/"); if (getLegacyProp()) { oaProp *prop = oaProp::find(getLegacyProp(), cLefDividerChar); if (prop && prop->getType() == oacStringPropType) { ((oaStringProp*) prop)->getValue(dividerChar); } } output("DIVIDERCHAR \"%s\" ;\n\n", (const char*)dividerChar);}// *****************************************************************************// LefOut::writeUnits()//// This function outputs the unit conversion factors, syntax:// UNITS// [TIME NANOSECONDS convertFactor ;]// [CAPACITANCE PICOFARADS convertFactor ;]// [RESISTANCE OHMS convertFactor ;]// [POWER MILLIWATTS convertFactor ;]// [CURRENT MILLIAMPS convertFactor ;]// [VOLTAGE VOLTS convertFactor ;]// [DATABASE MICRONS LEFconvertFactor ;]// [FREQUENCY MEGAHERTZ convertFactor ;] // END UNITS// *****************************************************************************voidLefOut::writeUnits(){ oaUInt4 tim = cLefDefaultTimeUnit; oaUInt4 cap = cLefDefaultCapacitanceUnit; oaUInt4 res = cLefDefaultResistanceUnit; oaUInt4 power = cLefDefaultPowerUnit; oaUInt4 current = cLefDefaultCurrentUnit; oaUInt4 voltage = cLefDefaultVoltageUnit; oaUInt4 freq = cLefDefaultFrequencyUnit; if (legacy) { oaProp *prop = oaProp::find(legacy, cLefTimeUnit); if (prop && prop->getType() == oacIntPropType) { tim = ((oaIntProp*) prop)->getValue(); } prop = oaProp::find(legacy, cLefCapacitanceUnit); if (prop && prop->getType() == oacIntPropType) { cap = ((oaIntProp*) prop)->getValue(); } prop = oaProp::find(legacy, cLefResistanceUnit); if (prop && prop->getType() == oacIntPropType) { res = ((oaIntProp*) prop)->getValue(); } prop = oaProp::find(legacy, cLefPowerUnit); if (prop && prop->getType() == oacIntPropType) { power = ((oaIntProp*) prop)->getValue(); } prop = oaProp::find(legacy, cLefCurrentUnit); if (prop && prop->getType() == oacIntPropType) { current = ((oaIntProp*) prop)->getValue(); } prop = oaProp::find(legacy, cLefVoltageUnit); if (prop && prop->getType() == oacIntPropType) { voltage = ((oaIntProp*) prop)->getValue(); } prop = oaProp::find(legacy, cLefFrequencyUnit); if (prop && prop->getType() == oacIntPropType) { freq = ((oaIntProp*) prop)->getValue(); } } if (tim != cLefDefaultTimeUnit || cap != cLefDefaultCapacitanceUnit || res != cLefDefaultResistanceUnit || power != cLefDefaultPowerUnit || current != cLefDefaultCurrentUnit || voltage != cLefDefaultVoltageUnit || dbuPerUU != cLefDefaultDBUPerUU || freq != cLefDefaultFrequencyUnit ) { output("UNITS\n"); incIndent(); if (tim != cLefDefaultTimeUnit) { output("TIME NANOSECONDS %i ;\n", tim); } if (cap != cLefDefaultCapacitanceUnit) { output("CAPACITANCE PICOFARADS %i ;\n", cap); } if (res != cLefDefaultResistanceUnit) { output("RESISTANCE OHMS %i ;\n", res); } if (power != cLefDefaultPowerUnit) { output("POWER MILLIWATTS %i ;\n", power); } if (current != cLefDefaultCurrentUnit) { output("CURRENT MILLIAMPS %i ;\n", current); } if (voltage != cLefDefaultVoltageUnit) { output("VOLTAGE VOLTS %i ;\n", voltage); } if (dbuPerUU != cLefDefaultDBUPerUU) { output("DATABASE MICRONS %i ;\n", dbuPerUU); } if (freq != cLefDefaultFrequencyUnit) { output("FREQUENCY MEGAHERTZ %i ;\n", freq); } decIndent(); output("END UNITS\n"); }}// *****************************************************************************// LefOut::writeManufGrid()//// This function outputs the manufacturing grid statement.// Since the manufacturing grid in OA is stored per layer,// we just get it from the first layer.//// Syntax:// [ MANUFACTURINGGRID statement ]// *****************************************************************************voidLefOut::writeManufGrid(){ oaIter<oaLayer> layerIt(tech()->getLayers()); while (oaLayer *layer = layerIt.getNext()) { if (layer->getType() == oacPhysicalLayerType && ((oaPhysicalLayer *) layer)->getMaterial() == oacMetalMaterial) { oaUInt4 grid = ((oaPhysicalLayer *) layer)->getManufacturingGrid(); if (grid > 1) { output("MANUFACTURINGGRID %.11g ;\n", dbuToUU(grid)); return; } } }}// *****************************************************************************// LefOut::writeUseMinSpacing()//// This function outputs the useminspacing statement, syntax:// [ USEMINSPACING { OBS | PIN } { ON | OFF } ;... ]// *****************************************************************************voidLefOut::writeUseMinSpacing(){ if (getLegacyProp()) { oaProp *prop = oaProp::find(getLegacyProp(), cLefUseMinSpacingPin); if (prop && prop->getType() == oacBooleanPropType && ((oaBooleanProp*) prop)->getValue()) { output("USEMINSPACING PIN ON ;\n"); } prop = oaProp::find(getLegacyProp(), cLefUseMinSpacingObs); if (prop && prop->getType() == oacBooleanPropType && !((oaBooleanProp*) prop)->getValue()) { output("USEMINSPACING OBS OFF ;\n"); } }}// *****************************************************************************// LefOut::writeClearanceMeasure()//// This function outputs the clearancemeasure statement, syntax:// [ CLEARANCEMEASURE statement ]// *****************************************************************************voidLefOut::writeClearanceMeasure(){ if (tech()->getClearanceMeasure() == oacMaxXYClearanceMeasure) { output("CLEARANCEMEASURE MAXXY ;\n"); }}// *****************************************************************************// LefOut::writePropDef()//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -