verilator/test_regress/t/t_inst_darray.v

84 lines
1.4 KiB
Systemverilog
Raw Normal View History

// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2017 John Stevenson
// SPDX-License-Identifier: CC0-1.0
typedef logic [63:0] uid_t;
typedef logic [31:0] value_t;
2026-03-08 23:26:40 +01:00
interface the_intf #(
parameter M = 5
);
logic valid;
uid_t uid;
value_t [M-1:0] values;
2026-03-08 23:26:40 +01:00
modport i(output valid, output uid, output values);
modport t(input valid, input uid, input values);
endinterface
module Contemplator #(
2026-03-08 23:26:40 +01:00
parameter IMPL = 0,
parameter M = 5,
parameter N = 1
) (
input logic clk,
2026-03-08 23:26:40 +01:00
the_intf.i out[N-1:0]
);
2026-03-08 23:26:40 +01:00
the_intf #(.M(M)) inp[N-1:0] ();
2026-03-08 23:26:40 +01:00
DeepThought #(
.N(N)
) ultimateAnswerer (
.src(inp),
.dst(out)
);
endmodule
module DeepThought #(
2026-03-08 23:26:40 +01:00
parameter N = 1
) (
the_intf.t src[N-1:0],
the_intf.i dst[N-1:0]
2026-03-08 23:26:40 +01:00
);
endmodule
2026-03-08 23:26:40 +01:00
module t ( /*AUTOARG*/
// Inputs
clk
);
input clk;
2026-03-08 23:26:40 +01:00
localparam M = 5;
localparam N = 1;
2026-03-08 23:26:40 +01:00
the_intf #(.M(M)) out0[N-1:0] ();
the_intf #(.M(M)) out1[N-1:0] ();
2026-03-08 23:26:40 +01:00
Contemplator #(
.IMPL(0),
.M(M),
.N(N)
) contemplatorOfTheZerothKind (
.clk(clk),
.out(out0)
);
2026-03-08 23:26:40 +01:00
Contemplator #(
.IMPL(1),
.M(M),
.N(N)
) contemplatorOfTheFirstKind (
.clk(clk),
.out(out1)
);
initial begin
$write("*-* All Finished *-*\n");
$finish;
end
endmodule