📄 oaveriloginfilesystest.cpp
字号:
// *****************************************************************************// *****************************************************************************// oaVerilogInFileSysTest.cpp//// This file contains the implementation of the oaVerilogInFileSysTest 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: sailajad $// $Revision: 1.3 $// $Date: 2005/08/05 21:58:13 $// $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaVerilogInTest.h"// *****************************************************************************// oaVerilogInFileSysTest::oaVerilogInFileSysTest()//// This is the constructor for the oaVerilogInFileSysTest class.// *****************************************************************************oaVerilogInFileSysTest::oaVerilogInFileSysTest(const oaString &name, oaBoolean doNoEMH, oaBoolean doEMH, oaBoolean trace): oaVerilogInTest(name, doNoEMH, doEMH, trace){}// *****************************************************************************// oaVerilogInFileSysTest::preTest()//// This function makes preparations before the test is run. This includes// copying the input files.// *****************************************************************************voidoaVerilogInFileSysTest::preTest(){ if (copyRefFiles) { // Copy the main input file. oaString input = getName() + ".v"; oaString tmp; getRelPath(input, tmp); if (!tmp.isEmpty() && tmp != input) { copyFile(tmp, input); } // Copy the leaf input file. input = getName() + "Leaf.v"; getRelPath(input, tmp); if (!tmp.isEmpty() && tmp != input) { copyFile(tmp, input); } // Copy the ref file. input = getName() + ".ref"; getRelPath(input, tmp); if (!tmp.isEmpty() && tmp != input) { copyFile(tmp, input); } }}// *****************************************************************************// oaVerilogInFileSysTest::openLib()//// This function opens a test library.// *****************************************************************************voidoaVerilogInFileSysTest::openLib(const oaString &libNameStr){ LibMgrOptions defaultOptions; oaScalarName myLibName(vns, libNameStr); defaultOptions.setDMSystem("oaDMFileSys"); if (oaLib::find(myLibName) || oaLib::exists(libNameStr)) { LibMgr::append(myLibName, defaultOptions); } else { LibMgr::create(oaScalarName(vns, libNameStr), libNameStr, defaultOptions); }}// *****************************************************************************// oaVerilogInFileSysTest::buildLeafLib()//// This function builds a library of leaf cells for Verilog files to reference.// It must be called after the database is initialized but before the first// Verilog file is read. The library will be created in the current working// directory. // *****************************************************************************voidoaVerilogInFileSysTest::buildLeafLib(const oaString &leafLib, const oaString &leafFile){ MsgAdapter msgs; msgs.setOutFile(NULL); msgs.setErrFile(tout.outFile); msgs.setLogFile(NULL); VerilogIn reader(msgs); OptionsIn &readerOptions = reader.getOptions(); readerOptions.enableDesignPerMod(); readerOptions.addFile(leafFile); readerOptions.setLibName(leafLib); readerOptions.setViewName("abstract"); readerOptions.setViewType("maskLayout"); reader.parse(); tout.print("Leaf lib successfully built.\n\n\n\n");}// *****************************************************************************// oaVerilogInFileSysTest::test()//// This method is the main entry point for the test.// *****************************************************************************oaBooleanoaVerilogInFileSysTest::test(){ preTest(); openOutputFile(); enableCallbacks(true); oaString myLibName = getName(); try { oaString testcase = getPathToData() + ds + getName() + ".v"; oaNativeNS ns; tout.print(starLine); tout.print("* FileSys Leafs\n"); tout.print(starLine); cleanup(myLibName); openLib(myLibName); buildLeafLib(myLibName, getPathToData() + ds + getName() + "Leaf.v"); MsgAdapter msgs; msgs.setOutFile(tout.outFile); msgs.setLogFile(NULL); VerilogIn reader(msgs); OptionsIn &readerOptions = reader.getOptions(); oaString topModuleName("top"); readerOptions.setTopModuleName(topModuleName); readerOptions.enableTolerate(); readerOptions.addLeafLib(myLibName); readerOptions.addFile(testcase); readerOptions.setLibName(myLibName); readerOptions.enablePurgeLeafs(false); reader.parse(); tout.print("Reader succeeded\n\n\n\n"); oaDir viewDir(myLibName + ds + "top" + ds + "abstract"); verify(!viewDir.exists()); } 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); cleanup(myLibName); return result && compareOutputByName(getName());}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -