Tests: Add a test for type parameters in virtual interfaces (#4746)

This commit is contained in:
Ryszard Rozak 2023-12-08 13:11:32 +01:00 committed by GitHub
parent 1ececf1127
commit d3142736c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -8,6 +8,14 @@ interface Bus #(parameter int W = 1, X = 2);
logic [W-1:0] data;
endinterface
interface BusTyped #(parameter type T);
T data;
endinterface
typedef struct packed {
logic x;
} my_logic_t;
module t;
Bus#(6, 3) intf1();
virtual Bus#(6, 3) vintf1 = intf1;
@ -15,6 +23,9 @@ module t;
Bus intf2();
virtual Bus#(.W(1), .X(2)) vintf2 = intf2;
BusTyped#(my_logic_t) intf3();
virtual BusTyped#(my_logic_t) vintf3 = intf3;
initial begin
intf1.data = '1;
if (vintf1.data != 6'b111111) $stop;
@ -24,6 +35,9 @@ module t;
if (vintf2.data != 1'b1) $stop;
if (vintf2.X != 2) $stop;
intf3.data.x = '1;
if (vintf3.data.x != 1'b1) $stop;
$write("*-* All Finished *-*\n");
$finish;
end