Skip to content

Commit

Permalink
Fix select operation on assoc array with wide keys (verilator#4360)
Browse files Browse the repository at this point in the history
  • Loading branch information
RRozak authored Jul 12, 2023
1 parent 0774f82 commit ced1dfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/V3EmitCFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,7 @@ class EmitCFunc VL_NOT_FINAL : public EmitCConstInit {
AstAssocArrayDType* const adtypep
= VN_AS(nodep->fromp()->dtypep()->skipRefp(), AssocArrayDType);
UASSERT_OBJ(adtypep, nodep, "Associative select on non-associative type");
if (adtypep->keyDTypep()->isWide()) {
emitCvtWideArray(nodep->bitp(), nodep->fromp());
} else {
iterateAndNextConstNull(nodep->bitp());
}
iterateAndNextConstNull(nodep->bitp());
puts(")");
}
void visit(AstWildcardSel* nodep) override {
Expand Down
3 changes: 3 additions & 0 deletions test_regress/t/t_assoc.v
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ module t (/*AUTOARG*/
begin
// Wide-wides - need special array container classes, ick.
logic [91:2] a [ logic [65:1] ];
int b [ bit [99:0] ];
a[~65'hfe] = ~ 90'hfee;
`checkh(a[~65'hfe], ~ 90'hfee);
b[100'b1] = 1;
`checkh(b[100'b1], 1);
end

begin
Expand Down

0 comments on commit ced1dfe

Please sign in to comment.