📄 oadefout.cpp
字号:
// *****************************************************************************// *****************************************************************************// DefOut.cpp//// This file contains the member functions for the DefOut 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.103 $// $Date: 2005/06/14 12:48:32 $// $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaLefDef.h"BEGIN_LEFDEF_NAMESPACE// *****************************************************************************// DefOut::DefOut()//// This is the constructor for the DefOut class. // The default option values are set here.// *****************************************************************************DefOut::DefOut(oaUtil::MsgAdapter &msgAdapterIn): LefDefOut(msgAdapterIn, defNS), options(NULL), defOutComponent(NULL), defOutNDR(NULL), defOutNet(NULL), defOutPin(NULL), defOutScanChain(NULL), defOutStyle(NULL), defOutVia(NULL){}// *****************************************************************************// DefOut::~DefOut()//// This is the destructor for the DefOut class. // *****************************************************************************DefOut::~DefOut(){ delete defOutComponent; delete defOutNDR; delete defOutNet; delete defOutPin; delete defOutScanChain; delete defOutStyle; delete defOutVia;}// *****************************************************************************// DefOut::run()//// This function checks the options, opens the library, techDB and design,// and outputs the DEF file.// *****************************************************************************voidDefOut::run(DefOutOptions *optionsIn){ FILE *fileIn = fopen(optionsIn->getFileName(), "w"); if (!fileIn) { throw LefDefError(cCannotOpenFile, (const char*) options->getFileName()); } run(fileIn, optionsIn); fclose(fileIn);}voidDefOut::run(FILE *fileIn, DefOutOptions *optionsIn){ options = optionsIn; options->checkArgs(); init(); initLib(options->getLibName()); initTechDB(); initDesign(); initNameSpace(); initPropDefs(); initFile(fileIn); write(); close();}// *****************************************************************************// DefOut::write()//// This function opens the DEF file, and writes all the DEF constructs.// *****************************************************************************voidDefOut::write(){ writeHeader(); writeNamesCaseSensitive(); writeDividerChar(); writeBusBitChars(); outNoIndent("\n"); writeDesign(); outNoIndent("\n"); writeTechnology(); writeUnits(); writePropDef(); writeDieArea(); writeRows(); writeTracks(); writeGCellGrid(); outNoIndent("\n"); writeVias(); if (getOptions()->getVersion() > cLefDefVersion55) { writeStyles(); writeNonDefaultRules(); } writeRegions(); writeComponents(); writePins(); writePinProps(); writeBlockages(); writeSpecialNets(); writeNets(); writeScanChains(); writeGroups(); writeFills(); writeEnd();}// *****************************************************************************// DefOut::writeHeader()// // This function writes a DEF header section.// // Syntax:// VERSION number ; // *****************************************************************************voidDefOut::writeHeader(){ 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"); }}// *****************************************************************************// DefOut::writeNameCaseSensitive()// // This function writes the DEF case sensitivity.// // Syntax:// NAMECASESENSITIVE ON ; // *****************************************************************************voidDefOut::writeNamesCaseSensitive(){ output("NAMESCASESENSITIVE ON ;\n");}// *****************************************************************************// DefOut::writeBusBitChars()//// This function writes the busbit chars used in the current namespace.// // Syntax:// BUSBITCHARS "delimiterPair " ; // *****************************************************************************voidDefOut::writeBusBitChars(){ oaString busBitChars("[]"); oaHierProp *legacy = (oaHierProp *) oaProp::find(tech(), cLefLegacyProp); if (legacy) { oaStringProp *prop = (oaStringProp *) oaProp::find(legacy, cLefBusBitChars); if (prop) { prop->getValue(busBitChars); } } output("BUSBITCHARS \"%s\" ;\n", (const char*) busBitChars);}// *****************************************************************************// DefOut::writeDividerChar()//// This function writes the divider character used in the current namespace.// // Syntax:// DIVIDERCHAR "character" ; // *****************************************************************************voidDefOut::writeDividerChar(){ oaString dividerChar("/"); oaHierProp *legacy = (oaHierProp *) oaProp::find(tech(), cLefLegacyProp); if (legacy) { oaStringProp *prop = (oaStringProp *) oaProp::find(legacy, cLefDividerChar); if (prop) { prop->getValue(dividerChar); } } output("DIVIDERCHAR \"%s\" ;\n", (const char*)dividerChar);}// *****************************************************************************// DefOut::writeDesign()// // This function writes a DEF DESIGN statement.// // Syntax:// DESIGN name ;// *****************************************************************************voidDefOut::writeDesign(){ oaString name; design()->getCellName(getNS(), name); output("DESIGN %s ;\n", (const char *) name);}// *****************************************************************************// DefOut::writeTechnology()//// This function writes a technology name for this design// *****************************************************************************voidDefOut::writeTechnology(){ oaProp *prop = oaProp::find(design(), cDefTechnology); if (prop) { oaString techno; ((oaStringProp *)prop)->getValue(techno); output("TECHNOLOGY %s ;\n", (const char *) techno); }}// *****************************************************************************// DefOut::writeUnits()//// This function writes the DEF units statement.// // Syntax:// UNITS DISTANCE MICRONS DEFconvertFactor ; // *****************************************************************************voidDefOut::writeUnits(){ oaInt4 units(tech()->getDBUPerUU(oaViewType::get(oacMaskLayout))); if (units != cDefDefaultDBUPerUU) { output("UNITS DISTANCE MICRONS %i ;\n", units); }}// *****************************************************************************// DefOut::writePropDef()//// This function writes the property definitions section// Note: the property definitions list was constructed during// database traversal in DefOut::initPropDefs()// // Syntax:// [ PROPERTYDEFINITIONS // objectType propName propType [RANGE min max] // [value | "stringValue"] ; ... // END PROPERTYDEFINITIONS ]// *****************************************************************************voidDefOut::writePropDef(){ writePropDefs();}// *****************************************************************************// DefOut::writeDieArea()//// This function writes the dieArea information for this design.//// Syntax:// DIEAREA pt pt ; // *****************************************************************************voidDefOut::writeDieArea(){ oaPRBoundary *dieArea = oaPRBoundary::find(topBlock()); if (dieArea) { oaPointArray points; dieArea->getPoints(points); if (points.isRectangle() || getOptions()->getVersion() < cLefDefVersion56) { oaBox bBox; points.getBBox(bBox); output("DIEAREA ( %i %i ) ( %i %i ) ;\n", bBox.left(), bBox.bottom(), bBox.right(), bBox.top()); return; } output("DIEAREA"); for (oaUInt4 i = 0; i < points.getNumElements(); i++) { outNoIndent(" ( %i %i )", points[i].x(), points[i].y()); } outNoIndent(" ;\n"); }}// *****************************************************************************// DefOut::writeRows()//// This function iterates over all rows in the design,// and calls writeRow to output the row.// *****************************************************************************voidDefOut::writeRows(){ oaIter<oaRow> rowIter(topBlock()->getRows()); while (oaRow *row = rowIter.getNext()) { writeRow(row); }}// *****************************************************************************// DefOut::writeRow()//// This function writes the DEF row statement for this row.//// Syntax:// ROW rowName rowType origX origY orient// { DO numX BY 1 STEP spaceX 0// | DO 1 BY numY STEP 0 spaceY }// [+ PROPERTY {propName propVal}...]...; // *****************************************************************************voidDefOut::writeRow(oaRow *row){ oaString rowName; oaString siteName; oaBoolean horizontal; oaBox rowBBox; oaString defSiteOrient; oaUInt4 siteWidth = row->getHeader()->getSiteDefWidth(); oaUInt4 siteHeight = row->getHeader()->getSiteDefHeight(); oaUInt4 siteSpacing = siteWidth + row->getSiteSpacing(); oaOrientEnum siteOrient(row->getSiteOrient()); oaUInt4 numSites(row->getNumSites()); row->getName(rowName); row->getSiteDefName(siteName); row->getBBox(rowBBox); oaOrientEnum rowOrient(row->getOrient()); if (rowOrient == oacR0 || rowOrient == oacR180 || rowOrient == oacMY || rowOrient == oacMX) { horizontal = true; switch(siteOrient) { case oacR90 : defSiteOrient = "W"; siteSpacing = siteHeight + row->getSiteSpacing(); break; case oacR180 : defSiteOrient = "S"; break; case oacR270 : defSiteOrient = "E"; siteSpacing = siteHeight + row->getSiteSpacing(); break; case oacMY : defSiteOrient = "FN"; break; case oacMXR90 : defSiteOrient = "FW"; siteSpacing = siteHeight + row->getSiteSpacing(); break; case oacMX : defSiteOrient = "FS"; break; case oacMYR90 : defSiteOrient = "FE"; siteSpacing = siteHeight + row->getSiteSpacing(); break; case oacR0 : default: defSiteOrient = "N"; } } else { horizontal = false; switch(siteOrient) { // We add 90 degrees to find the DEF site orient case oacR90 : defSiteOrient = "S"; siteSpacing = siteHeight + row->getSiteSpacing(); break; case oacR180 : defSiteOrient = "E"; break; case oacR270 : defSiteOrient = "N"; siteSpacing = siteHeight + row->getSiteSpacing(); break; case oacMY : defSiteOrient = "FE"; break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -