Imported Upstream version 3.0
[debian/gnuradio] / usrp / fpga / sdr_lib / hb / hbd_tb / test_hbd.v
1
2
3 module test_hbd();
4
5    reg clock;
6    initial clock = 1'b0;
7    always #5 clock <= ~clock;
8
9    reg reset;
10    initial reset = 1'b1;
11    initial #1000 reset = 1'b0;
12    
13    initial $dumpfile("test_hbd.vcd");
14    initial $dumpvars(0,test_hbd);
15
16    reg [15:0] i_in, q_in;
17    wire [15:0] i_out, q_out;
18
19    reg         strobe_in;
20    wire        strobe_out;
21    reg         coeff_write;
22    reg [15:0]  coeff_data;
23    reg [4:0]   coeff_addr;
24    
25    halfband_decim halfband_decim 
26      ( .clock(clock),.reset(reset),.enable(),.strobe_in(strobe_in),.strobe_out(strobe_out),
27        .data_in(i_in),.data_out(i_out) );
28    
29    always @(posedge strobe_out)
30      if(i_out[15])
31        $display("-%d",65536-i_out);
32      else
33        $display("%d",i_out);
34
35    initial
36      begin
37         strobe_in = 1'b0;
38         @(negedge reset);
39         @(posedge clock);
40         while(1)
41           begin
42              strobe_in <= #1 1'b1;
43              @(posedge clock);
44              strobe_in <= #1 1'b0;
45              repeat (`RATE)
46                @(posedge clock);
47           end
48      end
49
50    initial #10000000 $finish;    // Just in case...
51
52    initial
53      begin
54         i_in <= #1 16'd0;
55         repeat (40) @(posedge strobe_in);
56         i_in <= #1 16'd16384;
57         @(posedge strobe_in);
58         i_in <= #1 16'd0;
59         repeat (40) @(posedge strobe_in);
60         i_in <= #1 16'd16384;
61         @(posedge strobe_in);
62         i_in <= #1 16'd0;
63         repeat (40) @(posedge strobe_in);
64         i_in <= #1 16'd16384;
65         repeat (40) @(posedge strobe_in);
66         i_in <= #1 16'd0;
67         repeat (41) @(posedge strobe_in);
68         i_in <= #1 16'd16384;
69         repeat (40) @(posedge strobe_in);
70         i_in <= #1 16'd0;
71         repeat (40) @(posedge strobe_in);
72         repeat (7) @(posedge clock);
73         $finish;
74      end // initial begin
75 endmodule // test_hb