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
This commit is contained in:
Wilson Snyder 2006-08-29 00:27:04 +00:00
parent 7758877166
commit eec5c8bf6d
5 changed files with 25 additions and 3 deletions

View File

@ -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.

View File

@ -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<value>
Tune the inlining of modules. The default value of 2000 specifies that up

View File

@ -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\"<<endl; );\n");
#ifndef NEW_ORDERING
@ -1350,13 +1353,15 @@ void EmitCImp::emitInt(AstModule* modp) {
emitVarList(modp->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

View File

@ -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; }

View File

@ -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; }