Tests: Update tests to include parameterized modules (#7655)
This commit is contained in:
parent
86799ace5d
commit
8872908704
|
|
@ -0,0 +1,20 @@
|
|||
# SystemC::Coverage-3
|
||||
C 'ft/t_cover_per_instance.vl16n27tlinepagev_line/childoblockS16htb.dut.u_a' 1
|
||||
C 'ft/t_cover_per_instance.vl16n27tlinepagev_line/childoblockS16htb.dut.u_b' 1
|
||||
C 'ft/t_cover_per_instance.vl16n27tlinepagev_line/child__W3oblockS16htb.dut.u_wide' 1
|
||||
C 'ft/t_cover_per_instance.vl18n3tlinepagev_line/childoblockS18htb.dut.u_a' 9
|
||||
C 'ft/t_cover_per_instance.vl18n3tlinepagev_line/childoblockS18htb.dut.u_b' 9
|
||||
C 'ft/t_cover_per_instance.vl18n3tlinepagev_line/child__W3oblockS18htb.dut.u_wide' 9
|
||||
C 'ft/t_cover_per_instance.vl19n5tbranchpagev_branch/childoifS19-20htb.dut.u_a' 4
|
||||
C 'ft/t_cover_per_instance.vl19n5tbranchpagev_branch/childoifS19-20htb.dut.u_b' 1
|
||||
C 'ft/t_cover_per_instance.vl19n5tbranchpagev_branch/child__W3oifS19-20htb.dut.u_wide' 2
|
||||
C 'ft/t_cover_per_instance.vl19n6tbranchpagev_branch/childoelseS21-22htb.dut.u_a' 5
|
||||
C 'ft/t_cover_per_instance.vl19n6tbranchpagev_branch/childoelseS21-22htb.dut.u_b' 8
|
||||
C 'ft/t_cover_per_instance.vl19n6tbranchpagev_branch/child__W3oelseS21-22htb.dut.u_wide' 7
|
||||
C 'ft/t_cover_per_instance.vl30n19tlinepagev_line/toblockS30htb.dut' 1
|
||||
C 'ft/t_cover_per_instance.vl55n3tlinepagev_line/toblockS55-56htb.dut' 9
|
||||
C 'ft/t_cover_per_instance.vl61n13tlinepagev_line/tboblockS61htb' 1
|
||||
C 'ft/t_cover_per_instance.vl67n3tlinepagev_line/tboblockS67htb' 17
|
||||
C 'ft/t_cover_per_instance.vl69n3tlinepagev_line/tboblockS69htb' 9
|
||||
C 'ft/t_cover_per_instance.vl70n5tbranchpagev_branch/tboifS70-72htb' 1
|
||||
C 'ft/t_cover_per_instance.vl70n6tbranchpagev_branch/tboelsehtb' 8
|
||||
|
|
@ -5,34 +5,43 @@
|
|||
// SPDX-FileCopyrightText: 2026 Wilson Snyder
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module child (
|
||||
module child #(
|
||||
parameter int WIDTH = 1
|
||||
) (
|
||||
input clk,
|
||||
input en
|
||||
);
|
||||
`ifdef INLINE_CHILD //verilator inline_module
|
||||
`else //verilator no_inline_module
|
||||
`endif
|
||||
%000001 reg [3:0] count = 0;
|
||||
%000001 reg [WIDTH-1:0] count = '0;
|
||||
-000001 point: type=line comment=block hier=tb.dut.u_a
|
||||
-000001 point: type=line comment=block hier=tb.dut.u_b
|
||||
-000001 point: type=line comment=block hier=tb.dut.u_wide
|
||||
|
||||
%000009 always @(posedge clk) begin
|
||||
-000009 point: type=line comment=block hier=tb.dut.u_a
|
||||
-000009 point: type=line comment=block hier=tb.dut.u_b
|
||||
-000009 point: type=line comment=block hier=tb.dut.u_wide
|
||||
%000008 if (en) begin
|
||||
-000004 point: type=branch comment=if hier=tb.dut.u_a
|
||||
-000001 point: type=branch comment=if hier=tb.dut.u_b
|
||||
-000002 point: type=branch comment=if hier=tb.dut.u_wide
|
||||
-000005 point: type=branch comment=else hier=tb.dut.u_a
|
||||
-000008 point: type=branch comment=else hier=tb.dut.u_b
|
||||
-000007 point: type=branch comment=else hier=tb.dut.u_wide
|
||||
%000004 count <= count + 1'b1;
|
||||
-000004 point: type=branch comment=if hier=tb.dut.u_a
|
||||
-000001 point: type=branch comment=if hier=tb.dut.u_b
|
||||
-000002 point: type=branch comment=if hier=tb.dut.u_wide
|
||||
%000008 end else begin
|
||||
-000005 point: type=branch comment=else hier=tb.dut.u_a
|
||||
-000008 point: type=branch comment=else hier=tb.dut.u_b
|
||||
-000007 point: type=branch comment=else hier=tb.dut.u_wide
|
||||
%000008 count <= count;
|
||||
-000005 point: type=branch comment=else hier=tb.dut.u_a
|
||||
-000008 point: type=branch comment=else hier=tb.dut.u_b
|
||||
-000007 point: type=branch comment=else hier=tb.dut.u_wide
|
||||
end
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -57,6 +66,15 @@
|
|||
.en(cyc == 0)
|
||||
);
|
||||
|
||||
// Parameterized u_wide should preserve a useful per-instance hierarchy and
|
||||
// parameter-specialized coverage bucket for downstream coverage tools.
|
||||
child #(
|
||||
.WIDTH(3)
|
||||
) u_wide (
|
||||
.clk(clk),
|
||||
.en(cyc < 2)
|
||||
);
|
||||
|
||||
%000009 always @(posedge clk) begin
|
||||
-000009 point: type=line comment=block hier=tb.dut
|
||||
%000009 cyc <= cyc + 1'b1;
|
||||
|
|
|
|||
|
|
@ -4,14 +4,16 @@
|
|||
// SPDX-FileCopyrightText: 2026 Wilson Snyder
|
||||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
module child (
|
||||
module child #(
|
||||
parameter int WIDTH = 1
|
||||
) (
|
||||
input clk,
|
||||
input en
|
||||
);
|
||||
`ifdef INLINE_CHILD //verilator inline_module
|
||||
`else //verilator no_inline_module
|
||||
`endif
|
||||
reg [3:0] count = 0;
|
||||
reg [WIDTH-1:0] count = '0;
|
||||
|
||||
always @(posedge clk) begin
|
||||
if (en) begin
|
||||
|
|
@ -41,6 +43,15 @@ module t (
|
|||
.en(cyc == 0)
|
||||
);
|
||||
|
||||
// Parameterized u_wide should preserve a useful per-instance hierarchy and
|
||||
// parameter-specialized coverage bucket for downstream coverage tools.
|
||||
child #(
|
||||
.WIDTH(3)
|
||||
) u_wide (
|
||||
.clk(clk),
|
||||
.en(cyc < 2)
|
||||
);
|
||||
|
||||
always @(posedge clk) begin
|
||||
cyc <= cyc + 1'b1;
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ test.execute(all_run_flags=[" +verilator+coverage+file+" + test.obj_dir + "/cove
|
|||
|
||||
cov = test.obj_dir + "/coverage.dat"
|
||||
|
||||
test.files_identical(cov, "t/t_cover_per_instance.dat.out")
|
||||
|
||||
test.run(cmd=[
|
||||
os.environ["VERILATOR_ROOT"] + "/bin/verilator_coverage",
|
||||
"--annotate-points",
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ test.execute(all_run_flags=[" +verilator+coverage+file+" + test.obj_dir + "/cove
|
|||
|
||||
cov = test.obj_dir + "/coverage.dat"
|
||||
|
||||
test.files_identical(cov, "t/t_cover_per_instance.dat.out")
|
||||
|
||||
test.run(cmd=[
|
||||
os.environ["VERILATOR_ROOT"] + "/bin/verilator_coverage",
|
||||
"--annotate-points",
|
||||
|
|
|
|||
Loading…
Reference in New Issue