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
Write out a cpp model, or complain about the RTL source
Actual behavior
ERROR: Assert `flow.wire_comb_defs[it].size() == 1' failed in backends/cxxrtl/cxxrtl_backend.cc:2811.
Further troubleshooting
If I check out efc4327 and re-add this line that was removed by that commit, the assertion does not fire on either the Verilog source or the reduced testcase:
diff --git a/backends/cxxrtl/cxxrtl_backend.cc b/backends/cxxrtl/cxxrtl_backend.cc
index dfdb9df74..cec5dc0a5 100644
--- a/backends/cxxrtl/cxxrtl_backend.cc
+++ b/backends/cxxrtl/cxxrtl_backend.cc
@@ -2794,6 +2794,7 @@ struct CxxrtlWorker {
for (auto wire : module->wires()) {
const auto &wire_type = wire_types[wire];
auto &debug_wire_type = debug_wire_types[wire];
+ if (wire_type.type == WireType::UNUSED) continue;
if (!debug_info) continue;
if (wire->port_input || wire_type.is_buffered())
I can also avoid tripping the assertion with a small change in the Verilog source, namely putting all 3 accumulator loops in a single always @ (*) block, instead of across 3 of them, which is probably a better way to write it anyway:
module hazard3_shift_barrel #(
parameter W_DATA = 32,
parameter W_SHAMT = 5
) (
input wire [W_DATA-1:0] din,
input wire [W_SHAMT-1:0] shamt,
input wire right_nleft,
input wire arith,
output reg [W_DATA-1:0] dout
);
integer i;
reg [W_DATA-1:0] din_rev;
reg [W_DATA-1:0] shift_accum;
wire sext = arith && din_rev[0]; // haha
always @ (*) begin
for (i = 0; i < W_DATA; i = i + 1)
din_rev[i] = right_nleft ? din[W_DATA - 1 - i] : din[i];
shift_accum = din_rev;
for (i = 0; i < W_SHAMT; i = i + 1) begin
if (shamt[i]) begin
shift_accum = (shift_accum << (1 << i)) |
({W_DATA{sext}} & ~({W_DATA{1'b1}} << (1 << i)));
end
end
for (i = 0; i < W_DATA; i = i + 1)
dout[i] = right_nleft ? shift_accum[W_DATA - 1 - i] : shift_accum[i];
end
endmodule
The text was updated successfully, but these errors were encountered:
module \hazard3_shift_barrel
wire width 32 $0\i[31:0]
wire width 32 $1\i[31:0]
wire width 32 signed \i
process $proc$hazard3_shift_barrel.v:18$5
sync always
update \i $0\i[31:0]
end
process $proc$hazard3_shift_barrel.v:23$38
sync always
update \i $1\i[31:0]
end
end
Sigh okay, this is... ultimately a problem with the Verilog frontend. It produces unsound RTLIL, where i is written from multiple processes. The CXXRTL crash points to a genuine problem handling certain edge cases and can be fixed on its own though.
As requested by @whitequark, opening a second issue for the other assertion mentioned on #2881
Steps to reproduce the issue
Either this bugpoint output
hazard3-shifter-bug.il
:Or this Verilog source
hazard3_shift_barrel.v
, from which the above ilang was reduced:Use any Yosys version from efc4327 to 9af8895. Either of these will trigger the assertion:
or
Expected behavior
Write out a cpp model, or complain about the RTL source
Actual behavior
Further troubleshooting
If I check out efc4327 and re-add this line that was removed by that commit, the assertion does not fire on either the Verilog source or the reduced testcase:
I can also avoid tripping the assertion with a small change in the Verilog source, namely putting all 3 accumulator loops in a single
always @ (*)
block, instead of across 3 of them, which is probably a better way to write it anyway:The text was updated successfully, but these errors were encountered: