3 // USRP - Universal Software Radio Peripheral
5 // Copyright (C) 2003 Matt Ettus
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.
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.
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
23 // testbench for fullchip
27 `include "usrp_tasks.v"
33 reg [11:0] adc1_data, adc2_data;
34 wire [13:0] dac1_data, dac2_data;
43 assign usbctl[0] = WE;
44 assign usbctl[1] = RD;
45 assign usbctl[2] = OE;
46 assign usbctl[5:3] = 0;
49 assign usbdata = tb_oe ? usbdatareg : 16'hxxxx;
50 reg serload, serenable, serclk, serdata;
51 reg enable_tx, enable_rx;
52 reg [15:0] usbdatareg;
54 ///////////////////////////////////////////////
58 $dumpfile("interp_tb.vcd");
62 initial #100000 $finish;
64 ///////////////////////////////////////////////
67 reg [7:0] counter_interp;
68 wire [7:0] interp_rate;
69 assign interp_rate = 32;
70 initial $monitor(dac1_data);
72 always @(posedge clk_120mhz)
74 if(reset | ~enable_tx)
75 counter_interp <= #1 0;
76 else if(counter_interp == 0)
77 counter_interp <= #1 interp_rate - 8'b1;
79 counter_interp <= #1 counter_interp - 8'b1;
82 ///////////////////////////////////////////////
85 initial clk_120mhz = 0;
87 always #48 clk_120mhz = ~clk_120mhz;
88 always #120 usbclk = ~usbclk;
91 initial #500 reset = 1'b0;
94 initial enable_tx = 1'b1;
96 wire [31:0] interp_out, q_interp_out;
97 wire [31:0] decim_out;
100 cic_interp #(.bitwidth(32),.stages(4))
101 interp_i(.clock(clk_120mhz),.reset(reset),.enable(enable_tx),
102 .strobe(counter_interp == 8'b0),.signal_in(32'h1),.signal_out(interp_out));
104 cic_decim #(.bitwidth(32),.stages(4))
105 decim(.clock(clk_120mhz),.reset(reset),.enable(enable_tx),
106 .strobe(counter_interp == 8'b0),.signal_in(32'h1),.signal_out(decim_out));