Imported Upstream version 3.0
[debian/gnuradio] / usrp / fpga / tb / justinterp_tb.v
1 // -*- verilog -*-
2 //
3 //  USRP - Universal Software Radio Peripheral
4 //
5 //  Copyright (C) 2003 Matt Ettus
6 //
7 //  This program is free software; you can redistribute it and/or modify
8 //  it under the terms of the GNU General Public License as published by
9 //  the Free Software Foundation; either version 2 of the License, or
10 //  (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 //
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301  USA
20 //
21
22
23 module cic_decim_tb;
24
25 cic_decim #(.bitwidth(16),.stages(4))
26    decim(clock,reset,enable,strobe_in,strobe_out,signal_in,signal_out);
27         
28    reg clock;
29    reg reset;
30    reg enable;
31    wire strobe;
32    reg [15:0] signal_in;
33    wire [15:0] signal_out;
34
35    assign      strobe_in = 1'b1;
36    reg         strobe_out;
37
38    always @(posedge clock)
39      while(1)
40        begin
41           @(posedge clock);
42           @(posedge clock);
43           @(posedge clock);
44           @(posedge clock);
45           strobe_out <= 1'b1;
46           @(posedge clock);
47           @(posedge clock);
48           @(posedge clock);
49           @(posedge clock);
50           strobe_out <= 1'b0;
51        end
52    
53    initial clock = 0;
54    always #50 clock = ~clock;
55    
56    initial reset = 1;
57    initial #1000 reset = 0;
58
59    initial enable = 0;
60    initial #2000 enable = 1;
61    
62    initial signal_in = 16'h1;
63    initial #500000 signal_in = 16'h7fff;
64    initial #1000000 signal_in = 16'h8000;
65    initial #1500000 signal_in = 16'hffff;
66
67    
68    initial $dumpfile("decim.vcd");
69    initial $dumpvars(0,cic_decim_tb);
70
71    initial #10000000 $finish;
72    
73 endmodule // cic_decim_tb