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

📄 lef2oa.cpp

📁 openaccess读def,lef文件所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// lef2oa.cpp//// This is the main for the 'lef2oa' 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: shaun $//  $Revision: 1.63 $//  $Date: 2005/06/06 17:44:00 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaUtil.h"#include "oaUtilApp.h"#include "oaLefDef.h"using namespace oaUtil;using namespace oaLefDef;// *****************************************************************************// Declare the name of the application.// *****************************************************************************static const oaString	toolName = "lef2oa";// *****************************************************************************// lef2oaBuild// *****************************************************************************class lef2oaBuild : public oaBuildInfo {			    lef2oaBuild() : oaBuildInfo(toolName,							OA_BUILD_NAME,							OA_BUILD_TIME,							OA_BUILD_NUMBER) {}  private:    static lef2oaBuild	    buildInfo;};// *****************************************************************************// oaLefInApp// *****************************************************************************class oaLefInApp : public oaUtil::TranslatorApp<TechReaderOptions> {  public:			    oaLefInApp();    oaBoolean		    validateArgs();    void		    run();  private:    void		    processLayerMap(const oaString  &fileName);    LefIn		    reader;    LefInOptions	    options;    Arg<ArgList>	    lefOption;    Arg<oaString>	    viewOption;    Arg<oaString>	    layerMapOption;    Arg<oaString>	    commentCharOption;};// *****************************************************************************// Initialize static data members.// *****************************************************************************lef2oaBuild	lef2oaBuild::buildInfo;// *****************************************************************************// oaLefInApp::oaLefInApp()//// This	is the constructor for the oaLefInApp.  It takes no arguments,// but it does set defaults which may be changed via the other methods of the// option class.// *****************************************************************************oaLefInApp::oaLefInApp():   oaUtil::TranslatorApp<TechReaderOptions>("Translates LEF to OpenAccess"),    reader(_msgs),    lefOption(_args, "lef", "-lef file", "LEF file name(s)"),    viewOption(_args, "view", "[-view viewName]",	       "Output view name (default: abstract)", "abstract"),    layerMapOption(_args, "layerMap", "[-layerMap mapFile]",		   "Defines layer numbers", ""),    commentCharOption(_args, "commentChar", "[-commentChar char]",		      "Identifies the comment character", "#"){    }// *****************************************************************************// lef2oaOptions::getOptions()//// This function populates the LefInOptions object using the options defined// for lef2oa// *****************************************************************************oaBooleanoaLefInApp::validateArgs(){    oaString	value;        // Common options    if (_args.getLibOption()->getValue(value)) {	options.setLibName(value);    }    if (_args.getLibPathOption()->getValue(value)) {	options.setLibPath(value);    }    options.setLibOptions(_libOptions);    if (_args.getTechLibOption()->getValue(value)) {	options.setTechLibName(value);    }    if (_args.getTechLibPathOption()->getValue(value)) {	options.setTechLibPath(value);    }    options.setTechLibOptions(_techLibOptions);    options.setOverwrite(_args.getOverwriteOption()->isSpecified());    // lef2oa specific options    ArgList lefFiles;    lefOption.getValue(lefFiles);    for (oaUInt4 i = 0; i < lefFiles.getNumElements(); i++) {	options.addFileName(lefFiles[i]);    }    if (viewOption.getValue(value)) {	options.setViewName(value);    }    if (commentCharOption.getValue(value) && value.getLength() > 0) {	options.setCommentChar(*value);    }    if (layerMapOption.getValue(value)) {	processLayerMap(value);    }    return true;}// *****************************************************************************// lef2oaOptions::processLayerMap()//// This function populates the LefInLayerMap object using the mappings in the // layerMap file.// *****************************************************************************voidoaLefInApp::processLayerMap(const oaString  &fileName){    FILE	*lmap = fopen(fileName, "r");    if (!lmap) {        fprintf(stderr, "Could not open layerMap file \"%s\".\n",                (const char *) fileName);        return;    }    oaUInt4	maxChars = 1000;    oaChar	buf[1000];    oaUInt4     i(0);    while (fgets(buf, maxChars - 1, lmap)) {        i++;	oaChar  layerName[100];	oaUInt4 layerNum;        	// Skip commented out lines	if (buf[0] == '#') {	    continue;	}        	if (sscanf(buf, "%s%d", layerName, &layerNum) != 2) {            fprintf(stderr,                    "PARSE ERROR in layer map file line %u. Ignored\n", i);	}        options.addLayerMap(layerName, layerNum);    }    fclose(lmap);}// *****************************************************************************// oaLefInApp::run()//// This function runs the translator and reports statistics.// *****************************************************************************voidoaLefInApp::run(){    reader.run(&options);}// *****************************************************************************// main()//// This is the main function for the 'lef2oa' translator.// *****************************************************************************intmain(int argc, char **argv){    oaDesignInit();    oaLefInApp  app;    try {	app.main(argc, argv);    } catch (oaException	&excp) {	app.error(excp.getMsg());    }    return app.getExitStatus();}

⌨️ 快捷键说明

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