1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
|
// verilator_coverage annotation
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2008 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg toggle;
%000002 initial toggle=0;
integer cyc;
%000002 initial cyc=1;
wire [7:0] cyc_copy = cyc[7:0];
alpha a1 (/*AUTOINST*/
// Inputs
.clk (clk),
.toggle (toggle));
alpha a2 (/*AUTOINST*/
// Inputs
.clk (clk),
.toggle (toggle));
beta b1 (/*AUTOINST*/
// Inputs
.clk (clk),
.toggle (toggle));
beta b2 (/*AUTOINST*/
// Inputs
.clk (clk),
.toggle (toggle));
tsk t1 (/*AUTOINST*/
// Inputs
.clk (clk),
.toggle (toggle));
off o1 (/*AUTOINST*/
// Inputs
.clk (clk),
.toggle (toggle));
000020 always @ (posedge clk) begin
000020 if (cyc!=0) begin
%000000 verilator_coverage: (next point on previous line)
000010 cyc <= cyc + 1;
000010 toggle <= '0;
// Single and multiline if
%000002 if (cyc==3) $write("");
%000009 verilator_coverage: (next point on previous line)
%000002 if (cyc==3)
%000009 verilator_coverage: (next point on previous line)
%000001 begin
%000001 $write("");
end
// Single and multiline else
%000002 if (cyc==3) ; else $write("");
%000018 verilator_coverage: (next point on previous line)
%000002 if (cyc==3) ;
%000009 verilator_coverage: (next point on previous line)
else
%000009 begin
%000009 $write("");
end
// Single and multiline if else
%000002 if (cyc==3) $write(""); else $write("");
%000018 verilator_coverage: (next point on previous line)
%000002 if (cyc==3)
%000009 verilator_coverage: (next point on previous line)
%000001 begin
%000001 $write("");
end
else
%000009 begin
%000009 $write("");
end
// multiline elseif
%000002 if (cyc==3)
%000001 begin
%000001 $write("");
end
%000002 else if (cyc==4)
%000001 begin
%000001 $write("");
end
%000002 else if (cyc==5)
%000007 verilator_coverage: (next point on previous line)
%000001 begin
%000001 $write("");
end
else
%000007 begin
%000007 $write("");
end
// Single and multiline while
%000000 while (0);
%000000 while (0) begin
%000000 $write("");
end
%000000 do ; while (0);
000010 do begin
%000000 verilator_coverage: (next point on previous line)
000010 $write("");
%000000 verilator_coverage: (next point on previous line)
%000000 end while (0);
//===
// Task and complicated
%000002 if (cyc==3) begin
%000001 toggle <= '1;
end
%000002 else if (cyc==5) begin
`ifdef VERILATOR
%000001 $c("call_task();");
`else
call_task();
`endif
end
%000002 else if (cyc==10) begin
%000007 verilator_coverage: (next point on previous line)
%000001 $write("*-* All Finished *-*\n");
%000001 $finish;
end
end
end
%000002 task call_task;
/* verilator public */
%000001 t1.center_task(1'b1);
endtask
endmodule
module alpha (/*AUTOARG*/
// Inputs
clk, toggle
);
input clk;
input toggle;
000040 always @ (posedge clk) begin
%000004 if (toggle) begin // CHECK_COVER(0,"top.t.a*",2)
000018 verilator_coverage: (next point on previous line)
%000002 $write("");
// t.a1 and t.a2 collapse to a count of 2
end
000018 if (toggle) begin
$write(""); // CHECK_COVER_MISSING(0)
// This doesn't even get added
`ifdef ATTRIBUTE
// verilator coverage_block_off
`endif
end
end
endmodule
module beta (/*AUTOARG*/
// Inputs
clk, toggle
);
input clk;
input toggle;
/* verilator public_module */
000040 always @ (posedge clk) begin
000020 $write(""); // Always covered
%000000 if (0) begin // CHECK_COVER(0,"top.t.b*",0)
000020 verilator_coverage: (next point on previous line)
// Make sure that we don't optimize away zero buckets
%000000 $write("");
end
%000004 if (toggle) begin // CHECK_COVER(0,"top.t.b*",2)
000018 verilator_coverage: (next point on previous line)
// t.b1 and t.b2 collapse to a count of 2
%000002 $write("");
end
000018 if (toggle) begin : block
// This doesn't
`ifdef ATTRIBUTE
// verilator coverage_block_off
`endif
begin end // Needed for .vlt to attach coverage_block_off
if (1) begin end // CHECK_COVER_MISSING(0)
$write(""); // CHECK_COVER_MISSING(0)
end
end
endmodule
module tsk (/*AUTOARG*/
// Inputs
clk, toggle
);
input clk;
input toggle;
/* verilator public_module */
000020 always @ (posedge clk) begin
000010 center_task(1'b0);
end
000022 task center_task;
input external;
000011 begin
%000002 if (toggle) begin // CHECK_COVER(0,"top.t.t1",1)
000010 verilator_coverage: (next point on previous line)
%000001 $write("");
end
%000002 if (external) begin // CHECK_COVER(0,"top.t.t1",1)
000010 verilator_coverage: (next point on previous line)
%000001 $write("[%0t] Got external pulse\n", $time);
end
end
endtask
endmodule
module off (/*AUTOARG*/
// Inputs
clk, toggle
);
input clk;
input toggle;
// verilator coverage_off
always @ (posedge clk) begin
if (toggle) begin
$write(""); // CHECK_COVER_MISSING(0)
// because under coverage_module_off
end
end
// verilator coverage_on
000020 always @ (posedge clk) begin
%000002 if (toggle) begin
%000009 verilator_coverage: (next point on previous line)
// because under coverage_module_off
%000001 $write("");
%000000 if (0) ; // CHECK_COVER(0,"top.t.o1",1)
%000001 verilator_coverage: (next point on previous line)
end
end
endmodule
|