2007-03-05 22:35:49 +01: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: 2006 Wilson Snyder
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2007-03-05 22:35:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
module t (
|
|
|
|
|
input clk
|
|
|
|
|
);
|
2007-03-05 22:35:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
integer cyc;
|
|
|
|
|
initial cyc = 0;
|
2007-03-05 22:35:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
always @(posedge clk) begin
|
|
|
|
|
cyc <= cyc + 1;
|
|
|
|
|
if (cyc == 1) begin
|
|
|
|
|
ReadContDisps;
|
|
|
|
|
end
|
|
|
|
|
else if (cyc == 5) begin
|
|
|
|
|
$write("*-* All Finished *-*\n");
|
|
|
|
|
$finish;
|
|
|
|
|
end
|
2007-03-05 22:35:49 +01:00
|
|
|
`ifndef verilator
|
2026-03-08 23:26:40 +01:00
|
|
|
DispContDisps;
|
2007-03-05 22:35:49 +01:00
|
|
|
`endif
|
2026-03-08 23:26:40 +01:00
|
|
|
end
|
2007-03-05 22:35:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
task ReadContDisps;
|
|
|
|
|
begin
|
|
|
|
|
$display("%m: Here: %d", cyc);
|
|
|
|
|
end
|
|
|
|
|
endtask
|
2007-03-05 22:35:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
integer dindex;
|
2007-03-05 22:35:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
task DispContDisps;
|
|
|
|
|
/* verilator public */
|
|
|
|
|
begin
|
|
|
|
|
if (cyc >= 2) begin
|
|
|
|
|
if (cyc >= 4) begin
|
|
|
|
|
dindex = dindex + 2; //*** Error line
|
|
|
|
|
$display("%m: DIndex increment %d", cyc);
|
2010-03-18 17:03:08 +01:00
|
|
|
`ifdef VERILATOR
|
2026-03-08 23:26:40 +01:00
|
|
|
$c("VL_PRINTF(\"Hello1?\\n\");");
|
2010-03-18 17:03:08 +01:00
|
|
|
`endif
|
2026-03-08 23:26:40 +01:00
|
|
|
end
|
2010-03-18 17:03:08 +01:00
|
|
|
`ifdef VERILATOR
|
2026-03-08 23:26:40 +01:00
|
|
|
$c("VL_PRINTF(\"Hello2?\\n\");");
|
|
|
|
|
$c("VL_PRINTF(\"Hello3?\\n\");");
|
2010-03-18 17:03:08 +01:00
|
|
|
`endif
|
2007-03-05 22:35:49 +01:00
|
|
|
end
|
2026-03-08 23:26:40 +01:00
|
|
|
end
|
|
|
|
|
endtask
|
2007-03-05 22:35:49 +01:00
|
|
|
|
|
|
|
|
endmodule
|