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

📄 oalefin.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
📖 第 1 页 / 共 3 页
字号:
// LefIn::parseAntennaOutput()//// This	function handles the 'ANTENNAOUTPUTDIFFAREA' LEF construct // (Antenna Size construct from	5.4 LEF	version	only).// Global antenna values are stored as legacy properties for lef output	only.// *****************************************************************************voidLefIn::parseAntennaOutput(double  data){    if (data < 0.0) {	error(cAntennaAreaOutputNegative, data);	return;    }    setProp(getLegacyProp(), cLefAntennaOutputDiffArea, data);}// *****************************************************************************// LefIn::parseAntennaInout()//// This	function handles the 'ANTENNAINOUTDIFFAREA' LEF	construct// (Antenna Size construct from	5.4 LEF	version	only).// Global antenna values are stored as legacy properties for lef output	only.// *****************************************************************************voidLefIn::parseAntennaInout(double	  data){    if (data < 0.0) {	error(cAntennaAreaInOutNegative, data);	return;    }    setProp(getLegacyProp(), cLefAntennaInOutDiffArea, data);}// *****************************************************************************// LefIn::parseInputAntenna()//// This	function handles the 'INPUTPINANTENNASIZE' LEF construct.// (Antenna Size construct old syntax).// Global antenna values are stored as legacy properties for lef output	only.// *****************************************************************************voidLefIn::parseInputAntenna(double	  data){    if (data < 0.0) {	error(cAntennaPinInputNegative, data);	return;    }    setProp(getLegacyProp(), cLefAntennaInputGateArea, data);}// *****************************************************************************// LefIn::parseOutputAntenna()//// This	function handles the 'OUTPUTPINANTENNASIZE' LEF	construct.// (Antenna Size construct old syntax).// Global antenna values are stored as legacy properties for lef output	only.// *****************************************************************************voidLefIn::parseOutputAntenna(double  data){    if (data > 0.0) {	error(cAntennaPinOutputPositive, data);	return;    }    setProp(getLegacyProp(), cLefAntennaOutputDiffArea, -data);}// *****************************************************************************// LefIn::parseInoutAntenna()//// This	function handles the 'INOUTPINANTENNASIZE' LEF construct.// (Antenna Size construct old syntax).// Global antenna values are stored as legacy properties for lef output	only.// *****************************************************************************voidLefIn::parseInoutAntenna(double	  data){    if (data > 0.0) {	error(cAntennaPinInOutPositive, data);	return;    }    setProp(getLegacyProp(), cLefAntennaInOutDiffArea, -data);}// *****************************************************************************// LefIn::parseLayer()//// This	function uses the LefInLayer helper class to create an oaLayer// for the layer data given by the parser.// *****************************************************************************voidLefIn::parseLayer(lefiLayer	*data){    getLefInLayer()->parse(data);}// *****************************************************************************// LefIn::parseMaxViaStack()//// This	function parses	the maxviastack	construct.// The max via stack is	stored as an attribute on oaTech.// *****************************************************************************voidLefIn::parseMaxViaStack(lefiMaxStackVia	  *data){    oaValue *v = oaIntValue::create(tech(), data->maxStackVia());        if (!data->hasMaxStackViaRange()) {	return setConstraint(getFoundryRules(), oacViaStackLimit, v);    }    oaLayer *bottomLayer = getLayer(data->maxStackViaBottomLayer());    oaLayer *topLayer    = getLayer(data->maxStackViaTopLayer());    oaValue *vBottom = oaLayerValue::create(tech(), bottomLayer->getNumber());    oaValue *vTop    = oaLayerValue::create(tech(), topLayer->getNumber());    oaConstraintParamArray  params;    oaConstraintParamDef    *defBottom = oaConstraintParamDef::get(oacLowerLayerConstraintParamType);    oaConstraintParamDef    *defTop    = oaConstraintParamDef::get(oacUpperLayerConstraintParamType);    params.append(oaConstraintParam::create(defBottom, vBottom));    params.append(oaConstraintParam::create(defTop, vTop));    setConstraint(getFoundryRules(), oacViaStackLimit, v, true, &params);}// *****************************************************************************// LefIn::parseVia()//// This	function uses the LefInVia class to create an oaVia for// the via data	given by the parser.// *****************************************************************************voidLefIn::parseVia(lefiVia	  *data){    getLefInVia()->parse(data);}// *****************************************************************************// LefIn::parseViaRule()//// This	function handles the 'VIARULE' and 'VIARULE GENERATE' LEF constructs.// *****************************************************************************voidLefIn::parseViaRule(lefiViaRule	  *data){    getLefInViaRule()->parse(data);}// *****************************************************************************// LefIn::parseSpacing()//// This	function handles the 'SPACING' LEF construct.// *****************************************************************************voidLefIn::parseSpacing(lefiSpacing	  *data){    oaPhysicalLayer *layer1 = getLayer(data->name1());    oaPhysicalLayer *layer2 = getLayer(data->name2());    oaValue	    *v = oaIntValue::create(tech(), uuToDBU(data->distance()));    if (layer1 == layer2) {	setConstraint(getFoundryRules(), oacMinSameNetSpacing,  		      layer1->getNumber(), v);    } else {	if (layer1->getMaterial() != oacCutMaterial	    || layer2->getMaterial() !=	oacCutMaterial)	{	    throw LefDefError(cSpacingCutLayersOnly,			      data->name1(), data->name2());	}	setConstraint(getFoundryRules(), oacMinSameNetClearance,		      layer1->getNumber(), layer2->getNumber(), v);	if (data->hasStack()) {	    v = oaBooleanValue::create(tech(), true);	    setConstraint(getFoundryRules(), oacViaStackingAllowed,			  layer1->getNumber(), layer2->getNumber(), v);	}    }}// *****************************************************************************// LefIn::parseNonDefaultRule()//// This	function handles the 'NONDEFAULTRULE' LEF construct.// It uses the LefInNDR	class to create	a routeSpec for	the nondefault rule// data	given by the parser.// *****************************************************************************voidLefIn::parseNonDefaultRule(lefiNonDefault *data){    getLefInNDR()->parse(data);}// *****************************************************************************// LefIn::parseSite()//// This	function uses the LefInSite class to create a oaSite for// the site data given by the parser.// *****************************************************************************voidLefIn::parseSite(lefiSite *data){    getLefInSite()->parse(data);}// *****************************************************************************// LefIn::parseMacroBegin()//// This	function creates a new cellview	with the given name// *****************************************************************************voidLefIn::parseMacroBegin(const char *data){    getLefInMacro()->init();    oaString	    cellN(data);    oaScalarName    cellName(lefNS, cellN);    oaNativeNS	    unixNS;    oaChar mode	= 'w';    if (oaDesign::exists(options->getLibName(), cellName, options->getViewName())	&& !getOptions()->overwriteMode()) {	mode = 'a';    }    design() = oaDesign::open(options->getLibName(), cellName,			      options->getViewName(),			      oaViewType::get(oacMaskLayout), mode);    if (!topBlock()) {	oaBlock::create(design());    }}// *****************************************************************************// LefIn::parseMacro()//// This	function uses the LefInMacro class to create the attributes given// by the parser on the	current	design.	When finished, the design is saved and// closed.// *****************************************************************************voidLefIn::parseMacro(lefiMacro	*data){    try	{	getLefInMacro()->parse(data);    } catch (oaException    &err) {	design()->save();	design()->close();	design() = NULL;	throw err;    }    design()->save();    design()->close();    design() = NULL;}// *****************************************************************************// LefIn::parsePin()//// This	function uses the LefInPin helper class	to create a oaTerm on// the current design, with the	pin data given by the parser.// *****************************************************************************voidLefIn::parsePin(lefiPin	  *data){    getLefInPin()->parse(data);}// *****************************************************************************// LefIn::parseObstruction()//// This	function uses the LefInGeom helper class to create oaBlockages// in the current design using the data	supplied by the	parser.// *****************************************************************************voidLefIn::parseObstruction(lefiObstruction	*data){    if (design()->getMode() == 'a' && topBlock()->getBlockages().getCount()) {	oaString cellName;	design()->getCellName(lefNS, cellName);	throw LefDefError(cMacroObsExists, (const char *) cellName);    }    getLefInGeomObs()->parse(data->geometries());}    // *****************************************************************************// LefIn::parseDensity()//// This	function creates oaBlockages for the Density statements	in the LEF file.// *****************************************************************************voidLefIn::parseDensity(lefiDensity	*data){    for	(int i = 0; i <	data->numLayer(); i++) {	oaLayerNum  layerNum = getLayerNum(data->layerName(i));	for (int j = 0;	j < data->numRects(i); j++) {	    lefiGeomRect    lefRect = data->getRect(i, j);	    oaInt4	    llx	= uuToDBU(lefRect.xl);	    oaInt4	    lly	= uuToDBU(lefRect.yl);	    oaInt4	    urx	= uuToDBU(lefRect.xh);	    oaInt4	    ury	= uuToDBU(lefRect.yh);	    oaPointArray    points(4);	    points[0].x() = llx;	    points[0].y() = lly;	    points[1].x() = llx;	    points[1].y() = ury;	    points[2].x() = urx;	    points[2].y() = ury;	    points[3].x() = urx;	    points[3].y() = lly;	    points.setNumElements(4);	    oaBlockage  *blk = oaLayerBlockage::create(topBlock(),						       oacFillBlockageType,						       layerNum, points);	    blk->setDensity((oaFloat) data->densityValue(i, j));	}    }}    // *****************************************************************************// LefIn::init()//// This function initializes the helper objects. If none exist they are// allocated here.// *****************************************************************************voidLefIn::init(){    LefDefIn::init();    viaDefArray.setNumElements(0);    layerArray.setNumElements(0);    legacy = NULL;    initLib();    initTechDB();    initConstraints();}// *****************************************************************************// LefIn::initCallbacks()//// This	function registers all the callbacks routines before launching the// parser. Each	function will be automatically called when the parser finds the	// corresponding LEF construct in LEF file.// *****************************************************************************voidLefIn::initCallbacks(){    if (lefrInit()) {	throw LefDefError(cParserInitializeFailed);    }    lefrSetCaseSensitivity(true);    lefrSetVersionCbk(cbVersion);    lefrSetCaseSensitiveCbk(cbCaseSensitive);    lefrSetNoWireExtensionCbk(cbWireExtension);    lefrSetBusBitCharsCbk(cbBusBitChars);    lefrSetDividerCharCbk(cbDividerChar);    lefrSetManufacturingCbk(cbManufacturingGrid);    lefrSetUseMinSpacingCbk(cbUseMinSpacing);    lefrSetClearanceMeasureCbk(cbClearanceMeasure);    lefrSetUnitsCbk(cbUnits);    lefrSetPropCbk(cbProp);    lefrSetAntennaInputCbk(cbAntennaInput);    lefrSetAntennaOutputCbk(cbAntennaOutput);    lefrSetAntennaInoutCbk(cbAntennaInout);    lefrSetInputAntennaCbk(cbInputAntenna);    lefrSetOutputAntennaCbk(cbOutputAntenna);    lefrSetInoutAntennaCbk(cbInoutAntenna);    lefrSetLayerCbk(cbLayer);    lefrSetMaxStackViaCbk(cbMaxViaStack);    lefrSetViaCbk(cbVia);    lefrSetViaRuleCbk(cbViaRule);    lefrSetSpacingCbk(cbSpacing);    lefrSetNonDefaultCbk(cbNonDefaultRule);    lefrSetSiteCbk(cbSite);    lefrSetMacroBeginCbk(cbMacroBegin);    lefrSetMacroCbk(cbMacro);    lefrSetPinCbk(cbPin);    lefrSetObstructionCbk(cbObstruction);        lefrSetDensityCbk(cbDensity);    }// *****************************************************************************// LefIn::initLib()//// This	function opens or creates the specified	library. If no library path// is specified, it will use the library name as its path. // *****************************************************************************voidLefIn::initLib(){    oaString	libPath(options->getLibPath());    if (libPath.isEmpty()) {	options->getLibName().get(libPath);    }    lib() = oaUtil::LibMgr::create(options->getLibName(), libPath,				   options->getLibOptions());}// *****************************************************************************// LefIn::initTechDB()//// This	function finds or creates the technology database for the current// library. It uses the common oaUtil::LibMgr class to find the technology// database, and then finds or creates the lef specific data in that.// *****************************************************************************voidLefIn::initTechDB(){    oaScalarName    scalarTechLibName(options->getTechLibName());    oaString	    techLibPath(options->getTechLibPath());    oaString	    techLibName;    if (scalarTechLibName.isEmpty()) {	scalarTechLibName = options->getLibName();    }    scalarTechLibName.get(techLibName);    if (techLibPath.isEmpty()) {	techLibPath = techLibName;    }    oaLib   *techLib = oaUtil::LibMgr::create(scalarTechLibName, techLibPath,					      options->getTechLibOptions());        if (techLib != lib()) {	setAttachedTechLibName(lib(), techLibName);    }    // Open or create the tech database.    if (oaTech::exists(techLib)) {	techMode = 'r';	tech() = oaTech::open(techLib, techMode);	dbuPerUU = tech()->getDBUPerUU(oaViewType::get(oacMaskLayout));    } else {	techMode = 'w';	tech() = oaTech::create(techLib);	tech()->setDefaultManufacturingGrid(1);	tech()->setDBUPerUU(oaViewType::get(oacMaskLayout), dbuPerUU);    }    // Find or create LEFisms in the tech database.    legacy  = (oaHierProp*) oaProp::find(tech(), cLefLegacyProp);    if (legacy)	{	oaProp	*prop = oaProp::find(legacy, cLefOverlapLayer);	if (prop && prop->getType() == oacStringPropType) {	    ((oaStringProp*) prop)->getValue(overlapLayer);	}    }    if (!oaConstraintGroup::find(tech(), cLefDefaultRules)) {	oaConstraintGroup::create(tech(), cLefDefaultRules);    }}// *****************************************************************************// LefIn::initConstraints()// // This	function creates the default routespec from the	arrays// that	were built up during parsing// *****************************************************************************voidLefIn::initConstraints(){    oaSimpleConstraintDef *layerDef = oaSimpleConstraintDef::get(oacValidRoutingLayers);    oaSimpleConstraintDef *viaDef   = oaSimpleConstraintDef::get(oacValidRoutingVias);    oaConstraint    *c = NULL;    oaValue	    *v;        // Check and remove existing constraints for update mode    c = oaSimpleConstraint::find(getDefaultRules(), layerDef);    if (c) {	v = c->getValue();	if (v->getType() == oacLayerArrayValueType) {	    ((oaLayerArrayValue*) v)->get(layerArray);	}    }    c = oaSimpleConstraint::find(getDefaultRules(), viaDef);    if (c) {	v = c->getValue();	if (v->getType() == oacViaDefArrayValueType) {	    ((oaViaDefArrayValue*) v)->get(viaDefArray);	}    }}// *****************************************************************************// LefIn::createConstraints()// // This	function creates the default routespec from the	arrays// that	were built up during parsing// *****************************************************************************voidLefIn::createConstraints(){    oaValue	    *v;    if (layerArray.getNumElements()) {	v = getConstraint(getDefaultRules(), oacValidRoutingLayers);		if (v && v->getType() == oacLayerArrayValueType) {	    oaLayerArray    array;	    ((oaLayerArrayValue*) v)->get(array);	    if (layerArray != array) {		((oaLayerArrayValue*) v)->set(layerArray);	    }	} else {	    v = oaLayerArrayValue::create(tech(), layerArray);

⌨️ 快捷键说明

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