verilator/test_regress/t/t_assert_disable_bad.v

27 lines
645 B
Systemverilog
Raw Normal View History

2022-11-01 23:53:47 +01:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2022 Antmicro Ltd
2022-11-01 23:53:47 +01:00
// SPDX-License-Identifier: CC0-1.0
2026-03-03 13:21:24 +01:00
module t (
input clk
);
2022-11-01 23:53:47 +01:00
2026-03-03 13:21:24 +01:00
int cyc = 0;
logic val = 0;
2022-11-01 23:53:47 +01:00
2026-03-03 13:21:24 +01:00
always @(posedge clk) begin
cyc <= cyc + 1;
val = ~val;
end
2022-11-01 23:53:47 +01:00
2026-03-03 13:21:24 +01:00
property check(int cyc_mod_2, logic expected);
@(posedge clk) disable iff (cyc == 0) cyc % 2 == cyc_mod_2 |=> val == expected;
endproperty
2022-11-01 23:53:47 +01:00
2026-03-03 13:21:24 +01:00
// Test should fail due to duplicated disable iff statements
// (IEEE 1800-2023 16.12.1).
2026-03-03 13:21:24 +01:00
assert property (disable iff (val == 0) check(1, 1));
2022-11-01 23:53:47 +01:00
endmodule