diff options
author | Ruben Undheim <ruben.undheim@gmail.com> | 2018-10-20 11:58:25 +0200 |
---|---|---|
committer | Ruben Undheim <ruben.undheim@gmail.com> | 2018-10-20 11:58:25 +0200 |
commit | 397dfccb304a12a40d34c4454a5cb4acee8be75f (patch) | |
tree | 39f2bdcbfbc62de55f7333c0bcfb509735bf561a /tests/svinterfaces/svinterface_at_top_tb.v | |
parent | d9a438101298710b9dadd4e7a1cb0041e8ba4199 (diff) | |
download | yosys-397dfccb304a12a40d34c4454a5cb4acee8be75f.tar.gz yosys-397dfccb304a12a40d34c4454a5cb4acee8be75f.tar.bz2 yosys-397dfccb304a12a40d34c4454a5cb4acee8be75f.zip |
Support for SystemVerilog interfaces as a port in the top level module + test case
Diffstat (limited to 'tests/svinterfaces/svinterface_at_top_tb.v')
-rw-r--r-- | tests/svinterfaces/svinterface_at_top_tb.v | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/svinterfaces/svinterface_at_top_tb.v b/tests/svinterfaces/svinterface_at_top_tb.v new file mode 100644 index 000000000..bf37a148d --- /dev/null +++ b/tests/svinterfaces/svinterface_at_top_tb.v @@ -0,0 +1,68 @@ +`timescale 1ns/10ps + +module svinterface_at_top_tb; + + + logic clk; + logic rst; + logic [21:0] outOther; + logic [1:0] sig; + logic [1:0] sig_out; + logic flip; + logic [15:0] passThrough; + integer outfile; + + logic interfaceInstanceAtTop_setting; + logic [2:0] interfaceInstanceAtTop_other_setting; + logic [1:0] interfaceInstanceAtTop_mysig_out; + logic [15:0] interfaceInstanceAtTop_passThrough; + + + TopModule u_dut ( + .clk(clk), + .rst(rst), + .outOther(outOther), + .sig(sig), + .flip(flip), + .passThrough(passThrough), + .interfaceInstanceAtTop_setting(interfaceInstanceAtTop_setting), + .interfaceInstanceAtTop_other_setting(interfaceInstanceAtTop_other_setting), + .interfaceInstanceAtTop_mysig_out(interfaceInstanceAtTop_mysig_out), + .interfaceInstanceAtTop_passThrough(interfaceInstanceAtTop_passThrough), + .sig_out(sig_out) + ); + + initial begin + clk = 0; + while(1) begin + clk = ~clk; + #50; + end + end + + initial begin + outfile = $fopen("output.txt"); + rst = 1; + interfaceInstanceAtTop_setting = 0; + sig = 0; + flip = 0; + @(posedge clk); + #(2); + rst = 0; + @(posedge clk); + for(int j=0;j<2;j++) begin + for(int i=0;i<20;i++) begin + #(2); + flip = j; + sig = i; + @(posedge clk); + end + end + $finish; + end + + always @(negedge clk) begin + $fdisplay(outfile, "%d %d %d %d", outOther, sig_out, passThrough, interfaceInstanceAtTop_mysig_out); + end + +endmodule |