1//
2// Copyright 2011 Ettus Research LLC
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16//
17
18
19`timescale 1ns/1ns
20module rx_dcoffset_tb();
21
22   reg clk, rst;
23
24   initial rst = 1;
25   initial #1000 rst = 0;
26   initial clk = 0;
27   always #5 clk = ~clk;
28
29   initial $dumpfile("rx_dcoffset_tb.vcd");
30   initial $dumpvars(0,rx_dcoffset_tb);
31
32   reg [13:0] adc_in;
33   wire [13:0] adc_out;
34
35   always @(posedge clk)
36     begin
37	if(adc_in[13])
38	  $write("-%d,",-adc_in);
39	else
40	  $write("%d,",adc_in);
41	if(adc_out[13])
42	  $write("-%d\n",-adc_out);
43	else
44	  $write("%d\n",adc_out);
45     end
46
47   rx_dcoffset #(.WIDTH(14),.ADDR(0), .alpha_shift(8))
48     rx_dcoffset(.clk(clk),.rst(rst),.set_stb(0),.set_addr(0),.set_data(0),
49		 .in(adc_in),.out(adc_out));
50
51   always @(posedge clk)
52     adc_in <= (($random % 473) + 23)/4;
53
54endmodule // longfifo_tb
55