Add error when `resetall inside module

This commit is contained in:
Wilson Snyder 2019-12-14 22:04:58 -05:00
parent 2408de16a0
commit 460e0541f3
7 changed files with 23 additions and 5 deletions

View File

@ -14,6 +14,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Add vpiTimeUnit and allow to specify time as string, bug1636. [Stefan Wallentowitz]
**** Add error when `resetall inside module (IEEE 2017-22.3).
**** Fix little endian cell ranges, bug1631. [Julien Margetts]

View File

@ -927,8 +927,8 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
"`protect" { FL_FWD; FL_BRK; }
"`remove_gatenames" { FL_FWD; FL_BRK; } // Verilog-XL compatibility
"`remove_netnames" { FL_FWD; FL_BRK; } // Verilog-XL compatibility
"`resetall" { FL_FWD; PARSEP->fileline()->warnOn(V3ErrorCode::I_DEF_NETTYPE_WIRE, true);
FL_BRK; } // Rest handled by preproc
"`resetall" { FL; PARSEP->fileline()->warnOn(V3ErrorCode::I_DEF_NETTYPE_WIRE, true);
return yaT_RESETALL; } // Rest handled by preproc
"`suppress_faults" { FL_FWD; FL_BRK; } // Verilog-XL compatibility
"`timescale"{ws}+[^\n\r]* { FL_FWD; FL_BRK; } // Verilog spec - not supported
"`uselib"{ws}+[^\n\r]* { FL_FWD; FL_BRK; } // Verilog-XL compatibility

View File

@ -287,6 +287,8 @@ class AstSenTree;
%token<strp> yaD_IGNORE "${ignored-bbox-sys}"
%token<strp> yaD_DPI "${dpi-sys}"
%token<fl> yaT_RESETALL "`resetall"
// <fl> is the fileline, abbreviated to shorten "$<fl>1" references
%token<fl> '!'
%token<fl> '#'
@ -742,6 +744,7 @@ description: // ==IEEE: description
| bind_directive { if ($1) GRAMMARP->unitPackage($1->fileline())->addStmtp($1); }
// unsupported // IEEE: config_declaration
// // Verilator only
| yaT_RESETALL { } // Else, under design, and illegal based on IEEE 22.3
| vltItem { }
| error { }
;

View File

@ -1,8 +1,8 @@
%Warning-IMPLICIT: t/t_lint_implicit_def_bad.v:10: Signal definition not found, creating implicitly: 'imp_warn'
%Warning-IMPLICIT: t/t_lint_implicit_def_bad.v:12: Signal definition not found, creating implicitly: 'imp_warn'
assign imp_warn = 1'b1;
^~~~~~~~
... Use "/* verilator lint_off IMPLICIT */" and lint_on around source to disable this message.
%Error: t/t_lint_implicit_def_bad.v:15: Signal definition not found, and implicit disabled with `default_nettype: 'imp_err'
%Error: t/t_lint_implicit_def_bad.v:17: Signal definition not found, and implicit disabled with `default_nettype: 'imp_err'
assign imp_err = 1'b1;
^~~~~~~
%Error: Exiting due to

View File

@ -7,6 +7,8 @@ module t (a,z);
input a;
output z;
sub sub ();
assign imp_warn = 1'b1;
// verilator lint_off IMPLICIT
assign imp_ok = 1'b1;
@ -16,8 +18,10 @@ module t (a,z);
`default_nettype wire
assign imp_ok2 = 1'b1;
endmodule
`default_nettype none
`resetall
module sub;
assign imp_ok3 = 1'b1;
endmodule

View File

@ -1,4 +1,7 @@
%Error: t/t_pp_pragma_bad.v:6: `pragma is missing a pragma_expression.
`pragma
^~~~~~~
%Error: Exiting due to
%Error: t/t_pp_pragma_bad.v:10: syntax error, unexpected `resetall
`resetall
^~~~~~~~~
%Error: Cannot continue

View File

@ -4,3 +4,9 @@
// without warranty, 2019 by Wilson Snyder.
`pragma
`resetall // Ok
module t;
`resetall // Bad
endmodule
`resetall // Ok