Add -Wall reporting ASSIGNDLY on assignment delays.

This commit is contained in:
Wilson Snyder 2011-10-20 20:50:42 -04:00
parent 4aa7222022
commit 0aa7c3f659
7 changed files with 29 additions and 6 deletions

View File

@ -9,6 +9,8 @@ indicates the contributor was also the author of the fix; Thanks!
*** Add configure options for cc warnings and extended tests. [Ruben Diez] *** Add configure options for cc warnings and extended tests. [Ruben Diez]
*** Add -Wall reporting ASSIGNDLY on assignment delays. [Ruben Diez]
*** Fix UNDRIVEN warnings inside DPI import functions. [Ruben Diez] *** Fix UNDRIVEN warnings inside DPI import functions. [Ruben Diez]
*** Fix --help output to go to stderr, not stdout, bug397. [Ruben Diez] *** Fix --help output to go to stderr, not stdout, bug397. [Ruben Diez]

View File

@ -943,8 +943,8 @@ enabled), but do not affect style messages. This is equivalent to
=item -Wwarn-style =item -Wwarn-style
Enable all code style related warning messages. This is equivalent to Enable all code style related warning messages. This is equivalent to
"-Wwarn-DECLFILENAME -Wwarn-DEFPARAM -Wwarn-INCABSPATH -Wwarn-SYNCASYNCNET "-Wwarn ASSIGNDLY -Wwarn-DECLFILENAME -Wwarn-DEFPARAM -Wwarn-INCABSPATH
-Wwarn-UNDRIVEN -Wwarn-UNUSED -Wwarn-VARHIDDEN". -Wwarn-SYNCASYNCNET -Wwarn-UNDRIVEN -Wwarn-UNUSED -Wwarn-VARHIDDEN".
=item -x-assign 0 =item -x-assign 0
@ -2377,6 +2377,18 @@ List of all warnings:
=over 4 =over 4
=item ASSIGNDLY
Warns that you have an assignment statement with a delayed time in front of
it, for example:
a <= #100 b;
assign #100 a = b;
Ignoring this warning may make Verilator simulations differ from other
simulators, however at one point this was a common style so disabled by
default as a code style warning.
=item BLKANDNBLK =item BLKANDNBLK
BLKANDNBLK is an error that a variable comes from a mix of blocked and BLKANDNBLK is an error that a variable comes from a mix of blocked and

View File

@ -55,6 +55,7 @@ public:
// Warning codes: // Warning codes:
EC_FIRST_WARN, // Just a code so the program knows where to start warnings EC_FIRST_WARN, // Just a code so the program knows where to start warnings
// //
ASSIGNDLY, // Assignment delays
BLKANDNBLK, // Blocked and non-blocking assignments to same variable BLKANDNBLK, // Blocked and non-blocking assignments to same variable
BLKSEQ, // Blocking assignments in sequential block BLKSEQ, // Blocking assignments in sequential block
CASEINCOMPLETE, // Case statement has missing values CASEINCOMPLETE, // Case statement has missing values
@ -107,6 +108,7 @@ public:
"MULTITOP", "TASKNSVAR", "BLKLOOPINIT", "MULTITOP", "TASKNSVAR", "BLKLOOPINIT",
// Warnings // Warnings
" EC_FIRST_WARN", " EC_FIRST_WARN",
"ASSIGNDLY",
"BLKANDNBLK", "BLKSEQ", "BLKANDNBLK", "BLKSEQ",
"CASEINCOMPLETE", "CASEOVERLAP", "CASEWITHX", "CASEX", "CDCRSTLOGIC", "CMPCONST", "CASEINCOMPLETE", "CASEOVERLAP", "CASEWITHX", "CASEX", "CDCRSTLOGIC", "CMPCONST",
"COMBDLY", "DEFPARAM", "DECLFILENAME", "COMBDLY", "DEFPARAM", "DECLFILENAME",
@ -142,7 +144,8 @@ public:
|| m_e==UNSIGNED || m_e==UNSIGNED
|| m_e==WIDTH); } || m_e==WIDTH); }
// Warnings that are style only // Warnings that are style only
bool styleError() const { return ( m_e==BLKSEQ bool styleError() const { return ( m_e==ASSIGNDLY // More than style, but for backward compatibility
|| m_e==BLKSEQ
|| m_e==DEFPARAM || m_e==DEFPARAM
|| m_e==DECLFILENAME || m_e==DECLFILENAME
|| m_e==INCABSPATH || m_e==INCABSPATH

View File

@ -1527,7 +1527,7 @@ assignOne<nodep>:
delayE: delayE:
/* empty */ { } /* empty */ { }
| delay_control { } /* ignored */ | delay_control { $1->v3warn(ASSIGNDLY,"Ignoring delay on this assignment/primitive."); } /* ignored */
; ;
delay_control<fl>: //== IEEE: delay_control delay_control<fl>: //== IEEE: delay_control

View File

@ -8,7 +8,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
# Version 2.0. # Version 2.0.
compile ( compile (
verilator_flags2 => ['-Wno-STMTDLY'], verilator_flags2 => ['-Wno-STMTDLY -Wno-ASSIGNDLY'],
); );
execute ( execute (

View File

@ -28,6 +28,7 @@ module t (/*AUTOARG*/
end end
else if (cyc==3) begin else if (cyc==3) begin
if (dly0 !== 32'h23) $stop; if (dly0 !== 32'h23) $stop;
if (dly2 !== 32'h25) $stop;
$write("*-* All Finished *-*\n"); $write("*-* All Finished *-*\n");
#100 $finish; #100 $finish;
end end

View File

@ -12,9 +12,14 @@ top_filename("t/t_delay.v");
$Self->{vlt} or $Self->skip("Verilator only test"); $Self->{vlt} or $Self->skip("Verilator only test");
compile ( compile (
verilator_flags2 => ['-Wall -Wno-DECLFILENAME'],
fails=>1, fails=>1,
expect=> expect=>
'%Warning-STMTDLY: t/t_delay.v:\d+: Ignoring delay on this delayed statement. '%Warning-ASSIGNDLY: t/t_delay.v:\d+: Ignoring delay on this assignment/primitive.
%Warning-ASSIGNDLY: Use .*
%Warning-ASSIGNDLY: t/t_delay.v:\d+: Ignoring delay on this assignment/primitive.
%Warning-ASSIGNDLY: t/t_delay.v:\d+: Ignoring delay on this assignment/primitive.
%Warning-STMTDLY: t/t_delay.v:\d+: Ignoring delay on this delayed statement.
.*%Error: Exiting due to.*', .*%Error: Exiting due to.*',
); );