Fix type assignments for arrays of parameter types (#6955)
This commit is contained in:
parent
1b9f38f78f
commit
67df517bec
|
|
@ -4049,10 +4049,14 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
||||||
[this](AstVar* v, AstRefDType* r) { return promoteVarToParamType(v, r); },
|
[this](AstVar* v, AstRefDType* r) { return promoteVarToParamType(v, r); },
|
||||||
[this]() { return indent(); });
|
[this]() { return indent(); });
|
||||||
|
|
||||||
|
if (VN_IS(nodep->backp(), SelExtract)) {
|
||||||
|
m_packedArrayDtp = refp;
|
||||||
|
} else {
|
||||||
replaceWithCheckBreak(nodep, refp);
|
replaceWithCheckBreak(nodep, refp);
|
||||||
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
VL_DO_DANGLING(pushDeletep(nodep), nodep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
if (m_insideClassExtParam) {
|
if (m_insideClassExtParam) {
|
||||||
// Don't throw error if the reference is inside a class that extends a param,
|
// Don't throw error if the reference is inside a class that extends a param,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ module top ();
|
||||||
localparam type p0_t = if0.rq_t;
|
localparam type p0_t = if0.rq_t;
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
|
if ($bits(p0_t) != 8) $stop;
|
||||||
#1;
|
#1;
|
||||||
$write("*-* All Finished *-*\n");
|
$write("*-* All Finished *-*\n");
|
||||||
$finish;
|
$finish;
|
||||||
|
|
|
||||||
|
|
@ -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(verilator_flags2=["--binary"])
|
||||||
|
|
||||||
|
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 Wilson Snyder.
|
||||||
|
// SPDX-License-Identifier: CC0-1.0
|
||||||
|
//
|
||||||
|
|
||||||
|
interface x_if #(
|
||||||
|
parameter int a_width = 3
|
||||||
|
) ();
|
||||||
|
|
||||||
|
typedef struct packed {logic [a_width-1:0] addr;} rq_t;
|
||||||
|
endinterface
|
||||||
|
|
||||||
|
module top ();
|
||||||
|
x_if #(.a_width(8)) if0 ();
|
||||||
|
|
||||||
|
localparam type p0_t = if0.rq_t [1:0];
|
||||||
|
|
||||||
|
initial begin
|
||||||
|
if ($bits(p0_t) != 16) $stop;
|
||||||
|
#1;
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||||
|
#
|
||||||
|
# Copyright 2026 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,31 @@
|
||||||
|
// DESCRIPTION: Verilator: Verilog Test module
|
||||||
|
//
|
||||||
|
// This file ONLY is placed under the Creative Commons Public Domain, for
|
||||||
|
// any use, without warranty, 2026 by Wilson Snyder.
|
||||||
|
// SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
module t (/*AUTOARG*/
|
||||||
|
// Inputs
|
||||||
|
clk
|
||||||
|
);
|
||||||
|
input clk;
|
||||||
|
|
||||||
|
sub sub_default();
|
||||||
|
sub #(.foo_t (logic[7:0])) sub_8();
|
||||||
|
|
||||||
|
always @ (posedge clk) begin
|
||||||
|
$write("*-* All Finished *-*\n");
|
||||||
|
$finish;
|
||||||
|
end
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module sub #(
|
||||||
|
parameter type foo_t = logic,
|
||||||
|
parameter type bar_t = foo_t[1:0]
|
||||||
|
);
|
||||||
|
initial begin
|
||||||
|
$display("%m foo_t = %0d bar_t = %0d", $bits(foo_t), $bits(bar_t));
|
||||||
|
if (2 * $bits(foo_t) != $bits(bar_t)) $stop;
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
Loading…
Reference in New Issue