You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like incorrect CSE occurs in the attached multi-drive conflict scenario. In particular, a multi-driven conflicting wire seems to still be used for CSE even when its actual value is undefined due to the conflict.
In the attached example, two independent 3-input ANDs are implemented via replication of the Bug module (which implements a single 3-input AND). The behavior of these ANDs should be entirely independent of one another. Due to erroneous CSE involving the conflicting output however, this is not the case.
SV files again as snippets:
moduleBug
(
inputwire a,
inputwire b,
inputwire c,
outputwire conflicting,
outputwire regular
);
assign conflicting = a & b;
assign regular = a & b & c; // CSE turns this into seemingly correct `conflicting & c`endmodule
moduleTop
(
inputwire a[1:0],
inputwire b[1:0],
inputwire c[1:0],
outputwire regular[1:0]
);
wire conflict; // erroneously driven by both instances of modBugbug[1:0](a, b, c, conflict, regular);
endmodule
Thanks for the small test case, if you need a workaround -fno-dfg probably would prevent the CSE, but note that multiple driver resolution in this case is not handled well in Verilator in general.
Thanks! This fortunately isn't a real issue for me either. I just stumbled across this while debugging and thought you might want to have a look
wsnyder
added
status: ready
Issue is ready for someone to fix; then goes to 'status: assigned'
and removed
new
New issue not seen by maintainers
labels
May 10, 2024
bug.zip
It seems like incorrect CSE occurs in the attached multi-drive conflict scenario. In particular, a multi-driven conflicting wire seems to still be used for CSE even when its actual value is undefined due to the conflict.
In the attached example, two independent 3-input ANDs are implemented via replication of the
Bug
module (which implements a single 3-input AND). The behavior of these ANDs should be entirely independent of one another. Due to erroneous CSE involving theconflicting
output however, this is not the case.SV files again as snippets:
The bug is also apparent in the generated CPP:
What 'verilator' command line do we use to run your example?
verilator --cc --exe --build -j 0 Top_tb.cpp Top.sv Bug.sv
What 'verilator --version' are you using? Did you try it with the git master version?
Verilator 5.022 2024-02-24 rev UNKNOWN.REV
What OS and distribution are you using?
6.6.19-1-MANJARO
The text was updated successfully, but these errors were encountered: