verilator/test_regress/t/t_clocking_concat.v

36 lines
841 B
Systemverilog
Raw Normal View History

2022-12-23 13:34:49 +01:00
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2022 Antmicro Ltd
2022-12-23 13:34:49 +01:00
// SPDX-License-Identifier: CC0-1.0
2026-03-08 23:26:40 +01:00
module t (
input clk
);
2022-12-23 13:34:49 +01:00
2026-03-08 23:26:40 +01:00
logic [3:0] D1, D2, Q1, Q2;
always @(posedge clk) begin
{Q1, Q2} <= {D1, D2};
end
2022-12-23 13:34:49 +01:00
2026-03-08 23:26:40 +01:00
always @(posedge clk) $display("[%0t] posedge clk", $time);
2022-12-23 13:34:49 +01:00
2026-03-08 23:26:40 +01:00
clocking cb @(posedge clk);
input #0 Q = {Q1, Q2};
output #0 D = {D1, D2};
endclocking
2022-12-23 13:34:49 +01:00
2026-03-08 23:26:40 +01:00
initial $monitor("[%0t] --> D=%x\t\tQ=%x\t\tcb.Q=%x", $time, {D1, D2}, {Q1, Q2}, cb.Q);
2022-12-23 13:34:49 +01:00
2026-03-08 23:26:40 +01:00
int cyc = 0;
always @(posedge clk) begin
cyc <= cyc + 1;
if (cyc > 1 && cb.Q != {D1 - 4'd1, D2 - 4'd1}) $stop;
cb.D <= {D1 + 4'd1, D2 + 4'd1};
if (cyc == 10) begin
$write("*-* All Finished *-*\n");
$finish;
end
end
2022-12-23 13:34:49 +01:00
endmodule