📄 oaveriloginstubtest.cpp
字号:
// *****************************************************************************// *****************************************************************************// oaVerilogInStubTest.cpp//// This file contains the implementation of the test driver for Verilog reader's// stub test.//// *****************************************************************************// 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.16 $// $Date: 2005/05/19 00:48:51 $// $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaVerilogInTest.h"#ifndef WINDOWS#include <sys/types.h>#include <sys/stat.h>#endif// *****************************************************************************// oaVerilogInStubTest::oaVerilogInStubTest//// This is the constructor for the oaVerilogInStubTest.// *****************************************************************************oaVerilogInStubTest::oaVerilogInStubTest(const oaString &name, oaBoolean noEMH, oaBoolean EMH, oaBoolean trace): oaVerilogInTest(name, noEMH, EMH, trace){}// *****************************************************************************// oaVerilogInStubTest::test()//// This method is the main entry point for the test.// *****************************************************************************oaBooleanoaVerilogInStubTest::test(){ preTest(); openOutputFile(); enableCallbacks(true); try { // Create a cellView that does not have a design to verify that // we can still create a stub and not destroy the existing cellView. oaNativeNS ns; oaString libNameStr(getName() + "_designEMH"); oaString cellNameStr("scalarOrder"); oaString viewNameStr("abstract"); oaScalarName myLibName(ns, libNameStr); oaScalarName cellName(ns, cellNameStr); oaScalarName viewName(ns, viewNameStr); openLib(libNameStr); oaLib *lib = oaLib::find(myLibName); oaCellView::get(lib, cellName, viewName, oaViewType::get(oacNetlist)); // Run the stub test. MsgAdapter msgs; msgs.setOutFile(tout.outFile); msgs.setLogFile(NULL); oaString testcase = getPathToData() + ds + getName() + ".v"; VerilogIn reader(msgs); OptionsIn &readerOptions = reader.getOptions(); readerOptions.enableTolerate(); readerOptions.enableFileAndLine(fullErrorMessages); readerOptions.enableBlackBox(); testReader(reader, testcase); // Verify that the stub CellView still exists. if (!oaCellView::find(lib, cellName, viewName)) { tout.print("Error: the %s.%s.%s cellView should still exist\n", (const char*) libNameStr, (const char*) cellNameStr, (const char*) viewNameStr); } cleanup(libNameStr); } catch(Error &verr) { tout.print(verr.getMsg()); closeOutputFile(); enableCallbacks(false); throw; } catch(oaException &oaErr) { tout.print((const char*) oaErr.getMsg()); closeOutputFile(); enableCallbacks(false); throw; } catch(...) { tout.print("Caught an exception that was not handled by the reader.\n"); closeOutputFile(); enableCallbacks(false); throw; } closeOutputFile(); enableCallbacks(false); return compareOutputByName(getName());}// *****************************************************************************// oaVerilogInStubTest::testReader()//// This method tests a given reader.// *****************************************************************************voidoaVerilogInStubTest::testReader(VerilogIn &reader, const oaString &testcase){ oaString myLibName; OptionsIn &readerOptions = reader.getOptions(); readerOptions.getMsgAdapter()->setOutFile(tout.outFile); readerOptions.getMsgAdapter()->setLogFile(NULL); if (doNoEMH) { reader.enableDesignPerMod(true); myLibName = getName() + "_design"; openLib(myLibName); tout.print(starLine); tout.print("* No Explode, No EMH\n"); tout.print(starLine); reader.enableDesignPerMod(true); readerOptions.setLibName(myLibName); readerOptions.addFile(testcase); try { reader.parse(); tout.print("Reader succeeded\n\n\n\n"); cleanup(myLibName); } catch (...) { cleanup(myLibName); throw; } } if (doEMH) { reader.enableDesignPerMod(false); myLibName = getName() + "_designEMH"; openLib(myLibName); tout.print(starLine); tout.print("* No Explode, EMH\n"); tout.print(starLine); readerOptions.setLibName(myLibName); readerOptions.addFile(testcase); try { reader.parse(); tout.print("Reader succeeded\n\n\n\n"); } catch (...) { cleanup(myLibName); throw; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -