2017-06-21 00:40:18 +02: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: 2017 Wilson Snyder
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2017-06-21 00:40:18 +02:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
module t (
|
|
|
|
|
input clk
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
integer cyc = 1;
|
|
|
|
|
|
|
|
|
|
counter_io c_data ();
|
|
|
|
|
|
|
|
|
|
counter_ansi c1 (
|
|
|
|
|
.clk,
|
|
|
|
|
.*
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
counter_ansi c2 (
|
|
|
|
|
.clk,
|
|
|
|
|
.c_data
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
always @(posedge clk) begin
|
|
|
|
|
cyc <= cyc + 1;
|
|
|
|
|
if (cyc == 20) begin
|
|
|
|
|
if (c_data.value != 12345) $stop;
|
|
|
|
|
$write("*-* All Finished *-*\n");
|
|
|
|
|
$finish;
|
|
|
|
|
end
|
|
|
|
|
end
|
2017-06-21 00:40:18 +02:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
|
|
interface counter_io;
|
|
|
|
|
integer value;
|
|
|
|
|
endinterface
|
|
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
module counter_ansi (
|
|
|
|
|
input clk,
|
|
|
|
|
counter_io c_data
|
|
|
|
|
);
|
2017-06-21 00:40:18 +02:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
always_ff @(posedge clk) begin
|
|
|
|
|
c_data.value <= 12345;
|
|
|
|
|
end
|
2017-06-21 00:40:18 +02:00
|
|
|
endmodule : counter_ansi
|