Merge remote-tracking branch 'origin/master' into xc7mux
[yosys.git] / tests / svinterfaces / svinterface1_tb.v
1 `timescale 1ns/10ps
2
3 module svinterface1_tb;
4
5
6 logic clk;
7 logic rst;
8 logic [21:0] outOther;
9 logic [1:0] sig;
10 logic [1:0] sig_out;
11 logic flip;
12 logic [15:0] passThrough;
13 integer outfile;
14
15 TopModule u_dut (
16 .clk(clk),
17 .rst(rst),
18 .outOther(outOther),
19 .sig(sig),
20 .flip(flip),
21 .passThrough(passThrough),
22 .sig_out(sig_out)
23 );
24
25 initial begin
26 clk = 0;
27 while(1) begin
28 clk = ~clk;
29 #50;
30 end
31 end
32
33 initial begin
34 outfile = $fopen("output.txt");
35 rst = 1;
36 sig = 0;
37 flip = 0;
38 @(posedge clk);
39 #(2);
40 rst = 0;
41 @(posedge clk);
42 for(int j=0;j<2;j++) begin
43 for(int i=0;i<20;i++) begin
44 #(2);
45 flip = j;
46 sig = i;
47 @(posedge clk);
48 end
49 end
50 $finish;
51 end
52
53 always @(negedge clk) begin
54 $fdisplay(outfile, "%d %d %d", outOther, sig_out, passThrough);
55 end
56
57 endmodule