Fix regression due to early constant folding in +: and -: (#2338)
This commit is contained in:
parent
0f7677480f
commit
d20a4db773
|
|
@ -458,6 +458,7 @@ private:
|
||||||
UINFO(6, "SELPLUS/MINUS " << nodep << endl);
|
UINFO(6, "SELPLUS/MINUS " << nodep << endl);
|
||||||
// Below 2 lines may change nodep->widthp()
|
// Below 2 lines may change nodep->widthp()
|
||||||
if (debug() >= 9) nodep->dumpTree(cout, "--SELPM0: ");
|
if (debug() >= 9) nodep->dumpTree(cout, "--SELPM0: ");
|
||||||
|
V3Width::widthParamsEdit(nodep->rhsp()); // constifyEdit doesn't ensure widths finished
|
||||||
V3Const::constifyEdit(nodep->rhsp()); // May relink pointed to node, ok if not const
|
V3Const::constifyEdit(nodep->rhsp()); // May relink pointed to node, ok if not const
|
||||||
V3Const::constifyParamsEdit(nodep->thsp()); // May relink pointed to node
|
V3Const::constifyParamsEdit(nodep->thsp()); // May relink pointed to node
|
||||||
checkConstantOrReplace(nodep->thsp(), "Width of :+ or :- bit extract isn't a constant");
|
checkConstantOrReplace(nodep->thsp(), "Width of :+ or :- bit extract isn't a constant");
|
||||||
|
|
|
||||||
|
|
@ -74,4 +74,19 @@ module t (/*AUTOARG*/
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
// Additional constant folding check - this used to trigger a bug
|
||||||
|
reg [23:0] a;
|
||||||
|
reg [3:0] b;
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
a = 24'd0;
|
||||||
|
b = 4'b0111;
|
||||||
|
a[3*(b[2:0]+0)+:3] = 3'd7; // Check LSB expression goes to 32-bits
|
||||||
|
if (a != 24'b11100000_00000000_00000000) $stop;
|
||||||
|
|
||||||
|
a = 24'd0;
|
||||||
|
b = 4'b0110;
|
||||||
|
a[3*(b[2:0]+0)-:3] = 3'd7; // Check MSB expression goes to 32-bits
|
||||||
|
if (a != 24'b00000111_00000000_00000000) $stop;
|
||||||
|
end
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue