Fix property and sequence line coverage (#8314)

Signed-off-by: Andrii Andrieiev <[email protected]>
This commit is contained in:
Andrii
2026-09-10 18:00:24 -04:00
committed by GitHub
parent dada720bca
commit 2421c7b73b
4 changed files with 104 additions and 0 deletions
+10
View File
@@ -1114,6 +1114,16 @@ class CoverageVisitor final : public VNVisitor {
}
// VISITORS - BOTH
void visit(AstProperty* nodep) override {
VL_RESTORER(m_state);
m_state.m_on = false;
iterateChildren(nodep);
}
void visit(AstSequence* nodep) override {
VL_RESTORER(m_state);
m_state.m_on = false;
iterateChildren(nodep);
}
void visit(AstNode* nodep) override {
iterateChildren(nodep);
lineTrack(nodep);
+13
View File
@@ -0,0 +1,13 @@
TN:verilator_coverage
SF:t/t_coverage_prop_seq.v
DA:8,1
DA:48,5
DA:50,1
DA:51,3
BRDA:51,0,block,1
BRDA:51,0,block,3
DA:52,1
DA:53,1
BRF:2
BRH:0
end_of_record
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# 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-FileCopyrightText: 2026 Wilson Snyder
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.compile(verilator_flags2=['--binary --coverage'])
test.execute(all_run_flags=[" +verilator+coverage+file+" + test.obj_dir + "/coverage.dat"])
test.run(cmd=[
os.environ["VERILATOR_ROOT"] + "/bin/verilator_coverage", "--filter-type line", "--write-info",
test.obj_dir + "/line.info", test.obj_dir + "/coverage.dat"
],
verilator_run=True)
test.files_identical(test.obj_dir + "/line.info", test.golden_filename)
test.passes()
+55
View File
@@ -0,0 +1,55 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2026 Antmicro
// SPDX-License-Identifier: CC0-1.0
module t;
logic clk = 1'b0;
property c_prop;
@(negedge clk)
1'b1;
endproperty : c_prop
property asrt_prop;
@(negedge clk)
1'b1;
endproperty : asrt_prop
property assm_prop;
@(negedge clk)
1'b1;
endproperty : assm_prop
sequence seq;
1'b1;
endsequence : seq
property prop_seq;
@(negedge clk) seq;
endproperty : prop_seq
property inner_prop;
@(negedge clk)
1'b1;
endproperty : inner_prop
property outer_prop;
inner_prop;
endproperty : outer_prop
cover property (c_prop);
assert property (asrt_prop);
assume property (assm_prop);
cover property (prop_seq);
cover property (outer_prop);
always #1 clk = ~clk;
initial begin
repeat (3) @(posedge clk);
$write("*-* All Finished *-*\n");
$finish;
end
endmodule