2013-01-01 01:06: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: 2012 Wilson Snyder
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
2013-01-01 01:06:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
module t (
|
|
|
|
|
input clk
|
|
|
|
|
);
|
2013-01-01 01:06:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
logic foo;
|
|
|
|
|
initial foo = 0;
|
2013-01-01 01:06:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
// dut #(.W(4)) udut(.*);
|
|
|
|
|
dut #(
|
|
|
|
|
.W(4)
|
|
|
|
|
) udut (
|
|
|
|
|
.clk(clk),
|
|
|
|
|
.foo(foo)
|
|
|
|
|
); // Assigning logic to logic array
|
2013-01-01 01:06:49 +01:00
|
|
|
|
|
|
|
|
endmodule
|
|
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
module dut #(
|
|
|
|
|
parameter W = 1
|
|
|
|
|
) (
|
|
|
|
|
input logic clk,
|
|
|
|
|
input logic foo[W-1:0]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
genvar i;
|
|
|
|
|
generate
|
|
|
|
|
for (i = 0; i < W; i++) begin
|
|
|
|
|
suba ua (
|
|
|
|
|
.clk(clk),
|
|
|
|
|
.foo(foo[i])
|
|
|
|
|
);
|
|
|
|
|
end
|
|
|
|
|
endgenerate
|
2013-01-01 01:06:49 +01:00
|
|
|
endmodule
|
|
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
module suba (
|
|
|
|
|
input logic clk,
|
|
|
|
|
input logic foo
|
|
|
|
|
);
|
2013-01-01 01:06:49 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
always @(posedge clk) $display("foo=%b", foo);
|
2013-01-01 01:06:49 +01:00
|
|
|
|
|
|
|
|
endmodule
|