From 882913f0ca66d5e405178fda824ddd90ac25d625 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 22 Jul 2015 20:14:58 -0400 Subject: [PATCH] Add tracing_on, etc to vlt files, bug932. --- Changes | 2 ++ bin/verilator | 34 ++++++++++++++++++++-------------- src/V3Config.cpp | 8 ++++---- src/V3Config.h | 2 +- src/verilog.l | 3 +++ src/verilog.y | 28 ++++++++++++++++++++++------ 6 files changed, 52 insertions(+), 25 deletions(-) diff --git a/Changes b/Changes index 36e384be9..bf8534d77 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,8 @@ indicates the contributor was also the author of the fix; Thanks! * Verilator 3.875 devel +*** Add tracing_on, etc to vlt files, bug932. [Frederic Requin] + **** Fix MinGW compiler error, bug927, bug929. [Hans Tichelaar] **** Fix .c files to be treated as .cpp, bug930. [Jonathon Donaldson] diff --git a/bin/verilator b/bin/verilator index 519e9343d..d4d87a774 100755 --- a/bin/verilator +++ b/bin/verilator @@ -1923,33 +1923,39 @@ The grammar of configuration commands is as follows: Take remaining text up the the next `verilog mode switch and treat it as Verilator configuration commands. +=item coverage_on [-file "" [-lines [ - ]]] + =item coverage_off [-file "" [-lines [ - ]]] -Disable coverage for the specified filename (or wildcard with '*' or '?', -or all files if omitted) and range of line numbers (or all lines if +Enable/disable coverage for the specified filename (or wildcard with '*' or +'?', or all files if omitted) and range of line numbers (or all lines if omitted). Often used to ignore an entire module for coverage analysis purposes. +=item lint_on [-msg ] [-file "" [-lines [ - ]]] + =item lint_off [-msg ] [-file "" [-lines [ - ]]] -Disables the specified lint warning, in the specified filename (or wildcard -with '*' or '?', or all files if omitted) and range of line numbers (or all -lines if omitted). +Enable/disables the specified lint warning, in the specified filename (or +wildcard with '*' or '?', or all files if omitted) and range of line +numbers (or all lines if omitted). -Using '*' will override any lint_on directives in the source, i.e. the -warning will still not be printed. +With lint_off using '*' will override any lint_on directives in the source, +i.e. the warning will still not be printed. -If the -msg is omitted, all lint warnings are disabled. This will override -all later lint warning enables for the specified region. +If the -msg is omitted, all lint warnings are enabled/disabled. This will +override all later lint warning enables for the specified region. + +=item tracing_on [-file "" [-lines [ - ]]] =item tracing_off [-file "" [-lines [ - ]]] -Disable waveform tracing for all future signals declared in the specified -filename (or wildcard with '*' or '?', or all files if omitted) and range -of line numbers (or all lines if omitted). +Enable/disable waveform tracing for all future signals declared in the +specified filename (or wildcard with '*' or '?', or all files if omitted) +and range of line numbers (or all lines if omitted). -Cells below any module in the files/ranges specified will also not be -traced. +For tracing_off, cells below any module in the files/ranges specified will +also not be traced. =back diff --git a/src/V3Config.cpp b/src/V3Config.cpp index bf9019804..a78a6dbb7 100644 --- a/src/V3Config.cpp +++ b/src/V3Config.cpp @@ -144,12 +144,12 @@ V3ConfigIgnores V3ConfigIgnores::s_singleton; //###################################################################### // V3Config -void V3Config::addIgnore(V3ErrorCode code, string filename, int min, int max) { +void V3Config::addIgnore(V3ErrorCode code, bool on, string filename, int min, int max) { if (filename=="*") { - FileLine::globalWarnOff(code,true); + FileLine::globalWarnOff(code,!on); } else { - V3ConfigIgnores::singleton().addIgnore(code, filename, min, false); - if (max) V3ConfigIgnores::singleton().addIgnore(code, filename, max, true); + V3ConfigIgnores::singleton().addIgnore(code, filename, min, on); + if (max) V3ConfigIgnores::singleton().addIgnore(code, filename, max, !on); } } diff --git a/src/V3Config.h b/src/V3Config.h index 557507752..3ddc77485 100644 --- a/src/V3Config.h +++ b/src/V3Config.h @@ -30,7 +30,7 @@ class V3Config { public: - static void addIgnore(V3ErrorCode code, string filename, int min, int max); + static void addIgnore(V3ErrorCode code, bool on, string filename, int min, int max); static void applyIgnores(FileLine* filelinep); }; diff --git a/src/verilog.l b/src/verilog.l index f2de1aad1..c683152e1 100644 --- a/src/verilog.l +++ b/src/verilog.l @@ -167,8 +167,11 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} {crnl} { NEXTLINE(); } /* Count line numbers */ "coverage_off" { FL; return yVLT_COVERAGE_OFF; } + "coverage_on" { FL; return yVLT_COVERAGE_ON; } "lint_off" { FL; return yVLT_LINT_OFF; } + "lint_on" { FL; return yVLT_LINT_ON; } "tracing_off" { FL; return yVLT_TRACING_OFF; } + "tracing_on" { FL; return yVLT_TRACING_ON; } -?"-file" { FL; return yVLT_D_FILE; } -?"-lines" { FL; return yVLT_D_LINES; } diff --git a/src/verilog.y b/src/verilog.y index a8c1c114a..fb3beeeac 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -243,8 +243,11 @@ class AstSenTree; %token yaSCDTOR "`systemc_imp_header BLOCK" %token yVLT_COVERAGE_OFF "coverage_off" -%token yVLT_LINT_OFF "lint_off" -%token yVLT_TRACING_OFF "tracing_off" +%token yVLT_COVERAGE_ON "coverage_on" +%token yVLT_LINT_OFF "lint_off" +%token yVLT_LINT_ON "lint_on" +%token yVLT_TRACING_OFF "tracing_off" +%token yVLT_TRACING_ON "tracing_on" %token yVLT_D_FILE "--file" %token yVLT_D_LINES "--lines" @@ -3625,10 +3628,14 @@ package_scopeIdFollows: // IEEE: package_scope // VLT Files vltItem: - vltOffFront { V3Config::addIgnore($1,"*",0,0); } - | vltOffFront yVLT_D_FILE yaSTRING { V3Config::addIgnore($1,*$3,0,0); } - | vltOffFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM { V3Config::addIgnore($1,*$3,$5->toUInt(),$5->toUInt()+1); } - | vltOffFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM '-' yaINTNUM { V3Config::addIgnore($1,*$3,$5->toUInt(),$7->toUInt()+1); } + vltOffFront { V3Config::addIgnore($1,false,"*",0,0); } + | vltOffFront yVLT_D_FILE yaSTRING { V3Config::addIgnore($1,false,*$3,0,0); } + | vltOffFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM { V3Config::addIgnore($1,false,*$3,$5->toUInt(),$5->toUInt()+1); } + | vltOffFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM '-' yaINTNUM { V3Config::addIgnore($1,false,*$3,$5->toUInt(),$7->toUInt()+1); } + | vltOnFront { V3Config::addIgnore($1,true,"*",0,0); } + | vltOnFront yVLT_D_FILE yaSTRING { V3Config::addIgnore($1,true,*$3,0,0); } + | vltOnFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM { V3Config::addIgnore($1,true,*$3,$5->toUInt(),$5->toUInt()+1); } + | vltOnFront yVLT_D_FILE yaSTRING yVLT_D_LINES yaINTNUM '-' yaINTNUM { V3Config::addIgnore($1,true,*$3,$5->toUInt(),$7->toUInt()+1); } ; vltOffFront: @@ -3640,6 +3647,15 @@ vltOffFront: if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<: + yVLT_COVERAGE_ON { $$ = V3ErrorCode::I_COVERAGE; } + | yVLT_TRACING_ON { $$ = V3ErrorCode::I_TRACING; } + | yVLT_LINT_ON { $$ = V3ErrorCode::I_LINT; } + | yVLT_LINT_ON yVLT_D_MSG yaID__ETC + { $$ = V3ErrorCode((*$3).c_str()); + if ($$ == V3ErrorCode::EC_ERROR) { $1->v3error("Unknown Error Code: "<<*$3<