Fix parameter-dependent type linking (#6170)
This commit is contained in:
parent
d419c49921
commit
98b8d43a4a
|
|
@ -3589,9 +3589,6 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
||||||
UINFO(9, indent() << m_ds.ascii());
|
UINFO(9, indent() << m_ds.ascii());
|
||||||
VL_RESTORER(m_usedPins);
|
VL_RESTORER(m_usedPins);
|
||||||
m_usedPins.clear();
|
m_usedPins.clear();
|
||||||
UASSERT_OBJ(m_statep->forPrimary() || VN_IS(nodep->classOrPackageNodep(), ParamTypeDType)
|
|
||||||
|| nodep->classOrPackageSkipp(),
|
|
||||||
nodep, "ClassRef has unlinked class");
|
|
||||||
UASSERT_OBJ(m_statep->forPrimary() || !nodep->paramsp(), nodep,
|
UASSERT_OBJ(m_statep->forPrimary() || !nodep->paramsp(), nodep,
|
||||||
"class reference parameter not removed by V3Param");
|
"class reference parameter not removed by V3Param");
|
||||||
{
|
{
|
||||||
|
|
@ -3602,6 +3599,10 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
||||||
m_statep->resolveClassOrPackage(m_ds.m_dotSymp, nodep, m_ds.m_dotPos != DP_PACKAGE,
|
m_statep->resolveClassOrPackage(m_ds.m_dotSymp, nodep, m_ds.m_dotPos != DP_PACKAGE,
|
||||||
false, ":: reference");
|
false, ":: reference");
|
||||||
}
|
}
|
||||||
|
UASSERT_OBJ(m_statep->forPrimary()
|
||||||
|
|| VN_IS(nodep->classOrPackageNodep(), ParamTypeDType)
|
||||||
|
|| nodep->classOrPackageSkipp(),
|
||||||
|
nodep, "ClassRef has unlinked class");
|
||||||
|
|
||||||
// ClassRef's have pins, so track
|
// ClassRef's have pins, so track
|
||||||
if (nodep->classOrPackageSkipp()) {
|
if (nodep->classOrPackageSkipp()) {
|
||||||
|
|
|
||||||
|
|
@ -1116,7 +1116,7 @@ class ParamVisitor final : public VNVisitor {
|
||||||
} else {
|
} else {
|
||||||
cellp->v3fatalSrc("Expected module parameterization");
|
cellp->v3fatalSrc("Expected module parameterization");
|
||||||
}
|
}
|
||||||
UASSERT_OBJ(srcModp, cellp, "Unlinked class ref");
|
if (!srcModp) continue;
|
||||||
|
|
||||||
// Update path
|
// Update path
|
||||||
string someInstanceName = modp->someInstanceName();
|
string someInstanceName = modp->someInstanceName();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2025 by Wilson Snyder. This program is free software; you
|
||||||
|
# can redistribute it and/or modify it under the terms of either the GNU
|
||||||
|
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||||
|
# Version 2.0.
|
||||||
|
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||||
|
|
||||||
|
import vltest_bootstrap
|
||||||
|
|
||||||
|
test.scenarios('simulator')
|
||||||
|
|
||||||
|
test.compile()
|
||||||
|
|
||||||
|
test.execute()
|
||||||
|
|
||||||
|
test.passes()
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||||
|
// any use, without warranty, 2025 by Antmicro.
|
||||||
|
// SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
class Class1 #(type T);
|
||||||
|
static function int get();
|
||||||
|
return T::Helper::getter();
|
||||||
|
endfunction
|
||||||
|
endclass
|
||||||
|
|
||||||
|
class Class2;
|
||||||
|
typedef Class2 Helper;
|
||||||
|
static function int getter();
|
||||||
|
return 13;
|
||||||
|
endfunction
|
||||||
|
endclass
|
||||||
|
|
||||||
|
module t;
|
||||||
|
initial begin
|
||||||
|
if (Class1#(Class2)::get() != 13) $stop;
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue