parent
35dcf70f48
commit
a9ef4b3ff1
|
|
@ -583,16 +583,18 @@ class LinkParseVisitor final : public VNVisitor {
|
|||
UINFO(9, "Reused impltypedef " << nodep << " --> " << defp);
|
||||
} else {
|
||||
// Definition must be inserted right after the variable (etc) that needed it
|
||||
// AstVar, AstTypedef, AstNodeFTask are common containers
|
||||
// AstVar, AstTypedef, AstNodeFTask, AstParamTypeDType are common containers
|
||||
AstNode* backp = nodep->backp();
|
||||
for (; backp; backp = backp->backp()) {
|
||||
if (VN_IS(backp, Var) || VN_IS(backp, Typedef) || VN_IS(backp, NodeFTask)) break;
|
||||
if (VN_IS(backp, Var) || VN_IS(backp, Typedef) || VN_IS(backp, NodeFTask)
|
||||
|| VN_IS(backp, ParamTypeDType))
|
||||
break;
|
||||
}
|
||||
UASSERT_OBJ(backp, nodep,
|
||||
"Implicit enum/struct type created under unexpected node type");
|
||||
AstNodeDType* const dtypep = nodep->childDTypep();
|
||||
dtypep->unlinkFrBack();
|
||||
if (VN_IS(backp, Typedef)) {
|
||||
if (VN_IS(backp, Typedef) || VN_IS(backp, ParamTypeDType)) {
|
||||
// A typedef doesn't need us to make yet another level of typedefing
|
||||
// For typedefs just remove the AstRefDType level of abstraction
|
||||
nodep->replaceWith(dtypep);
|
||||
|
|
|
|||
|
|
@ -7,20 +7,31 @@
|
|||
class ParamClass #(string P = "ABC", R = "GDF");
|
||||
endclass
|
||||
|
||||
module t #(parameter int A = 0, B = 1, C = 2, type D = int, E = string);
|
||||
parameter bit F = 1'b0, G = 1'b1;
|
||||
parameter type H = int, I = string;
|
||||
module t #(
|
||||
parameter int A = 0, B = 1, C = 2, type D = int, E = string, F =
|
||||
struct packed {
|
||||
struct packed {
|
||||
logic a;
|
||||
} b;
|
||||
}
|
||||
);
|
||||
parameter bit G = 1'b0, H = 1'b1;
|
||||
parameter type I = int, J = string;
|
||||
E str1 = "abc";
|
||||
I str2 = "";
|
||||
J str2 = "";
|
||||
|
||||
F struct1;
|
||||
assign struct1.b.a = 1'b1;
|
||||
|
||||
initial begin
|
||||
automatic ParamClass param_class = new;
|
||||
if ($typename(B) != "int") $stop;
|
||||
if ($typename(C) != "int") $stop;
|
||||
if (str1.len() != 3) $stop;
|
||||
if ($typename(G) != "bit") $stop;
|
||||
if ($typename(H) != "bit") $stop;
|
||||
if (str2.len() != 0) $stop;
|
||||
if ($typename(param_class.R) != "string") $stop;
|
||||
|
||||
if ($typename(struct1.b.a) != "MEMBERDTYPE 'a'") $stop;
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue