📄 oaverilogintest.cpp
字号:
// *****************************************************************************// *****************************************************************************// oaVerilogInTest.cpp//// This file contains the implementation of the test driver for the Verilog to // OpenAccess reader. //// *****************************************************************************// 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.37 $// $Date: 2005/07/09 02:11:36 $// $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaVerilogInTest.h"// *****************************************************************************// oaVerilogInTest::oaVerilogInTest//// This is the constructor for the oaVerilogInTest.// *****************************************************************************oaVerilogInTest::oaVerilogInTest(const oaString &name, oaBoolean noEMH, oaBoolean EMH, oaBoolean trace, oaBoolean refLib): oaVerilogTest(name), dumpObserver(name, tout), doNoEMH(noEMH), doEMH(EMH), traceEnabled(trace), usesRefLib(refLib), fullErrorMessages(false){}// *****************************************************************************// oaVerilogInTest::enableCallbacks()//// This function enables the callbacks for this test. If the given value is // false then the callbacks for this test are disabled. Only one test at// at time should have its callbacks enabled.// *****************************************************************************voidoaVerilogInTest::enableCallbacks(oaBoolean value){ dumpObserver.enable(value); if (traceEnabled) { debugDesign.enable(value); debugModule.enable(value); debugNet.enable(value); debugBusNetDef.enable(value); debugInstTerm.enable(value); debugInst.enable(value); debugTerm.enable(value); debugBusTermDef.enable(value); }}// *****************************************************************************// oaVerilogInTest::buildRefLib()//// This virtual function builds a simple reference library.// *****************************************************************************voidoaVerilogInTest::buildRefLib(const oaString &refLibName){ openLib(refLibName); oaScalarName libN(vns, refLibName); oaScalarName cellN(vns, "leafCell"); oaScalarName viewN(vns, "abstract"); oaDesign *d = oaDesign::open(libN, cellN, viewN, oaViewType::get(oacMaskLayout), 'w'); oaBlock *b = oaBlock::create(d); oaScalarName in(vns, "in"); oaVectorName out(vns, "out[1:0]"); oaTerm::create(oaNet::create(b, in), in, oacInputTermType)->setPosition(0); oaTerm::create(oaNet::create(b, out), out, oacOutputTermType)->setPosition(1); d->save(); d->close();}// *****************************************************************************// oaVerilogInTest::testReader()//// This method tests a given reader.// *****************************************************************************voidoaVerilogInTest::testReader(VerilogIn &reader, const oaString &testcase){ oaString refLibName(getName() + "RefLib"); if (usesRefLib) { buildRefLib(refLibName); } oaString myLibName; OptionsIn &readerOptions = reader.getOptions(); readerOptions.getMsgAdapter()->setOutFile(tout.outFile); readerOptions.getMsgAdapter()->setLogFile(NULL); if (doNoEMH) { reader.enableDesignPerMod(true); verify(reader.getOptions().testDesignPerMod()); myLibName = getName() + "_design"; openLib(myLibName); tout.print(starLine); tout.print("* No Explode, No EMH\n"); tout.print(starLine); readerOptions.setLibName(myLibName); readerOptions.addFile(testcase); if (usesRefLib) { readerOptions.addLeafLib(refLibName); } try { reader.parse(); tout.print("Reader succeeded\n\n\n\n"); cleanup(myLibName); } catch (...) { cleanup(myLibName); cleanup(refLibName); 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); if (usesRefLib) { readerOptions.addLeafLib(refLibName); } try { reader.parse(); tout.print("Reader succeeded\n\n\n\n"); cleanup(myLibName); } catch (...) { cleanup(myLibName); cleanup(refLibName); throw; } } cleanup(refLibName);}// *****************************************************************************// oaVerilogInTest::test()//// This method is the main entry point for the test.// *****************************************************************************oaBooleanoaVerilogInTest::test(){ preTest(); openOutputFile(); enableCallbacks(true); try { MsgAdapter msgs; oaString testcase = getPathToData() + ds + getName() + ".v"; VerilogIn reader(msgs); OptionsIn &readerOptions = reader.getOptions(); readerOptions.enableTolerate(); readerOptions.enableFileAndLine(fullErrorMessages); testReader(reader, testcase); } 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 result && compareOutputByName(getName());}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -