Files
sv2v/test/core/interface_struct_param.sv
T
Zachary Snow b2fe865e17 fix interface modport substitution strategy
The interface conversion no longer substitutes parameters immediately,
instead fully scoping modports and allowing hierarchical constants to be
resolved separately. This fixes an issue where struct parameters could
lose their type information during substitution. The conversion also now
handles renaming references to the module or interface top-level scope.
2021-07-20 22:36:59 -04:00

45 lines
816 B
Systemverilog

typedef struct packed {
byte x;
shortint y;
} T;
interface intf;
parameter T P = 0;
wire [P.x-1:0] z = '1;
initial begin
$display("intf.P.x %0d", P.x);
$display("intf.P.y %0d", P.y);
end
if (P.x) begin : blk
wire [31:0] z;
end
wire [31:0] z = P.y;
if (P.x) begin : blk2
integer z;
assign intf.blk.z = intf.z;
end
modport X (
input .x(P),
input .y(intf.blk.z)
);
endinterface
module mod(
intf.X f
);
integer i;
initial begin
$display("mod.f.x %b", f.x);
$display("mod.f.y %b", f.y);
end
endmodule
module top;
localparam T Q = '{ x: 1, y: 2 };
localparam T R = '{ x: 4, y: 6 };
intf #(Q) i();
intf #(R) is [1:0] ();
mod m(i);
mod ms(is[0]);
endmodule