2019-12-22 20:49:10 +00:00
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
|
|
|
//
|
|
|
|
// This file ONLY is placed into the Public Domain, for any use,
|
|
|
|
// without warranty, 2019 by Peter Monsson.
|
2020-03-21 15:24:24 +00:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2019-12-22 20:49:10 +00:00
|
|
|
|
|
|
|
module t (/*AUTOARG*/
|
|
|
|
// Inputs
|
|
|
|
clk
|
|
|
|
);
|
|
|
|
|
|
|
|
input clk;
|
2024-11-27 03:27:32 +00:00
|
|
|
int cyc;
|
2019-12-22 20:49:10 +00:00
|
|
|
|
|
|
|
Test test (/*AUTOINST*/
|
2022-05-01 14:10:00 +00:00
|
|
|
// Inputs
|
|
|
|
.clk (clk));
|
2019-12-22 20:49:10 +00:00
|
|
|
|
2024-11-27 03:27:32 +00:00
|
|
|
always @(posedge clk) begin
|
|
|
|
cyc <= cyc + 1;
|
|
|
|
if (cyc == 10) begin
|
|
|
|
$write("*-* All Finished *-*\n");
|
|
|
|
$finish;
|
2019-12-22 20:49:10 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
endmodule
|
|
|
|
|
2024-11-27 03:27:32 +00:00
|
|
|
module Test (
|
|
|
|
input clk
|
|
|
|
);
|
2019-12-22 20:49:10 +00:00
|
|
|
|
|
|
|
`ifdef FAIL_ASSERT_1
|
2024-11-27 03:27:32 +00:00
|
|
|
assert property (@(posedge clk) disable iff (0) 0)
|
|
|
|
else $display("wrong disable");
|
2019-12-22 20:49:10 +00:00
|
|
|
`endif
|
|
|
|
|
2024-11-27 03:27:32 +00:00
|
|
|
assert property (@(posedge clk) disable iff (1) 0);
|
2019-12-22 20:49:10 +00:00
|
|
|
|
2024-11-27 03:27:32 +00:00
|
|
|
assert property (@(posedge clk) disable iff (1) 1);
|
2019-12-22 20:49:10 +00:00
|
|
|
|
2024-11-27 03:27:32 +00:00
|
|
|
assert property (@(posedge clk) disable iff (0) 1);
|
2019-12-22 20:49:10 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Cover properties behave differently
|
|
|
|
//
|
|
|
|
|
2024-11-27 03:27:32 +00:00
|
|
|
cover property (@(posedge clk) disable iff (1) 1) $stop;
|
|
|
|
|
|
|
|
cover property (@(posedge clk) disable iff (1) 0) $stop;
|
|
|
|
|
|
|
|
cover property (@(posedge clk) disable iff (0) 1) $display("*COVER: ok");
|
|
|
|
|
|
|
|
cover property (@(posedge clk) disable iff (0) 0) $stop;
|
2019-12-22 20:49:10 +00:00
|
|
|
|
|
|
|
endmodule
|