diff --git a/Changes b/Changes index 35ece85a1..b91e2f6bc 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,8 @@ indicates the contributor was also the author of the fix; Thanks! ** Support command-line -G/+pvalue param overrides, bug1045. [Stefan Wallentowitz] +*** Add --l2-name option for controlling "v" naming, bug1050. + * Verilator 3.882 2016-03-01 diff --git a/bin/verilator b/bin/verilator index f7f0e2c25..4d912b987 100755 --- a/bin/verilator +++ b/bin/verilator @@ -291,6 +291,7 @@ descriptions in the next sections for more information. --inline-mult Tune module inlining -LDFLAGS Linker pre-object flags for makefile -LDLIBS Linker library flags for makefile + --l2-name Verilog scope name of the top module --language Default language standard to parse +libext++[ext]... Extensions for finding modules --lint-only Lint, but do not make output @@ -785,6 +786,15 @@ called LDLIBS as that's the Makefile variable it controls. (In Make, LDFLAGS is before the first object, LDLIBS after. -L libraries need to be in the Make variable LDLIBS, not LDFLAGS.) +=item --l2-name I + +Instead of using the module name when showing Verilog scope, use the name +provided. Default is "--l2-name v" and is used to standardize some wrapping +methodologies. + +The program "module t; initial $display("= %m"); endmodule" will show by +default "= t". With "--l2-name v" it will print "= v". + =item --language I A synonym for C<--default-langauge>, for compatibility with other tools and diff --git a/src/V3LinkLevel.cpp b/src/V3LinkLevel.cpp index 6ac4ae6fb..7cea0580d 100644 --- a/src/V3LinkLevel.cpp +++ b/src/V3LinkLevel.cpp @@ -113,7 +113,7 @@ void V3LinkLevel::wrapTopCell(AstNetlist* netlistp) { // Add instance AstCell* cellp = new AstCell(newmodp->fileline(), - (v3Global.opt.l2Name() ? "v" : oldmodp->name()), + ((v3Global.opt.l2Name()!="") ? v3Global.opt.l2Name() : oldmodp->name()), oldmodp->name(), NULL, NULL, NULL); cellp->modp(oldmodp); diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 7fdb1730c..844aaa5f2 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -693,7 +693,6 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char 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, "-lint-only", flag/*ref*/) ) { m_lintOnly = flag; } else if ( !strcmp (sw, "-no-pins64") ) { m_pinsBv = 33; } else if ( onoff (sw, "-order-clock-delay", flag/*ref*/) ) { m_orderClockDly = flag; } @@ -813,6 +812,16 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char shift; addLdLibs(argv[i]); } + else if ( !strcmp (sw, "-l2-name") && (i+1) ["--mod-prefix modPrefix --top-module t --l2-name l2Name"], + ); + +execute ( + check_finished=>1, + ); + +ok(1); +1; diff --git a/test_regress/t/t_flag_names.v b/test_regress/t/t_flag_names.v new file mode 100644 index 000000000..3f9b43bb2 --- /dev/null +++ b/test_regress/t/t_flag_names.v @@ -0,0 +1,23 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2016 by Wilson Snyder. + +module t; + sub sub (); +endmodule + +module sub; + string scope; + initial begin + scope = $sformatf("%m"); + $write("[%0t] In %s\n", $time, scope); +`ifdef VERILATOR + if (scope != "top.l2Name.sub") $stop; +`else + if (scope != "top.t.sub") $stop; +`endif + $write("*-* All Finished *-*\n"); + $finish; + end +endmodule