Fix Replicate with unsigned count but MSB set
Correctly compute witdh of AstReplicate in its constructor when the count is unsigned but its MSB is set. Fixes #6231
This commit is contained in:
parent
1725ee9c52
commit
8030476d87
|
@ -3367,8 +3367,9 @@ public:
|
|||
: ASTGEN_SUPER_Replicate(fl, lhsp, rhsp) {
|
||||
if (lhsp) {
|
||||
if (const AstConst* const constp = VN_CAST(rhsp, Const)) {
|
||||
if (constp->num().isFourState() || constp->num().isNegative()) { // V3Width warns
|
||||
dtypeSetLogicSized(lhsp->width(), VSigning::UNSIGNED);
|
||||
if (constp->num().isFourState()
|
||||
|| (constp->dtypep()->isSigned() && constp->num().isNegative())) {
|
||||
dtypeSetLogicSized(lhsp->width(), VSigning::UNSIGNED); // V3Width warns
|
||||
} else {
|
||||
dtypeSetLogicSized(lhsp->width() * constp->toSInt(), VSigning::UNSIGNED);
|
||||
}
|
||||
|
|
|
@ -243,6 +243,10 @@ module t (
|
|||
assign ascending_assign[4:7] = arand_b[0:3];
|
||||
`signal(ASCENDING_ASSIGN, ascending_assign);
|
||||
|
||||
// Special cases to be covered
|
||||
`signal(REPLICATE_WIDTH, {4'd8{rand_a[0]}}); // Replicate count unsigned, but MSB set
|
||||
if ($bits(REPLICATE_WIDTH) != 8) $fatal("%0d != 8", $bits(REPLICATE_WIDTH));
|
||||
|
||||
// Sel from not requires the operand to have a sinle sink, so can't use
|
||||
// the chekc due to the raw expression referencing the operand
|
||||
wire [63:0] sel_from_not_tmp = ~(rand_a >> rand_b[2:0] << rand_a[3:0]);
|
||||
|
|
Loading…
Reference in New Issue