Enable V3LiftExpr with code coverage (#7164)

This commit is contained in:
Geza Lore 2026-03-01 15:04:49 +00:00 committed by GitHub
parent 3249fd8cc0
commit 6c48b3282e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 542 additions and 626 deletions

View File

@ -285,13 +285,9 @@ static void process() {
}
if (!v3Global.opt.serializeOnly()) {
// Lift expressions out of statements. Currently disabled for line and
// expression coverage, as otherwise later V3Split would further split
// combinational always blocks and alter counts (that needs to be fixed in V3Split)
if (v3Global.opt.fLiftExpr() //
&& !v3Global.opt.coverageLine() && !v3Global.opt.coverageExpr()) {
V3LiftExpr::liftExprAll(v3Global.rootp());
}
// Lift expressions out of statements.
if (v3Global.opt.fLiftExpr()) V3LiftExpr::liftExprAll(v3Global.rootp());
// Move assignments from X into MODULE temps.
// (Before flattening, so each new X variable is shared between all scopes of that
// module.)

View File

@ -449,12 +449,12 @@
logic unsigned [15:0] b;
} pstruct;
000021 function logic func_side_effect;
+000021 point: type=line comment=block hier=top.t.cond1
000021 $display("SIDE EFFECT");
+000021 point: type=line comment=block hier=top.t.cond1
000021 return 1;
+000021 point: type=line comment=block hier=top.t.cond1
%000001 function logic func_side_effect;
-000001 point: type=line comment=block hier=top.t.cond1
%000001 $display("SIDE EFFECT");
-000001 point: type=line comment=block hier=top.t.cond1
%000001 return 1;
-000001 point: type=line comment=block hier=top.t.cond1
endfunction
000010 function arr_t get_arr;
@ -465,14 +465,14 @@
+000010 point: type=line comment=block hier=top.t.cond1
endfunction
~000031 assign a = (cyc == 0) ? clk : 1'bz;
~000011 assign a = (cyc == 0) ? clk : 1'bz;
-000000 point: type=branch comment=cond_then hier=top.t.cond1
+000031 point: type=branch comment=cond_else hier=top.t.cond1
+000011 point: type=branch comment=cond_else hier=top.t.cond1
~000028 assign b = (cyc == 1) ? clk : 0;
-000003 point: type=branch comment=cond_then hier=top.t.cond1
+000028 point: type=branch comment=cond_else hier=top.t.cond1
~000021 assign c = func_side_effect() ? clk : 0;
+000021 point: type=branch comment=cond_then hier=top.t.cond1
%000001 assign c = func_side_effect() ? clk : 0;
-000001 point: type=branch comment=cond_then hier=top.t.cond1
-000000 point: type=branch comment=cond_else hier=top.t.cond1
000010 always @(posedge clk) begin
+000010 point: type=line comment=block hier=top.t.cond1
@ -500,9 +500,9 @@
assign m = tab[clk ? 3 : 4];
for (genvar i = 0; i < 2; i++) begin
000011 assign g = clk ? 1 : 0;
+000010 point: type=branch comment=cond_then hier=top.t.cond1
+000011 point: type=branch comment=cond_else hier=top.t.cond1
000022 assign g = clk ? 1 : 0;
+000020 point: type=branch comment=cond_then hier=top.t.cond1
+000022 point: type=branch comment=cond_else hier=top.t.cond1
end
000011 always begin

View File

@ -150,20 +150,20 @@ DA:304,1
DA:305,20
DA:306,20
DA:315,1
DA:323,21
DA:324,21
DA:325,21
DA:323,1
DA:324,1
DA:325,1
DA:328,10
DA:329,10
DA:330,10
DA:333,31
DA:333,11
BRDA:333,0,0,0
BRDA:333,0,1,31
BRDA:333,0,1,11
DA:334,28
BRDA:334,0,0,3
BRDA:334,0,1,28
DA:335,21
BRDA:335,0,0,21
DA:335,1
BRDA:335,0,0,1
BRDA:335,0,1,0
DA:336,10
DA:337,10
@ -182,9 +182,9 @@ BRDA:340,0,3,5
DA:343,11
BRDA:343,0,0,11
BRDA:343,0,1,0
DA:349,11
BRDA:349,0,0,10
BRDA:349,0,1,11
DA:349,22
BRDA:349,0,0,20
BRDA:349,0,1,22
DA:352,11
DA:353,10
BRDA:353,0,0,0
@ -218,5 +218,5 @@ DA:374,9
BRDA:374,0,0,1
BRDA:374,0,1,9
BRF:83
BRH:33
BRH:32
end_of_record

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,5 @@ test.run(cmd=[
],
verilator_run=True)
test.files_identical(test.obj_dir + "/annotated/t_cover_line.v", "t/t_cover_line.out")
test.vcd_identical(test.trace_filename, test.golden_filename)
test.passes()