2023-12-07 13:56:16 +01:00
|
|
|
// DESCRIPTION: Verilator: Verilog Test module
|
2023-12-06 14:02:04 +01:00
|
|
|
//
|
2026-01-27 02:24:34 +01:00
|
|
|
// This file ONLY is placed under the Creative Commons Public Domain.
|
|
|
|
|
// SPDX-FileCopyrightText: 2023 Antmicro Ltd
|
2023-12-06 14:02:04 +01:00
|
|
|
// SPDX-License-Identifier: CC0-1.0
|
|
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
interface Bus #(
|
|
|
|
|
parameter int W = 1,
|
|
|
|
|
X = 2
|
|
|
|
|
);
|
|
|
|
|
logic [W-1:0] data;
|
2023-12-07 13:56:16 +01:00
|
|
|
endinterface
|
2023-12-06 14:02:04 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
interface BusTyped #(
|
|
|
|
|
parameter type T
|
|
|
|
|
);
|
|
|
|
|
T data;
|
2023-12-08 13:11:32 +01:00
|
|
|
endinterface
|
|
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
typedef struct packed {logic x;} my_logic_t;
|
2023-12-08 13:11:32 +01:00
|
|
|
|
2023-12-07 13:56:16 +01:00
|
|
|
module t;
|
2026-03-08 23:26:40 +01:00
|
|
|
Bus #(6, 3) intf1 ();
|
|
|
|
|
virtual Bus #(6, 3) vintf1 = intf1;
|
2023-12-06 14:02:04 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
Bus intf2 ();
|
|
|
|
|
virtual Bus #(
|
|
|
|
|
.W(1),
|
|
|
|
|
.X(2)
|
|
|
|
|
) vintf2 = intf2;
|
2023-12-06 14:02:04 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
BusTyped #(my_logic_t) intf3 ();
|
|
|
|
|
virtual BusTyped #(my_logic_t) vintf3 = intf3;
|
2023-12-08 13:11:32 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
initial begin
|
|
|
|
|
intf1.data = '1;
|
|
|
|
|
if (vintf1.data != 6'b111111) $stop;
|
|
|
|
|
if (vintf1.X != 3) $stop;
|
2023-12-06 14:02:04 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
intf2.data = '1;
|
|
|
|
|
if (vintf2.data != 1'b1) $stop;
|
|
|
|
|
if (vintf2.X != 2) $stop;
|
2023-12-06 14:02:04 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
intf3.data.x = '1;
|
|
|
|
|
if (vintf3.data.x != 1'b1) $stop;
|
2023-12-08 13:11:32 +01:00
|
|
|
|
2026-03-08 23:26:40 +01:00
|
|
|
$write("*-* All Finished *-*\n");
|
|
|
|
|
$finish;
|
|
|
|
|
end
|
2023-12-06 14:02:04 +01:00
|
|
|
endmodule
|