Fix class type as an associative array parameter (#4997).

This commit is contained in:
Wilson Snyder 2024-03-18 20:44:18 -04:00
parent 6ffff8565f
commit 93e5ca3f6d
3 changed files with 22 additions and 12 deletions

View File

@ -33,6 +33,7 @@ Verilator 5.023 devel
* Fix assignment of null into struct member (#4952).
* Fix object assignment from conditionals (#4968).
* Fix unpacked structure upper bit cleaning (#4978).
* Fix class type as an associative array parameter (#4997).
Verilator 5.022 2024-02-24

View File

@ -469,7 +469,7 @@ public:
this->elementsp(elementsp);
}
ASTGEN_MEMBERS_AstBracketArrayDType;
bool similarDType(const AstNodeDType* samep) const override { V3ERROR_NA_RETURN(false); }
bool similarDType(const AstNodeDType* samep) const override { return same(samep); }
AstNodeDType* subDTypep() const override VL_MT_STABLE { return childDTypep(); }
// METHODS
// Will be removed in V3Width, which relies on this

View File

@ -43,26 +43,35 @@ class Baz #(type T=Foo1);
endfunction
endclass
module t (/*AUTOARG*/
);
class WBase;
endclass
class Wrapper#(type VAL_T=int);
VAL_T value;
endclass
module t (/*AUTOARG*/);
typedef WBase wrap_map_t[string];
typedef WBase wrap_queue_t[$];
initial begin
Bar bar_i = new;
Baz baz_1_i = new;
Baz #(Foo2) baz_2_i = new;
Wrapper#(wrap_map_t) wrap_map = new();
Wrapper#(wrap_queue_t) wrap_queue = new();
bar_i.set(1);
baz_1_i.set(2);
baz_2_i.set(3);
if (bar_i.get(1).get_x() == 1 &&
baz_1_i.get(2).get_x() == 1 &&
baz_2_i.get(3).get_x() == 2) begin
$write("*-* All Finished *-*\n");
$finish;
end
else begin
$stop;
end
if (bar_i.get(1).get_x() != 1) $stop;
if (baz_1_i.get(2).get_x() != 1) $stop;
if (baz_2_i.get(3).get_x() != 2) $stop;
$write("*-* All Finished *-*\n");
$finish;
end
endmodule