mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-24 13:18:56 +00:00
Synthesis support for SystemVerilog interfaces
This time doing the changes mostly in AST before RTLIL generation
This commit is contained in:
parent
9850de405a
commit
75009ada3c
10 changed files with 501 additions and 21 deletions
76
tests/simple/svinterface1.sv
Normal file
76
tests/simple/svinterface1.sv
Normal file
|
@ -0,0 +1,76 @@
|
|||
|
||||
|
||||
module TopModule(
|
||||
input logic clk,
|
||||
input logic rst,
|
||||
input logic [1:0] sig,
|
||||
output logic [1:0] sig_out);
|
||||
|
||||
MyInterface #(.WIDTH(4)) MyInterfaceInstance();
|
||||
|
||||
SubModule1 u_SubModule1 (
|
||||
.clk(clk),
|
||||
.rst(rst),
|
||||
.u_MyInterface(MyInterfaceInstance),
|
||||
.sig (sig)
|
||||
);
|
||||
|
||||
assign sig_out = MyInterfaceInstance.mysig_out;
|
||||
|
||||
|
||||
assign MyInterfaceInstance.setting = 1;
|
||||
assign MyInterfaceInstance.other_setting[2:0] = 3'b101;
|
||||
|
||||
endmodule
|
||||
|
||||
interface MyInterface #(
|
||||
parameter WIDTH = 3)(
|
||||
);
|
||||
|
||||
logic setting;
|
||||
logic [WIDTH-1:0] other_setting;
|
||||
|
||||
logic [1:0] mysig_out;
|
||||
|
||||
endinterface
|
||||
|
||||
|
||||
module SubModule1(
|
||||
input logic clk,
|
||||
input logic rst,
|
||||
MyInterface u_MyInterface,
|
||||
input logic [1:0] sig
|
||||
|
||||
);
|
||||
|
||||
always_ff @(posedge clk or posedge rst)
|
||||
if(rst)
|
||||
u_MyInterface.mysig_out <= 0;
|
||||
else begin
|
||||
if(u_MyInterface.setting)
|
||||
u_MyInterface.mysig_out <= sig;
|
||||
else
|
||||
u_MyInterface.mysig_out <= ~sig;
|
||||
end
|
||||
|
||||
MyInterface #(.WIDTH(22)) MyInterfaceInstanceInSub();
|
||||
|
||||
SubModule2 u_SubModule2 (
|
||||
.clk(clk),
|
||||
.rst(rst),
|
||||
.u_MyInterfaceInSub2(u_MyInterface),
|
||||
.sig (sig)
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
||||
module SubModule2(
|
||||
|
||||
input logic clk,
|
||||
input logic rst,
|
||||
MyInterface u_MyInterfaceInSub2,
|
||||
input logic [1:0] sig
|
||||
|
||||
);
|
||||
|
||||
endmodule
|
Loading…
Add table
Add a link
Reference in a new issue