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

📄 oaverilogouttest.cpp

📁 openaccess与verilog互相转化时所用的源代码
💻 CPP
字号:
// *****************************************************************************// *****************************************************************************// oaVerilogOutTest.cpp//// This file contains the implementation of the	test driver for	the OpenAccess// to Verilog Writer.//// *****************************************************************************// 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	istributed in any way, in any medium,// in whole or in part,	without	prior written permission from Cadence.////		  Copyright 2003-2005 Cadence Design	Systems, Inc.//			     All Rights	Reserved.////  $Author: shaun $//  $Revision: 1.19 $//  $Date: 2005/07/09 17:27:54 $//  $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaVerilogOutTest.h"// *****************************************************************************// oaVerilogOutTest::oaVerilogOutTest//// This is the constructor for the oaVerilogOutTest.// *****************************************************************************oaVerilogOutTest::oaVerilogOutTest(const oaString   &name): oaVerilogTest(name),  libStr(getName() + "Lib"),  cellStr("top"),  viewStr("netlist"),  libN(ns, libStr),  cellN(ns, cellStr),  viewN(ns, viewStr){}// *****************************************************************************// oaVerilogOutTest::buildData()//// This function builds the test data for the test.// *****************************************************************************voidoaVerilogOutTest::buildData(){    oaString	testcase = getPathToData() + ds + getName() + ".v";    MsgAdapter  msgs;    try	{	openLib(libStr);	msgs.setOutFile(NULL);	VerilogIn   reader(msgs);	OptionsIn   &readerOptions = reader.getOptions();	readerOptions.setLibName(libStr);	readerOptions.enableTolerate();	readerOptions.enableFileAndLine(true);	readerOptions.addFile(testcase);	reader.parse();    }    catch(Error    &verr) {	tout.print(verr.getMsg());	closeOutputFile();	throw;    }    catch(oaException	 &oaErr) {	tout.print((const char*) oaErr.getMsg());	closeOutputFile();	throw;    }    catch(...) {	tout.print("Caught an exception that was not handled by the reader.\n");	closeOutputFile();	throw;    }}// *****************************************************************************// oaVerilogOutTest::test()//// This method is the main entry point for the test.// *****************************************************************************oaBooleanoaVerilogOutTest::test(){    preTest();    openOutputFile();    buildData();    oaString	    testcase = getPathToData() + ds + getName() + ".v";    MsgAdapter	    msgs;    const oaString  outFile("temp.v");    oaLib	    *lib = oaLib::find(libN);    msgs.setOutFile(NULL);    try {	lib->getAccess(oacWriteLibAccess);	VerilogOut  writer(msgs);	OptionsOut  &writerOptions = writer.getOptions();	writerOptions.setLibName(libStr);	writerOptions.setFileName((const char*) outFile);	writerOptions.enableRecursive(true);	oaIter<oaCellView>  cvIter(lib->getCellViews());	oaString	    cellNameStr;	oaString	    viewNameStr;	while (oaCellView *cv = cvIter.getNext()) {	    cv->getCell()->getName(vns, cellNameStr);	    cv->getView()->getName(vns, viewNameStr);	    if (cv->getPrimary() && cv->getPrimary()->existsOnDisk()) {		writerOptions.setCellName(cellNameStr);		writerOptions.setViewName(viewNameStr);		writer.write();	    }	}        lib->releaseAccess();    }    catch(Error &verr) {        lib->releaseAccess();	tout.print(verr.getMsg());	closeOutputFile();	throw;    }    catch(oaException   &oaErr) {        lib->releaseAccess();	tout.print((const char*) oaErr.getMsg());	closeOutputFile();	throw;    }    catch(...) {        lib->releaseAccess();	tout.print("Caught an exception that was not handled by the writer.\n");	closeOutputFile();	throw;    }    copyFileToOutput(outFile);    cleanup(libStr);    closeOutputFile();    return compareOutputByName(getName());}// *****************************************************************************// oaVerilogOutTest::copyFileToOutput()//// This function copies the given file to the test output.// *****************************************************************************voidoaVerilogOutTest::copyFileToOutput(const oaString   &srcFileName){    FILE    *fp = fopen((const char*) srcFileName, "r");    if (fp) {	char buf[128];	while (fgets(buf, 127, fp)) {	    tout.printLine(buf);	}	fclose(fp);    } else {	tout.printLine("Unable to read file %s\n", (const char*) srcFileName);    }}

⌨️ 快捷键说明

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