Open aswaterman opened 4 years ago
Another example:
Is this closed by https://github.com/freechipsproject/firrtl/pull/1727?
For the above circuit, current (FIRRTL 1.4.0-RC2) generates the following Verilog for the above module M
example (randomization logic was manually removed):
module M(
input clock,
input i1,
input i2,
input i3,
input i4,
input i5,
input i6,
input i7,
output z
);
reg r;
wire _GEN_0 = i5 | r; // @[]
wire _GEN_1 = i4 ? _GEN_0 : r; // @[]
wire _GEN_2 = i7 ? _GEN_1 : r; // @[]
assign z = r;
always @(posedge clock) begin
if (i6) begin
if (i3) begin
r <= _GEN_2;
end else if (i2) begin
if (i1) begin
r <= 1'h0;
end else begin
r <= _GEN_2;
end
end else begin
r <= _GEN_2;
end
end else begin
r <= _GEN_2;
end
end
endmodule
Feature Description
When a register is updated by multiple nested when statements, the code generation starts to get rather expansive. Unfortunately, this hurts traditional Verilog line coverage metrics.
Here is an example, derived from rocket-chip:
The feature request is to emit something that looks like the original Firrtl, i.e., with 7
if
s instead of 12. (This might have to occur before the optimization that creates the bitwise-OR in_GEN_0
.)