📄 oaveriloginoptionstest.cpp
字号:
// *****************************************************************************// *****************************************************************************// oaVerilogInOptionsTest.cpp//// This file contains the implementation of the oaVerilogInOptionsTest class.//// *****************************************************************************// 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.20 $// $Date: 2005/07/08 01:27:45 $// $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaVerilogInTest.h"// *****************************************************************************// oaVerilogInOptionsTest::oaVerilogInOptionsTest()//// This is the constructor for the oaVerilogInOptionsTest class.// *****************************************************************************oaVerilogInOptionsTest::oaVerilogInOptionsTest(const oaString &name, oaBoolean doNoEMH, oaBoolean doEMH): oaVerilogInTest(name, doNoEMH, doEMH){}// *****************************************************************************// myCallbacks// *****************************************************************************class myCallbacks : public ModuleCallbacksIn { public: myCallbacks(const Scanner &scanIn, OptionsIn &optIn); virtual void all(); virtual oaTermType genTermType(const oaName &termName, const oaTermType requestedType, const oaModNet *net);};// *****************************************************************************// myCallbacks::myCallbacks()//// This is the constructor for the myCallbacks class. The myCallbacks class// is a "user" defined callbacks class that slightly modifies the behavior // of the default callbacks.// *****************************************************************************myCallbacks::myCallbacks(const Scanner &scanIn, OptionsIn &optIn): ModuleCallbacksIn(scanIn, optIn){}// *****************************************************************************// myCallbacks::all()//// This is the method that is called at the end of parsing. This method// calls the base class all() method before writing a simple message to the// log file. // *****************************************************************************voidmyCallbacks::all(){ ModuleCallbacksIn::all(); options.getMsgAdapter()->printInfo("User defined callback was used " "successfully.\n");}// *****************************************************************************// myCallbacks::genTermType()//// *****************************************************************************oaTermTypemyCallbacks::genTermType(const oaName &termName, const oaTermType requestedType, const oaModNet *net){ return CallbacksIn::genTermType(termName, requestedType, net);}// *****************************************************************************// oaVerilogInOptionsTest::test()//// This method is the main entry point for the test.// *****************************************************************************oaBooleanoaVerilogInOptionsTest::test(){ preTest(); openOutputFile(); enableCallbacks(true); try { oaString testcase = getPathToData() + ds + getName() + ".v"; MsgAdapter *initialMsgs = new MsgAdapter; initialMsgs->setOutFile(tout.outFile); initialMsgs->setLogFile(NULL); VerilogIn reader(*initialMsgs); OptionsIn &readerOptions = reader.getOptions(); const LibMgrOptions &libOptions = readerOptions.getLibOptions(); LibMgrOptions newOptions; oaString myLogFileName = getPathToData() + ds + getName() + ".log"; myCallbacks cb(reader.getScanner(), readerOptions); MsgAdapter msgs; newOptions.setDMAttr(libOptions.getDMAttr()); readerOptions.setLibOptions(newOptions); readerOptions.setMsgAdapter(&msgs); delete initialMsgs; reader.setCallbacks(cb); oaString path; readerOptions.setLibPath(getName() + "Lib"); readerOptions.getLibPath(path); if (path != oaString(getName() + "Lib")) { tout.print("Unexpected library path: %s\n", (const char*) path); } oaString dmSystem; readerOptions.setDMSystem("oaDMTurbo"); readerOptions.getDMSystem(dmSystem); if (dmSystem != "oaDMTurbo") { tout.print("Unexpected DM system: %s\n", (const char*) dmSystem); } readerOptions.getMsgAdapter()->setOutFile(tout.outFile); readerOptions.getMsgAdapter()->setLogFile(myLogFileName); readerOptions.enableTolerate(); readerOptions.enableFileAndLine(fullErrorMessages); readerOptions.setTopModuleName("top"); readerOptions.setViewName("myview"); readerOptions.setViewType("maskLayout"); readerOptions.setTieHighNet(oaScalarName(oaVerilogNS(), "myTieHigh")); readerOptions.setTieLowNet(oaScalarName(oaVerilogNS(), "myTieLow")); readerOptions.setGlobalModuleName("myGlobals"); testReader(reader, testcase); } 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());}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -