2019-12-22 21:49:10 +01:00
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
|
|
|
|
//
|
2026-01-27 02:24:34 +01:00
|
|
|
// This file ONLY is placed under the Creative Commons Public Domain.
|
|
|
|
|
// SPDX-FileCopyrightText: 2019 Peter Monsson
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2019-12-22 21:49:10 +01:00
|
|
|
|
2026-01-07 16:02:52 +01:00
|
|
|
module t ( /*AUTOARG*/
|
|
|
|
|
// Inputs
|
|
|
|
|
clk
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
input clk;
|
|
|
|
|
int cyc;
|
|
|
|
|
|
|
|
|
|
Test test ( /*AUTOINST*/
|
|
|
|
|
// Inputs
|
|
|
|
|
.clk(clk),
|
|
|
|
|
.cyc(cyc)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
always @(posedge clk) begin
|
|
|
|
|
cyc <= cyc + 1;
|
|
|
|
|
if (cyc == 10) begin
|
|
|
|
|
$write("*-* All Finished *-*\n");
|
|
|
|
|
$finish;
|
|
|
|
|
end
|
|
|
|
|
end
|
2019-12-22 21:49:10 +01:00
|
|
|
|
|
|
|
|
endmodule
|
|
|
|
|
|
2024-11-27 04:27:32 +01:00
|
|
|
module Test (
|
2026-01-07 16:02:52 +01:00
|
|
|
input clk,
|
|
|
|
|
input int cyc
|
2024-11-27 04:27:32 +01:00
|
|
|
);
|
2019-12-22 21:49:10 +01:00
|
|
|
|
|
|
|
|
`ifdef FAIL_ASSERT_1
|
2026-01-07 16:02:52 +01:00
|
|
|
assert property (@(posedge clk) disable iff (0) 0)
|
|
|
|
|
else $display("wrong disable");
|
2019-12-22 21:49:10 +01:00
|
|
|
`endif
|
|
|
|
|
|
2026-01-07 16:02:52 +01:00
|
|
|
assert property (@(posedge clk) disable iff (1) 0) $stop;
|
|
|
|
|
else $stop;
|
|
|
|
|
|
|
|
|
|
assert property (@(posedge clk) disable iff (1) 1) $stop;
|
|
|
|
|
else $stop;
|
2019-12-22 21:49:10 +01:00
|
|
|
|
2026-01-07 16:02:52 +01:00
|
|
|
assert property (@(posedge clk) disable iff (0) 1);
|
2019-12-22 21:49:10 +01:00
|
|
|
|
2026-01-07 16:02:52 +01:00
|
|
|
// Pass 1st cycle
|
|
|
|
|
assert property (@(cyc) disable iff (cyc != $sampled(cyc)) cyc == 0);
|
2019-12-22 21:49:10 +01:00
|
|
|
|
2026-01-07 16:02:52 +01:00
|
|
|
//
|
|
|
|
|
// Cover properties behave differently
|
|
|
|
|
//
|
2019-12-22 21:49:10 +01:00
|
|
|
|
2026-01-07 16:02:52 +01:00
|
|
|
cover property (@(posedge clk) disable iff (1) 1) $stop;
|
2024-11-27 04:27:32 +01:00
|
|
|
|
2026-01-07 16:02:52 +01:00
|
|
|
cover property (@(posedge clk) disable iff (1) 0) $stop;
|
2024-11-27 04:27:32 +01:00
|
|
|
|
2026-01-07 16:02:52 +01:00
|
|
|
cover property (@(posedge clk) disable iff (0) 1) $display("*COVER: ok");
|
2024-11-27 04:27:32 +01:00
|
|
|
|
2026-01-07 16:02:52 +01:00
|
|
|
cover property (@(posedge clk) disable iff (0) 0) $stop;
|
2019-12-22 21:49:10 +01:00
|
|
|
|
|
|
|
|
endmodule
|