Fix unexpected RefDType on assoc arrays (#4337)

This commit is contained in:
Aleksander Kiryk
2023-07-04 18:13:22 +05:00
committed by GitHub
parent 97feba6898
commit fcbd7c87af
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -383,7 +383,8 @@ public:
void visit(AstAssocSel* nodep) override {
iterateAndNextConstNull(nodep->fromp());
putbs(".at(");
AstAssocArrayDType* const adtypep = VN_AS(nodep->fromp()->dtypep(), AssocArrayDType);
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());
@@ -395,7 +396,8 @@ public:
void visit(AstWildcardSel* nodep) override {
iterateAndNextConstNull(nodep->fromp());
putbs(".at(");
AstWildcardArrayDType* const adtypep = VN_AS(nodep->fromp()->dtypep(), WildcardArrayDType);
AstWildcardArrayDType* const adtypep
= VN_AS(nodep->fromp()->dtypep()->skipRefp(), WildcardArrayDType);
UASSERT_OBJ(adtypep, nodep, "Wildcard select on non-wildcard-associative type");
iterateAndNextConstNull(nodep->bitp());
puts(")");
+2 -1
View File
@@ -23,7 +23,8 @@ module t (/*AUTOARG*/
begin
// Type
typedef bit [3:0] nibble_t;
string a [nibble_t];
typedef string dict_t [nibble_t];
dict_t a;
string b [nibble_t];
nibble_t k;
string v;