⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oadefin.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:
// *****************************************************************************// DefIn::parseUnits()//// This function handles the "UNITS" DEF construct.// // Syntax://   [UNITS DISTANCE MICRONS dbuPerMicron ;]//// The UNITS statement is not stored in OA. It is used to scale coordinates// within the DEF file to the database units stored in the technology database.// A warning is output if the precision in the DEF file is greater than the// precision in the technology database.// *****************************************************************************voidDefIn::parseUnits(double    data){    oaUInt4 units = oaRound(data);    if (units != 100 && units != 200	&& units != 1000 && units != 2000	&& units != 10000 && units != 20000) {        throw LefDefError(cInvalidUnits, units);    }    // Determine scale factor    scaleFactor = double(dbuPerUUFromTech / data);    if (scaleFactor < 1.0 ) {        warn(cInvalidScaleFactor, (int) data, dbuPerUUFromTech);    }}// *****************************************************************************// DefIn::parsePropDef()//// This function is called for each property definition found in the// "PROPERTYDEFINITIONS" DEF construct.//// Syntax://   [PROPERTYDEFINITIONS//       [objectType propName propType [RANGE min max]//           [value | stringValue]//       ;] ...//   END PROPERTYDEFINITIONS]//// The PROPERTYDEFINITIONS statements are not stored in OA. However they are// used during parsing of the DEF file to validate the PROPERTY attributes on// objects.// *****************************************************************************voidDefIn::parsePropDef(defiProp	*data){    oaString    propName(data->propName());    oaString	propObject(data->propType());    // Determine property Use (on what object)    LefDefObjectEnum   objectType(cLefDefDesign);    if (propObject ==  "design") {	objectType = cLefDefDesign;    } else if (propObject == "component") { 	objectType = cLefDefComponent;    } else if (propObject == "componentpin") {	objectType = cLefDefComponentPin;    } else if (propObject == "region") {	objectType = cLefDefRegion;    } else if (propObject == "row") {	objectType = cLefDefRow;    } else if (propObject == "group") {	objectType = cLefDefGroup;    } else if (propObject ==  "net") {	objectType = cLefDefNet;    } else if (propObject == "specialnet") {	objectType = cLefDefSpecialNet;    } else if (propObject == "nondefaultrule") {	objectType = cLefDefNonDefaultRule;    }    // Determine Property Type    LefDefProp *propDef;    char        dataType = data->dataType();    if (dataType == 'I') {	if (data->hasRange()) {	    propDef = new LefDefIntRangeProp(propName,					      objectType,					      oaInt4(data->left()),					      oaInt4(data->right()));	} else {	    propDef = new LefDefIntProp(propName, objectType);	}    } else if (dataType == 'R') {	if (data->hasRange()) {	    propDef = new LefDefRealRangeProp(propName,					       objectType,					       data->left(),					       data->right());	} else {	    propDef = new LefDefRealProp(propName, objectType);	}    } else {	oaString value;	propDef = new LefDefStringProp(propName, objectType, value);    }    addProp(propDef);         // if it's a design property then add it here as a property of the design    if (objectType == cLefDefDesign) {	oaString val(data->string());	if(data->dataType() == 'I'	   || data->dataType() == 'R') {	    val.format(256, "%lg", data->number());	}		createProp(propDef, design(), val);    }}// *****************************************************************************// DefIn::parseDieArea()//// This function handles the "DIEAREA" DEF construct.//// Syntax://   [DIEAREA pt pt [pt] ... ;]//// The DIEAREA statement is stored in OA as the oaPRBoundary.// *****************************************************************************voidDefIn::parseDieArea(defiBox *data){    if (!oaPRBoundary::find(topBlock())) {	oaPointArray	points(4);	int		numPoints = data->getPoint().numPoints;	if (numPoints > 3) {	    points.setSize(numPoints);	    for (int i = 0; i < numPoints; i++) {		points[i].x() = scaleToDBU(data->getPoint().x[i]);		points[i].y() = scaleToDBU(data->getPoint().y[i]);	    }	    points.setNumElements(numPoints);	} else {	    points[0].x() = scaleToDBU(data->xl());	    points[0].y() = scaleToDBU(data->yl());	    points[1].x() = scaleToDBU(data->xl());	    points[1].y() = scaleToDBU(data->yh());	    points[2].x() = scaleToDBU(data->xh());	    points[2].y() = scaleToDBU(data->yh());	    points[3].x() = scaleToDBU(data->xh());	    points[3].y() = scaleToDBU(data->yl());	    points.setNumElements(4);	}	oaPRBoundary::create(topBlock(), points);    } }// *****************************************************************************// DefIn::parseRow()//// This function uses the DefInRow helper class to create oaRow(s) for the// row data given by the parser.// *****************************************************************************voidDefIn::parseRow(defiRow	*data){    getDefInRow()->parse(data);}// *****************************************************************************// DefIn::parseTrack()//// This function uses the DefInTrack helper class to create oaTrackPattern(s)// for the track data given by the parser.// *****************************************************************************voidDefIn::parseTrack(defiTrack *data){    getDefInTrack()->parse(data);}// *****************************************************************************// DefIn::parseGCellGrid()//// This function handles the "GCELLGRID" DEF construct.//// Syntax://   [GCELLGRID//       {X start DO numColumns+1 STEP space} ...//       {Y start DO numRows+1 STEP space ;} ...]//// The GCELLGRID statements are stored in OA as oaGCellPatterns. An X GCELLGRID// (vertical lines) is mapped to a horizontal oaGCellPattern.// *****************************************************************************voidDefIn::parseGCellGrid(defiGcellGrid *data){    oaBoolean	isHorizontal = true;    if (strcmp(data->macro(), "Y") == 0) {	isHorizontal = false;    }        oaGCellPattern  *gCellPattern	= oaGCellPattern::create(topBlock(), isHorizontal,				 scaleToDBU(data->x()),				 scaleToDBU(data->xStep()), data->xNum());}// *****************************************************************************// DefIn::parseVia()//// This function uses the DefInVia helper class to create an oaViaDef in// the temporary table of vias for the via data given by the parser.// *****************************************************************************voidDefIn::parseVia(defiVia   *data){    if (getOptions()->createRouting()) {	getDefInVia()->parse(data);    }}// *****************************************************************************// DefIn::parseStyle()//// This function uses the DefInStyle helper class to create oaSegStyle(s) for// the DEF style data given by the parser.// *****************************************************************************voidDefIn::parseStyle(defiStyles  *data){    if (getOptions()->createRouting()) {	getDefInStyle()->parse(data);    }}// *****************************************************************************// DefIn::parseNDR()//// This function uses the DefInNDR helper class to create an oaConstraintGroup// for the DEF NONDEFAULTRULE data given by the parser.// *****************************************************************************voidDefIn::parseNDR(defiNonDefault	*data){    getDefInNDR()->parse(data);}// *****************************************************************************// DefIn::parseRegion()//// This function uses the DefInRegion helper class to create a cluster and// clusterBoundaries for the region data given by the parser.// *****************************************************************************voidDefIn::parseRegion(defiRegion	*data){    getDefInRegion()->parse(data);}// *****************************************************************************// DefIn::parseComponent()//// This function uses the DefInComponent helper class to create an instance// for the component data given by the parser.// *****************************************************************************voidDefIn::parseComponent(defiComponent *data){    if(!getDefInComponent()->parse(data)) {	unresolvedMasters = true;    }}// *****************************************************************************// DefIn::parsePin()// // This function use the DefInPin helper class to create a terminal (with net)// and potentially physical pin for the pin data given by the parser.// *****************************************************************************voidDefIn::parsePin(defiPin	*data){    getDefInPin()->parse(data);}// *****************************************************************************// DefIn::parsePinPropDef()//// This function handles the "PINPROPERTIES" DEF construct.//// Syntax://   [PINPROPERTIES num;//       [- {compName pinName | PIN pinName}//           [+ PROPERTY {propName propVal} ...] ...//       ;] ...//   END PINPROPERTIES]//// The PINPROPERTIES are stored in OA as oaProps of the type that was specified// by the preceding PROPERTYDEFINITION.// *****************************************************************************voidDefIn::parsePinPropDef(defiPinProp  *data){    oaObject	    *object;    oaSimpleName    simplePinName;    getSimpleName(data->pinName(), simplePinName);        if (data->isPin()) {	object = getTerm(simplePinName);    } else {	oaSimpleName	simpleInstName;	getSimpleName(data->instName(), simpleInstName);	object = getInstTerm(getInst(simpleInstName), simplePinName);    }    if (object) {	for (int i = 0; i < data->numProps(); i++) {	    LefDefProp  *propDef = getProp(data->propName(i), cLefDefComponentPin);	    createProp(propDef, object, data->propValue(i));	}    }}// *****************************************************************************// DefIn::parseSNet()//// This function uses the DefInNet helper class to create a net for the// special net data given by the parser.// *****************************************************************************voidDefIn::parseSNet(defiNet  *data){    getDefInNet()->parse(data, true);}// *****************************************************************************// DefIn::parseNet()//// This function uses the DefInNet helper class to create a net for the net// data given by the parser.// *****************************************************************************voidDefIn::parseNet(defiNet	*data){    getDefInNet()->parse(data);}// *****************************************************************************// DefIn::parseScanChain()//// This function uses the DefInScanChain helper class to create scanChains// for the scanChain data given by the parser.// *****************************************************************************voidDefIn::parseScanChain(defiScanchain *data){    getDefInScanChain()->parse(data);}// *****************************************************************************// DefIn::parseGroupName()//// This function uses the DefInGroup helper class to create a cluster// for the group data given by the parser.// *****************************************************************************voidDefIn::parseGroupName(const char  *data){    getDefInGroup()->parse(data);}// *****************************************************************************// DefIn::parseGroupMember()//// This function uses the DefInGroup helper class to add instances as// members of the current group from the data given by the parser.// *****************************************************************************voidDefIn::parseGroupMember(const char  *data){    getDefInGroup()->addMember(data);}// *****************************************************************************// DefIn::parseGroup()//// This function uses the DefInGroup helper class to set attributes on// the current group from the data given by the parser.// *****************************************************************************voidDefIn::parseGroup(defiGroup *data){    getDefInGroup()->parseAttributes(data);}// *****************************************************************************// DefIn::parseBlockages()//// This function uses the DefInBlockage helper class to create oaBlockage(s)// for the blockage data given by the parser.// *****************************************************************************voidDefIn::parseBlockages(defiBlockage  *data){    getDefInBlockage()->parse(data);}// *****************************************************************************// DefIn::parseFill()//// This function is called for each fill found in the "FILLS" DEF construct.//// Syntax://   [FILLS numFills ;//      [- LAYER layerName//         {RECT pt pt | POLYGON pt pt pt ...} ...//      ;] ...//   END FILLS]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -