📄 oaverilogunconnectedtest.cpp
字号:
// *****************************************************************************// *****************************************************************************// oaVerilogOutUnconnectedTest.cpp//// This file contains the implementation of the oaVerilogOutUnconnectedTest 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.4 $// $Date: 2005/07/09 17:35:33 $// $State: Exp $// *****************************************************************************// *****************************************************************************#include "oaVerilogOutTest.h"// *****************************************************************************// oaVerilogOutUnconnectedTest::oaVerilogOutUnconnectedTest()//// This is the constructor for the oaVerilogOutUnconnectedTest class.// *****************************************************************************oaVerilogOutUnconnectedTest::oaVerilogOutUnconnectedTest(const oaString &name): oaVerilogOutTest(name){}// *****************************************************************************// oaVerilogOutUnconnectedTest::buildLeaf()//// This function builds an abstract "Leaf" cell. The "Leaf" cell contains// multi-bit, terminals.// *****************************************************************************oaDesign*oaVerilogOutUnconnectedTest::buildLeaf(const oaScalarName &myLibName) { oaScalarName cellName(vns, "leaf"); oaScalarName viewName(vns, "abstract"); oaDesign *design = oaDesign::open(myLibName, cellName, viewName, oaViewType::get(oacNetlist), 'w'); oaModule *module = oaModule::create(design, cellName); oaVectorName in(ns, "in[3:0]"); oaVectorName out(ns, "out[3:0]"); oaModBusTerm::create(oaModBusNet::create(module, in), in, oacInputTermType); oaModBusTerm::create(oaModBusNet::create(module, out), out, oacOutputTermType); design->setTopModule(module); design->scalarize(); design->save(); return design;}// *****************************************************************************// oaVerilogOutUnconnectedTest::buildTop()//// This function builds an abstract top cell that instantiates the leaf.// *****************************************************************************voidoaVerilogOutUnconnectedTest::buildTop(const oaScalarName &myLibName, const oaScalarName &cellName, const oaScalarName &viewName){ oaDesign *leaf = buildLeaf(myLibName); oaDesign *design = oaDesign::open(myLibName, cellName, viewName, oaViewType::get(oacNetlist), 'w'); oaModule *module = oaModule::create(design, cellName); oaModScalarInst *inst = oaModScalarInst::create(module, leaf); oaModInstTerm::create(oaModScalarNet::create(module), inst, oaName(vns, "in[1]")); oaModInstTerm::create(oaModScalarNet::create(module), inst, oaName(vns, "out[0]")); design->setTopModule(module); design->save(); design->close();}// *****************************************************************************// oaVerilogOutUnconnectedTest::buildLib()//// This function builds a library of cells for the writer to operate on.// *****************************************************************************voidoaVerilogOutUnconnectedTest::buildLib(const oaString libPath, const oaString cellName, const oaString viewName){ oaScalarName myLibName(ns, libPath); oaLib *lib = oaLib::find(myLibName); if (!lib && oaLib::exists(libPath)) { oaLib::open(myLibName, libPath); } if (!lib) { lib = oaLib::create(myLibName, libPath); } buildTop(myLibName, oaScalarName(ns, cellName), oaScalarName(ns, viewName));}// *****************************************************************************// oaVerilogOutUnconnectedTest::test()//// This method is the main entry point for the test.// *****************************************************************************oaBooleanoaVerilogOutUnconnectedTest::test(){ preTest(); openOutputFile(); const oaString outFile("temp.v"); MsgAdapter msgs; const oaString lib(getName() + "Lib"); try { const oaString cell("top"); const oaString view("netlist"); buildLib(lib, cell, view); VerilogOut writer(msgs); OptionsOut &writerOptions = writer.getOptions(); writerOptions.setFileName(outFile); writerOptions.setLibName(lib); writerOptions.setCellName(cell); writerOptions.setViewName(view); writerOptions.enableRecursive(true); writerOptions.enableProduceLeaf(); writer.write(); } 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 writer.\n"); closeOutputFile(); throw; } FILE *moduleFP = fopen((const char*) outFile, "r"); if (moduleFP) { char buf[128]; while (fgets(buf, 127, moduleFP)) { tout.printLine(buf); } fclose(moduleFP); } else { tout.printLine("Unable to open test.v output file\n"); } closeOutputFile(); cleanup(lib); return compareOutputByName(getName());}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -