File tree Expand file tree Collapse file tree 3 files changed +61
-1
lines changed Expand file tree Collapse file tree 3 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -1150,7 +1150,12 @@ class ParamVisitor final : public VNVisitor {
1150
1150
if (nodep->ifacep ()) visitCellOrClassRef (nodep, true );
1151
1151
}
1152
1152
void visit (AstClassRefDType* nodep) override { visitCellOrClassRef (nodep, false ); }
1153
- void visit (AstClassOrPackageRef* nodep) override { visitCellOrClassRef (nodep, false ); }
1153
+ void visit (AstClassOrPackageRef* nodep) override {
1154
+ // If it points to a typedef it is not really a class reference. That typedef will be
1155
+ // visited anyway (from its parent node), so even if it points to a parameterized class
1156
+ // type, the instance will be created.
1157
+ if (!VN_IS (nodep->classOrPackageNodep (), Typedef)) visitCellOrClassRef (nodep, false );
1158
+ }
1154
1159
1155
1160
// Make sure all parameters are constantified
1156
1161
void visit (AstVar* nodep) override {
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env perl
2
+ if (!$: :Driver) { use FindBin; exec (" $FindBin::Bin /bootstrap.pl" , @ARGV , $0 ); die ; }
3
+ # DESCRIPTION: Verilator: Verilog Test driver/expect definition
4
+ #
5
+ # Copyright 2022 by Wilson Snyder. This program is free software; you
6
+ # can redistribute it and/or modify it under the terms of either the GNU
7
+ # Lesser General Public License Version 3 or the Perl Artistic License
8
+ # Version 2.0.
9
+ # SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
10
+
11
+ scenarios(simulator => 1);
12
+
13
+ compile(
14
+ );
15
+
16
+ execute(
17
+ check_finished => 1,
18
+ );
19
+
20
+ ok(1);
21
+ 1;
Original file line number Diff line number Diff line change
1
+ // DESCRIPTION: Verilator: Verilog Test module
2
+ //
3
+ // This file ONLY is placed under the Creative Commons Public Domain, for
4
+ // any use, without warranty, 2023 by Antmicro Ltd.
5
+ // SPDX-License-Identifier: CC0-1.0
6
+
7
+ virtual class Virt;
8
+ endclass
9
+
10
+ class MyInt;
11
+ int x ;
12
+ endclass
13
+
14
+ class uvm_object_registry #(
15
+ type T = Virt
16
+ );
17
+ static function T create_object();
18
+ T obj = new();
19
+ obj.x = 1 ;
20
+ return obj;
21
+ endfunction
22
+ endclass
23
+
24
+ typedef uvm_object_registry#(MyInt) type_id;
25
+
26
+ module t ;
27
+ initial begin
28
+ MyInt mi = type_id::create_object();
29
+ if (mi.x != 1 ) $stop ;
30
+
31
+ $write("*-* All Finished *-*\n " );
32
+ $finish ;
33
+ end
34
+ endmodule
You can’t perform that action at this time.
0 commit comments