verilator/test_regress/t/t_always_ff_never.v

43 lines
763 B
Systemverilog
Raw Normal View History

2025-10-03 19:16:12 +02:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2025 Wilson Snyder
2025-10-03 19:16:12 +02:00
// SPDX-License-Identifier: CC0-1.0
2026-02-24 10:15:26 +01:00
interface intf (
input wire clk /*verilator public*/
);
2025-10-03 19:16:12 +02:00
endinterface
module sub (
input wire clk,
input wire dat
);
2026-02-24 10:15:26 +01:00
intf the_intf (.clk);
2025-10-03 19:16:12 +02:00
2026-02-24 10:15:26 +01:00
logic [63:0] last_transition = 123;
always_ff @(edge dat) begin
last_transition <= $time;
end
2025-10-03 19:16:12 +02:00
2026-02-24 10:15:26 +01:00
int cyc = 0;
always_ff @(posedge clk) begin
cyc <= cyc + 1;
if (cyc == 2) begin
if (last_transition != 123) $stop;
$write("*-* All Finished *-*\n");
$finish;
2025-10-03 19:16:12 +02:00
end
2026-02-24 10:15:26 +01:00
end
2025-10-03 19:16:12 +02:00
endmodule
2026-02-24 10:15:26 +01:00
module t (
input clk
);
2025-10-03 19:16:12 +02:00
2026-02-24 10:15:26 +01:00
sub the_sub (
.clk,
.dat('0)
);
2025-10-03 19:16:12 +02:00
endmodule