Fix unsigned replicate (#6229)

This commit is contained in:
Wilson Snyder 2025-07-24 22:55:26 -04:00
parent 94bebb2bcb
commit b408e097f6
3 changed files with 6 additions and 2 deletions

View File

@ -29,7 +29,7 @@ Verilator 5.039 devel
* Optimize more complex combinational assignments in DFG (#6205) (#6209). [Geza Lore]
* Optimize combinational cycles through arrays in DFG (#6210). [Geza Lore]
* Fix constructor parameters in inheritance hierarchies (#6036) (#6070). [Petr Nohavica]
* Fix replicate of negative giving 'REPLICATE has no expected width' internal error (#6048).
* Fix replicate of negative giving 'REPLICATE has no expected width' internal error (#6048) (#6229).
* Fix cmake `-Wno` compiler flag testing (#6145). [Martin Stadler]
* Fix class extends dotted error (#6162). [Igor Zaworski, Antmicro Ltd.]
* Fix genvar error with `-O0` (#6165). [Max Wipfli]

View File

@ -802,7 +802,8 @@ class WidthVisitor final : public VNVisitor {
const AstConst* const constp = VN_CAST(nodep->countp(), Const);
if (constp) {
if (constp->num().isFourState() || constp->num().isNegative()) {
if (constp->num().isFourState()
|| (constp->dtypep()->isSigned() && constp->num().isNegative())) {
nodep->v3error("Replication value of < 0 or X/Z not legal"
" (IEEE 1800-2023 11.4.12.1): "
<< constp->prettyNameQ());

View File

@ -15,4 +15,7 @@ module t #(
end
other = {32'bz{1'b1}};
end
wire ok1 = 1'b1;
wire [6:0] ok7 = {3'b111{ok1}}; // Ok
endmodule