diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-10-19 13:03:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-19 13:03:38 +0200 |
commit | 2a104b29fd7e504bdedb27c286cf9125d46dfd55 (patch) | |
tree | 9a0ef937b730d4c0f7452b0ceedfb642c83908ab /tests/svinterfaces/svinterface1_tb.v | |
parent | a25f370191707def4d50dd42e74dec4d097a6a22 (diff) | |
parent | d5aac2650f9169b2b890854083c5502b84adf115 (diff) | |
download | yosys-2a104b29fd7e504bdedb27c286cf9125d46dfd55.tar.gz yosys-2a104b29fd7e504bdedb27c286cf9125d46dfd55.tar.bz2 yosys-2a104b29fd7e504bdedb27c286cf9125d46dfd55.zip |
Merge pull request #670 from rubund/feature/basic_svinterface_test
Basic test for checking correct synthesis of SystemVerilog interfaces
Diffstat (limited to 'tests/svinterfaces/svinterface1_tb.v')
-rw-r--r-- | tests/svinterfaces/svinterface1_tb.v | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/svinterfaces/svinterface1_tb.v b/tests/svinterfaces/svinterface1_tb.v new file mode 100644 index 000000000..44c3b5f68 --- /dev/null +++ b/tests/svinterfaces/svinterface1_tb.v @@ -0,0 +1,57 @@ +`timescale 1ns/10ps + +module svinterface1_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; + + TopModule u_dut ( + .clk(clk), + .rst(rst), + .outOther(outOther), + .sig(sig), + .flip(flip), + .passThrough(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; + 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", outOther, sig_out, passThrough); + end + +endmodule |