diff --git a/src/VlcPoint.h b/src/VlcPoint.h index aeb326fca..d087fb528 100644 --- a/src/VlcPoint.h +++ b/src/VlcPoint.h @@ -63,6 +63,7 @@ public: // KEY ACCESSORS string filename() const { return keyExtract(VL_CIK_FILENAME); } string comment() const { return keyExtract(VL_CIK_COMMENT); } + string hier() const { return keyExtract(VL_CIK_HIER); } string type() const { return keyExtract(VL_CIK_TYPE); } string thresh() const { return keyExtract(VL_CIK_THRESH); } // string as maybe "" string linescov() const { return keyExtract(VL_CIK_LINESCOV); } @@ -98,7 +99,7 @@ public: void dumpAnnotate(std::ostream& os, unsigned annotateMin) const { os << (ok(annotateMin) ? "+" : "-"); os << std::setw(6) << std::setfill('0') << count(); - os << " point: comment=" << comment(); + os << " point: comment=" << comment() << " hier=" << hier(); os << "\n"; } }; diff --git a/test_regress/t/t_cover_line.out b/test_regress/t/t_cover_line.out index 4ca952e78..ec76b5936 100644 --- a/test_regress/t/t_cover_line.out +++ b/test_regress/t/t_cover_line.out @@ -14,11 +14,11 @@ reg toggle; %000001 initial toggle=0; --000001 point: comment=block +-000001 point: comment=block hier=top.t integer cyc; %000001 initial cyc=1; --000001 point: comment=block +-000001 point: comment=block hier=top.t wire [7:0] cyc_copy = cyc[7:0]; @@ -52,136 +52,136 @@ par par1 (/*AUTOINST*/); 000010 always @ (posedge clk) begin -+000010 point: comment=block ++000010 point: comment=block hier=top.t ~000010 if (cyc!=0) begin -+000010 point: comment=if --000000 point: comment=else ++000010 point: comment=if hier=top.t +-000000 point: comment=else hier=top.t 000010 cyc <= cyc + 1; -+000010 point: comment=if ++000010 point: comment=if hier=top.t 000010 toggle <= '0; -+000010 point: comment=if ++000010 point: comment=if hier=top.t // Single and multiline if %000009 if (cyc==3) $write(""); --000001 point: comment=if --000009 point: comment=else +-000001 point: comment=if hier=top.t +-000009 point: comment=else hier=top.t %000009 if (cyc==3) --000001 point: comment=if --000009 point: comment=else +-000001 point: comment=if hier=top.t +-000009 point: comment=else hier=top.t %000001 begin --000001 point: comment=if +-000001 point: comment=if hier=top.t %000001 $write(""); --000001 point: comment=if +-000001 point: comment=if hier=top.t end // Single and multiline else %000009 if (cyc==3) ; else $write(""); --000001 point: comment=if --000009 point: comment=else +-000001 point: comment=if hier=top.t +-000009 point: comment=else hier=top.t %000009 if (cyc==3) ; --000001 point: comment=if --000009 point: comment=else +-000001 point: comment=if hier=top.t +-000009 point: comment=else hier=top.t else %000009 begin --000009 point: comment=else +-000009 point: comment=else hier=top.t %000009 $write(""); --000009 point: comment=else +-000009 point: comment=else hier=top.t end // Single and multiline if else %000009 if (cyc==3) $write(""); else $write(""); --000001 point: comment=if --000009 point: comment=else +-000001 point: comment=if hier=top.t +-000009 point: comment=else hier=top.t %000009 if (cyc==3) --000001 point: comment=if --000009 point: comment=else +-000001 point: comment=if hier=top.t +-000009 point: comment=else hier=top.t %000001 begin --000001 point: comment=if +-000001 point: comment=if hier=top.t %000001 $write(""); --000001 point: comment=if +-000001 point: comment=if hier=top.t end else %000009 begin --000009 point: comment=else +-000009 point: comment=else hier=top.t %000009 $write(""); --000009 point: comment=else +-000009 point: comment=else hier=top.t end // multiline elseif %000001 if (cyc==3) --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t %000001 begin --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t %000001 $write(""); --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t end %000001 else if (cyc==4) --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t %000001 begin --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t %000001 $write(""); --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t end %000007 else if (cyc==5) --000001 point: comment=if --000007 point: comment=else +-000001 point: comment=if hier=top.t +-000007 point: comment=else hier=top.t %000001 begin --000001 point: comment=if +-000001 point: comment=if hier=top.t %000001 $write(""); --000001 point: comment=if +-000001 point: comment=if hier=top.t end else %000007 begin --000007 point: comment=else +-000007 point: comment=else hier=top.t %000007 $write(""); --000007 point: comment=else +-000007 point: comment=else hier=top.t end // Single and multiline while %000000 while (0); --000000 point: comment=block +-000000 point: comment=block hier=top.t %000000 while (0) begin --000000 point: comment=block +-000000 point: comment=block hier=top.t %000000 $write(""); --000000 point: comment=block +-000000 point: comment=block hier=top.t end %000000 do ; while (0); --000000 point: comment=block +-000000 point: comment=block hier=top.t ~000010 do begin --000000 point: comment=block -+000010 point: comment=if +-000000 point: comment=block hier=top.t ++000010 point: comment=if hier=top.t ~000010 $write(""); --000000 point: comment=block -+000010 point: comment=if +-000000 point: comment=block hier=top.t ++000010 point: comment=if hier=top.t %000000 end while (0); --000000 point: comment=block +-000000 point: comment=block hier=top.t //=== // Task and complicated %000001 if (cyc==3) begin --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t %000001 toggle <= '1; --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t end %000001 else if (cyc==5) begin --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t `ifdef VERILATOR %000001 $c("this->call_task();"); --000001 point: comment=elsif +-000001 point: comment=elsif hier=top.t `else call_task(); `endif end %000007 else if (cyc==10) begin --000001 point: comment=if --000007 point: comment=else +-000001 point: comment=if hier=top.t +-000007 point: comment=else hier=top.t %000001 $write("*-* All Finished *-*\n"); --000001 point: comment=if +-000001 point: comment=if hier=top.t %000001 $finish; --000001 point: comment=if +-000001 point: comment=if hier=top.t end end end %000001 task call_task; --000001 point: comment=block +-000001 point: comment=block hier=top.t /* verilator public */ %000001 t1.center_task(1'b1); --000001 point: comment=block +-000001 point: comment=block hier=top.t endtask endmodule @@ -193,16 +193,16 @@ input clk; input toggle; 000020 always @ (posedge clk) begin -+000020 point: comment=block ++000020 point: comment=block hier=top.t.a* ~000018 if (toggle) begin // CHECK_COVER(0,"top.t.a*",18) --000002 point: comment=if -+000018 point: comment=else +-000002 point: comment=if hier=top.t.a* ++000018 point: comment=else hier=top.t.a* %000002 $write(""); --000002 point: comment=if +-000002 point: comment=if hier=top.t.a* // t.a1 and t.a2 collapse to a count of 2 end 000018 if (toggle) begin // *** t_cover_line.vlt turns this off -+000018 point: comment=else ++000018 point: comment=else hier=top.t.a* $write(""); // CHECK_COVER_MISSING(0) // This doesn't even get added `ifdef ATTRIBUTE @@ -222,25 +222,25 @@ /* verilator public_module */ 000020 always @ (posedge clk) begin -+000020 point: comment=block ++000020 point: comment=block hier=top.t.b* 000020 $write(""); // Always covered -+000020 point: comment=block ++000020 point: comment=block hier=top.t.b* ~000020 if (0) begin // CHECK_COVER(0,"top.t.b*",0) --000000 point: comment=if -+000020 point: comment=else +-000000 point: comment=if hier=top.t.b* ++000020 point: comment=else hier=top.t.b* // Make sure that we don't optimize away zero buckets %000000 $write(""); --000000 point: comment=if +-000000 point: comment=if hier=top.t.b* end ~000018 if (toggle) begin // CHECK_COVER(0,"top.t.b*",2) --000002 point: comment=if -+000018 point: comment=else +-000002 point: comment=if hier=top.t.b* ++000018 point: comment=else hier=top.t.b* // t.b1 and t.b2 collapse to a count of 2 %000002 $write(""); --000002 point: comment=if +-000002 point: comment=if hier=top.t.b* end 000018 if (toggle) begin : block -+000018 point: comment=else ++000018 point: comment=else hier=top.t.b* // This doesn't `ifdef ATTRIBUTE // verilator coverage_block_off @@ -255,32 +255,32 @@ class Cls; bit m_toggle; %000001 function new(bit toggle); --000001 point: comment=block +-000001 point: comment=block hier=top.$unit::Cls__Vclpkg %000001 m_toggle = toggle; --000001 point: comment=block +-000001 point: comment=block hier=top.$unit::Cls__Vclpkg %000001 if (m_toggle) begin // CHECK_COVER(0,"top.$unit::Cls",1) --000001 point: comment=if --000000 point: comment=else +-000001 point: comment=if hier=top.$unit::Cls__Vclpkg +-000000 point: comment=else hier=top.$unit::Cls__Vclpkg %000001 $write(""); --000001 point: comment=if +-000001 point: comment=if hier=top.$unit::Cls__Vclpkg end endfunction 000011 static function void fstatic(bit toggle); -+000011 point: comment=block ++000011 point: comment=block hier=top.$unit::Cls__Vclpkg ~000011 if (1) begin // CHECK_COVER(0,"top.$unit::Cls",1) -+000011 point: comment=if --000000 point: comment=else ++000011 point: comment=if hier=top.$unit::Cls__Vclpkg +-000000 point: comment=else hier=top.$unit::Cls__Vclpkg 000011 $write(""); -+000011 point: comment=if ++000011 point: comment=if hier=top.$unit::Cls__Vclpkg end endfunction 000011 function void fauto(); -+000011 point: comment=block ++000011 point: comment=block hier=top.$unit::Cls__Vclpkg ~000011 if (m_toggle) begin // CHECK_COVER(0,"top.$unit::Cls",11) -+000011 point: comment=if --000000 point: comment=else ++000011 point: comment=if hier=top.$unit::Cls__Vclpkg +-000000 point: comment=else hier=top.$unit::Cls__Vclpkg 000011 $write(""); -+000011 point: comment=if ++000011 point: comment=if hier=top.$unit::Cls__Vclpkg end endfunction endclass @@ -295,37 +295,37 @@ /* verilator public_module */ 000010 always @ (posedge clk) begin -+000010 point: comment=block ++000010 point: comment=block hier=top.t.t1 000010 center_task(1'b0); -+000010 point: comment=block ++000010 point: comment=block hier=top.t.t1 end 000011 task center_task; -+000011 point: comment=block ++000011 point: comment=block hier=top.t.t1 input external; 000011 begin -+000011 point: comment=block ++000011 point: comment=block hier=top.t.t1 ~000010 if (toggle) begin // CHECK_COVER(0,"top.t.t1",1) --000001 point: comment=if -+000010 point: comment=else +-000001 point: comment=if hier=top.t.t1 ++000010 point: comment=else hier=top.t.t1 %000001 $write(""); --000001 point: comment=if +-000001 point: comment=if hier=top.t.t1 end ~000010 if (external) begin // CHECK_COVER(0,"top.t.t1",1) --000001 point: comment=if -+000010 point: comment=else +-000001 point: comment=if hier=top.t.t1 ++000010 point: comment=else hier=top.t.t1 %000001 $write("[%0t] Got external pulse\n", $time); --000001 point: comment=if +-000001 point: comment=if hier=top.t.t1 end end 000011 begin -+000011 point: comment=block ++000011 point: comment=block hier=top.t.t1 %000001 Cls c = new(1'b1); --000001 point: comment=block +-000001 point: comment=block hier=top.t.t1 000011 c.fauto(); -+000011 point: comment=block ++000011 point: comment=block hier=top.t.t1 000011 Cls::fstatic(1'b1); -+000011 point: comment=block ++000011 point: comment=block hier=top.t.t1 end endtask endmodule @@ -346,16 +346,16 @@ end // verilator coverage_on 000010 always @ (posedge clk) begin -+000010 point: comment=block ++000010 point: comment=block hier=top.t.o1 %000009 if (toggle) begin --000001 point: comment=if --000009 point: comment=else +-000001 point: comment=if hier=top.t.o1 +-000009 point: comment=else hier=top.t.o1 // because under coverage_module_off %000001 $write(""); --000001 point: comment=if +-000001 point: comment=if hier=top.t.o1 %000001 if (0) ; // CHECK_COVER(0,"top.t.o1",1) --000000 point: comment=if --000001 point: comment=else +-000000 point: comment=if hier=top.t.o1 +-000001 point: comment=else hier=top.t.o1 end end endmodule @@ -365,28 +365,28 @@ int decoded; 000010 always @ (posedge clk) begin -+000010 point: comment=block ++000010 point: comment=block hier=top.t.tab1 000010 case (cyc4) -+000010 point: comment=block ++000010 point: comment=block hier=top.t.tab1 %000001 1: decoded = 10; --000001 point: comment=case +-000001 point: comment=case hier=top.t.tab1 %000001 2: decoded = 20; --000001 point: comment=case +-000001 point: comment=case hier=top.t.tab1 %000001 3: decoded = 30; --000001 point: comment=case +-000001 point: comment=case hier=top.t.tab1 %000001 4: decoded = 40; --000001 point: comment=case +-000001 point: comment=case hier=top.t.tab1 %000001 5: decoded = 50; --000001 point: comment=case +-000001 point: comment=case hier=top.t.tab1 %000005 default: decoded = 0; --000005 point: comment=case +-000005 point: comment=case hier=top.t.tab1 endcase end 000010 always @ (posedge clk) begin -+000010 point: comment=block ++000010 point: comment=block hier=top.t.tab1 000010 cyc4 <= cyc4 + 1; -+000010 point: comment=block ++000010 point: comment=block hier=top.t.tab1 end endmodule @@ -397,20 +397,20 @@ // seems safer for functions used both at elaboration time and not - but may // revisit this. %000000 function automatic int param_func(int i); --000000 point: comment=block +-000000 point: comment=block hier=top.t.par1 %000000 if (i == 0) begin --000000 point: comment=if --000000 point: comment=else +-000000 point: comment=if hier=top.t.par1 +-000000 point: comment=else hier=top.t.par1 %000000 i = 99; // Uncovered --000000 point: comment=if +-000000 point: comment=if hier=top.t.par1 end %000000 else begin --000000 point: comment=else +-000000 point: comment=else hier=top.t.par1 %000000 i = i + 1; --000000 point: comment=else +-000000 point: comment=else hier=top.t.par1 end %000000 return i; --000000 point: comment=block +-000000 point: comment=block hier=top.t.par1 endfunction endmodule diff --git a/test_regress/t/t_cover_toggle_points.out b/test_regress/t/t_cover_toggle_points.out index 2154b19f1..17279cd14 100644 --- a/test_regress/t/t_cover_toggle_points.out +++ b/test_regress/t/t_cover_toggle_points.out @@ -11,11 +11,11 @@ ); 000019 input clk; -+000019 point: comment=clk ++000019 point: comment=clk hier=top.t input real check_real; // Check issue #2741 000021 input real check_array_real [1:0]; -+000021 point: comment=check_array_real[0] -+000021 point: comment=check_array_real[1] ++000021 point: comment=check_array_real[0] hier=top.t ++000021 point: comment=check_array_real[1] hier=top.t input string check_string; // Check issue #2766 typedef struct packed { @@ -27,11 +27,11 @@ } str_t; %000002 reg toggle; initial toggle='0; --000002 point: comment=toggle +-000002 point: comment=toggle hier=top.t %000002 str_t stoggle; initial stoggle='0; --000002 point: comment=stoggle.b --000002 point: comment=stoggle.u.ua +-000002 point: comment=stoggle.b hier=top.t +-000002 point: comment=stoggle.u.ua hier=top.t union { real val1; // TODO use bit [7:0] here @@ -41,23 +41,23 @@ const reg aconst = '0; %000002 reg [1:0][1:0] ptoggle; initial ptoggle=0; --000002 point: comment=ptoggle[0][0] --000000 point: comment=ptoggle[0][1] --000000 point: comment=ptoggle[1][0] --000000 point: comment=ptoggle[1][1] +-000002 point: comment=ptoggle[0][0] hier=top.t +-000000 point: comment=ptoggle[0][1] hier=top.t +-000000 point: comment=ptoggle[1][0] hier=top.t +-000000 point: comment=ptoggle[1][1] hier=top.t integer cyc; initial cyc=1; ~000011 wire [7:0] cyc_copy = cyc[7:0]; -+000011 point: comment=cyc_copy[0] --000005 point: comment=cyc_copy[1] --000002 point: comment=cyc_copy[2] --000001 point: comment=cyc_copy[3] --000000 point: comment=cyc_copy[4] --000000 point: comment=cyc_copy[5] --000000 point: comment=cyc_copy[6] --000000 point: comment=cyc_copy[7] ++000011 point: comment=cyc_copy[0] hier=top.t +-000005 point: comment=cyc_copy[1] hier=top.t +-000002 point: comment=cyc_copy[2] hier=top.t +-000001 point: comment=cyc_copy[3] hier=top.t +-000000 point: comment=cyc_copy[4] hier=top.t +-000000 point: comment=cyc_copy[5] hier=top.t +-000000 point: comment=cyc_copy[6] hier=top.t +-000000 point: comment=cyc_copy[7] hier=top.t %000002 wire toggle_up; --000002 point: comment=toggle_up +-000002 point: comment=toggle_up hier=top.t typedef struct { int q[$]; @@ -90,30 +90,30 @@ .toggle (toggle)); %000001 reg [1:0] memory[121:110]; --000001 point: comment=memory[110][0] --000000 point: comment=memory[110][1] --000000 point: comment=memory[111][0] --000000 point: comment=memory[111][1] --000000 point: comment=memory[112][0] --000000 point: comment=memory[112][1] --000000 point: comment=memory[113][0] --000000 point: comment=memory[113][1] --000000 point: comment=memory[114][0] --000000 point: comment=memory[114][1] --000000 point: comment=memory[115][0] --000000 point: comment=memory[115][1] --000000 point: comment=memory[116][0] --000000 point: comment=memory[116][1] --000000 point: comment=memory[117][0] --000000 point: comment=memory[117][1] --000000 point: comment=memory[118][0] --000000 point: comment=memory[118][1] --000000 point: comment=memory[119][0] --000000 point: comment=memory[119][1] --000000 point: comment=memory[120][0] --000000 point: comment=memory[120][1] --000000 point: comment=memory[121][0] --000000 point: comment=memory[121][1] +-000001 point: comment=memory[110][0] hier=top.t +-000000 point: comment=memory[110][1] hier=top.t +-000000 point: comment=memory[111][0] hier=top.t +-000000 point: comment=memory[111][1] hier=top.t +-000000 point: comment=memory[112][0] hier=top.t +-000000 point: comment=memory[112][1] hier=top.t +-000000 point: comment=memory[113][0] hier=top.t +-000000 point: comment=memory[113][1] hier=top.t +-000000 point: comment=memory[114][0] hier=top.t +-000000 point: comment=memory[114][1] hier=top.t +-000000 point: comment=memory[115][0] hier=top.t +-000000 point: comment=memory[115][1] hier=top.t +-000000 point: comment=memory[116][0] hier=top.t +-000000 point: comment=memory[116][1] hier=top.t +-000000 point: comment=memory[117][0] hier=top.t +-000000 point: comment=memory[117][1] hier=top.t +-000000 point: comment=memory[118][0] hier=top.t +-000000 point: comment=memory[118][1] hier=top.t +-000000 point: comment=memory[119][0] hier=top.t +-000000 point: comment=memory[119][1] hier=top.t +-000000 point: comment=memory[120][0] hier=top.t +-000000 point: comment=memory[120][1] hier=top.t +-000000 point: comment=memory[121][0] hier=top.t +-000000 point: comment=memory[121][1] hier=top.t wire [1023:0] largeish = {992'h0, cyc}; // CHECK_COVER_MISSING(-1) @@ -154,22 +154,22 @@ // t.a1 and t.a2 collapse to a count of 2 000038 input clk; -+000038 point: comment=clk ++000038 point: comment=clk hier=top.t.a* %000004 input toggle; --000004 point: comment=toggle +-000004 point: comment=toggle hier=top.t.a* // CHECK_COVER(-1,"top.t.a*",4) // 2 edges * (t.a1 and t.a2) ~000022 input [7:0] cyc_copy; -+000022 point: comment=cyc_copy[0] -+000010 point: comment=cyc_copy[1] --000004 point: comment=cyc_copy[2] --000002 point: comment=cyc_copy[3] --000000 point: comment=cyc_copy[4] --000000 point: comment=cyc_copy[5] --000000 point: comment=cyc_copy[6] --000000 point: comment=cyc_copy[7] ++000022 point: comment=cyc_copy[0] hier=top.t.a* ++000010 point: comment=cyc_copy[1] hier=top.t.a* +-000004 point: comment=cyc_copy[2] hier=top.t.a* +-000002 point: comment=cyc_copy[3] hier=top.t.a* +-000000 point: comment=cyc_copy[4] hier=top.t.a* +-000000 point: comment=cyc_copy[5] hier=top.t.a* +-000000 point: comment=cyc_copy[6] hier=top.t.a* +-000000 point: comment=cyc_copy[7] hier=top.t.a* // CHECK_COVER(-1,"top.t.a*","cyc_copy[0]",22) // CHECK_COVER(-2,"top.t.a*","cyc_copy[1]",10) // CHECK_COVER(-3,"top.t.a*","cyc_copy[2]",4) @@ -180,12 +180,12 @@ // CHECK_COVER(-8,"top.t.a*","cyc_copy[7]",0) %000004 reg toggle_internal; --000004 point: comment=toggle_internal +-000004 point: comment=toggle_internal hier=top.t.a* // CHECK_COVER(-1,"top.t.a*",4) // 2 edges * (t.a1 and t.a2) %000004 output reg toggle_up; --000004 point: comment=toggle_up +-000004 point: comment=toggle_up hier=top.t.a* // CHECK_COVER(-1,"top.t.a*",4) // 2 edges * (t.a1 and t.a2) @@ -201,10 +201,10 @@ ); 000019 input clk; -+000019 point: comment=clk ++000019 point: comment=clk hier=top.t.b1 %000002 input toggle_up; --000002 point: comment=toggle_up +-000002 point: comment=toggle_up hier=top.t.b1 // CHECK_COVER(-1,"top.t.b1","toggle_up",2) /* verilator public_module */ @@ -225,7 +225,7 @@ // verilator coverage_on %000002 input toggle; --000002 point: comment=toggle +-000002 point: comment=toggle hier=top.t.o1 // CHECK_COVER(-1,"top.t.o1","toggle",2) endmodule