From eec5c8bf6dcdcdb52ac7ec0d86d419f4e0d1c6d1 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 29 Aug 2006 00:27:04 +0000 Subject: [PATCH] Add --inhibit-sim switch so we can remove extra Vm_inhibitSim variable git-svn-id: file://localhost/svn/verilator/trunk/verilator@762 77ca24e4-aefa-0310-84f0-b9a241c72d87 --- Changes | 4 ++++ bin/verilator | 7 +++++++ src/V3EmitC.cpp | 14 +++++++++++--- src/V3Options.cpp | 1 + src/V3Options.h | 2 ++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 4292836f0..b428d4f90 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,10 @@ Revision history for Verilator The contributors that suggested a given feature are shown in []. [by ...] indicates the contributor was also the author of the fix; Thanks! +* Verilator 3.60** + +*** Added --inhibit-sim flag for environments using old __Vm_inhibitSim. + * Verilator 3.600 08/28/2006 ** Support dotted cross-hierarchy variable and task references. diff --git a/bin/verilator b/bin/verilator index a2a929108..4a04c3a36 100755 --- a/bin/verilator +++ b/bin/verilator @@ -297,6 +297,13 @@ the command line that implement the main loop for your simulation. Displays this message and program version and exits. +=item --inhibit-sim + +Create a "inhibitSim(bool)" function to enable and disable evaluation. +This allows a upper level testbench to disable modules that are not +important in a given simulation, without needing to recompile or change the +SystemC modules instantiated. + =item --inline-mult I Tune the inlining of modules. The default value of 2000 specifies that up diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index d3acca25f..93298a052 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1017,8 +1017,8 @@ void EmitCStmts::visit(AstDisplay* nodep, AstNUser*) { void EmitCImp::emitVarResets(AstModule* modp) { puts("// Reset internal values\n"); - puts("__Vm_inhibitSim = false;\n"); if (modp->isTop()) { + if (v3Global.opt.inhibitSim()) puts("__Vm_inhibitSim = false;\n"); puts("__Vm_activity = false;\n"); puts("__Vm_didInit = false;\n"); puts("\n"); @@ -1188,6 +1188,9 @@ void EmitCImp::emitWrapEval(AstModule* modp) { puts(symClassName()); puts("::init(this);\n"); puts("// Initialize\n"); puts("if (!__Vm_didInit) eval_initial_loop();\n"); + if (v3Global.opt.inhibitSim()) { + puts("if (__Vm_inhibitSim) return;\n"); + } puts("// Evaluate till stable\n"); puts("VL_DEBUG_IF(cout<<\"\\n----TOP Evaluate "+modClassName(modp)+"::eval\"<stmtsp(), EVL_TEMP, ""); puts("\n// INTERNAL VARIABLES\n"); - ofp()->putAlign(sizeof(bool)); ofp()->putsPrivate(!modp->isTop()); // private: unless top ofp()->putAlign(8); puts(symClassName()+"*\t__VlSymsp;\t\t// Symbol table\n"); ofp()->putsPrivate(false); // public: - puts("bool\t__Vm_inhibitSim;\t///< Manually set true to disable evaluation of module\n"); if (modp->isTop()) { + if (v3Global.opt.inhibitSim()) { + ofp()->putAlign(sizeof(bool)); + puts("bool\t__Vm_inhibitSim;\t///< Set true to disable evaluation of module\n"); + } ofp()->putAlign(sizeof(bool)); puts("bool\t__Vm_activity;\t\t///< Used by trace routines to determine change occurred\n"); ofp()->putAlign(sizeof(bool)); @@ -1418,6 +1423,9 @@ void EmitCImp::emitInt(AstModule* modp) { puts("void\tfinal();\t///< Function to call when simulation completed\n"); if (optSystemC()) ofp()->putsPrivate(true); ///< eval() is invoked by our sensitive() calls. puts("void\teval();\t///< Main function to call from calling app when inputs change\n"); + if (v3Global.opt.inhibitSim()) { + puts("void\tinhibitSim(bool flag) { __Vm_inhibitSim=flag; }\t///< Set true to disable evaluation of module\n"); + } ofp()->putsPrivate(true); // private: puts("void\teval_initial_loop();\n"); #ifndef NEW_ORDERING diff --git a/src/V3Options.cpp b/src/V3Options.cpp index f3f19ae4e..1f27a590d 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -368,6 +368,7 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) { else if ( onoff (sw, "-dump-tree", flag/*ref*/) ) { m_dumpTree = flag; } else if ( onoff (sw, "-exe", flag/*ref*/) ) { m_exe = flag; } else if ( onoff (sw, "-ignc", flag/*ref*/) ) { m_ignc = flag; } + else if ( onoff (sw, "-inhibit-sim", flag/*ref*/)){ m_inhibitSim = flag; } else if ( onoff (sw, "-l2name", flag/*ref*/) ) { m_l2Name = flag; } else if ( onoff (sw, "-pins64", flag/*ref*/) ) { m_pins64 = flag; } else if ( !strcmp (sw, "-private") ) { m_public = false; } diff --git a/src/V3Options.h b/src/V3Options.h index 3adfd6bbd..54add6350 100644 --- a/src/V3Options.h +++ b/src/V3Options.h @@ -51,6 +51,7 @@ class V3Options { bool m_dumpTree; // main switch: --dump-tree bool m_exe; // main switch: --exe bool m_ignc; // main switch: --ignc + bool m_inhibitSim; // main switch: --inhibit-sim bool m_l2Name; // main switch: --l2name bool m_outFormatOk; // main switch: --cc, --sc or --sp was specified bool m_pins64; // main switch: --pins64 @@ -142,6 +143,7 @@ class V3Options { bool allPublic() const { return m_public; } bool l2Name() const { return m_l2Name; } bool ignc() const { return m_ignc; } + bool inhibitSim() const { return m_inhibitSim; } int inlineMult() const { return m_inlineMult; } int outputSplit() const { return m_outputSplit; }