Fix false unused message on __Vemumtab, msg3180.

This commit is contained in:
Wilson Snyder 2019-12-02 19:03:33 -05:00
parent 00979ede14
commit b0669f3aca
4 changed files with 73 additions and 0 deletions

View File

@ -34,6 +34,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix labels on functions with returns, bug1614. [Mitch Hayenga]
**** Fix false unused message on __Vemumtab, msg3180. [Tobias Rosenkranz]
* Verilator 4.022 2019-11-10

View File

@ -292,6 +292,9 @@ private:
|| (m_taskp && (m_taskp->dpiImport() || m_taskp->dpiExport()))) {
entryp->usedWhole();
}
if (nodep->valuep()) {
entryp->drivenWhole();
}
}
// Discover variables used in bit definitions, etc
iterateChildren(nodep);

17
test_regress/t/t_bug3180.pl Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2019 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
scenarios(simulator => 1);
compile(
verilator_flags2 => ['-Wall -Wno-DECLFILENAME --coverage-line'],
);
ok(1);
1;

View File

@ -0,0 +1,51 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Wilson Snyder.
module t
(/*AUTOARG*/
// Outputs
someOutput,
// Inputs
clk, reset_l, InOne, InTwo
);
input clk;
input reset_l;
input InOne, InTwo;
output logic someOutput;
typedef enum {
STATE_ONE,
STATE_TWO,
STATE_THREE,
STATE_FOUR
} some_state_t;
some_state_t some_FSM;
always_ff @ (posedge clk or negedge reset_l) begin
if(!reset_l)
some_FSM <= some_FSM.first;
else begin
unique case (some_FSM)
STATE_ONE, STATE_TWO, STATE_THREE: begin
if(InOne & InTwo)
some_FSM <= some_FSM.next;
else if(InOne)
some_FSM <= some_FSM;
else
some_FSM <= some_FSM.first;
end
default: begin
some_FSM <= STATE_ONE;
end
endcase
end
end
always_comb begin
someOutput = (some_FSM == STATE_FOUR);
end
endmodule