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
29 `include "usrp_tasks.v"
33 .clk_120mhz(clk_120mhz),
35 .enable_rx(enable_rx),
36 .enable_tx(enable_tx),
43 .adc1_data(adc1_data),
44 .adc2_data(adc2_data),
45 .adc3_data(adc1_data),
46 .adc4_data(adc2_data),
48 .dac1_data(dac1_data),
49 .dac2_data(dac2_data),
50 .dac3_data(),.dac4_data(),
52 .adclk0(adclk),.adclk1(),
54 .adc_oeb(),.adc_otr(4'b0),
61 .usbclk(usbclk),.usbctl(usbctl),
62 .usbrdy(usbrdy),.usbdata(usbdata)
69 reg [11:0] adc1_data, adc2_data;
70 wire [13:0] dac1_data, dac2_data;
79 assign usbctl[0] = WE;
80 assign usbctl[1] = RD;
81 assign usbctl[2] = OE;
82 assign usbctl[5:3] = 0;
84 wire have_packet_rdy = usbrdy[1];
89 assign usbdata = tb_oe ? usbdatareg : 16'hxxxx;
90 reg serload, serenable, serclk, serdata;
91 reg enable_tx, enable_rx;
92 reg [15:0] usbdatareg;
94 ///////////////////////////////////////////////
98 $dumpfile("fullchip_tb.vcd");
99 $dumpvars(0, fullchip_tb);
102 //initial #1000000 $finish;
104 ///////////////////////////////////////////////
107 //initial $monitor(dac1_data);
109 ///////////////////////////////////////////////
112 initial clk_120mhz = 0;
114 always #24 clk_120mhz = ~clk_120mhz;
115 always #60 usbclk = ~usbclk;
117 initial reset = 1'b1;
118 initial #500 reset = 1'b0;
120 /////////////////////////////////////////////////
123 always @(posedge adclk) adc1_data <= #1 12'd1234;
124 always @(posedge adclk) adc2_data <= #1 12'd1234;
126 /////////////////////////////////////////////////
132 #30000 @(posedge usbclk);
133 burst_usb_write(257);
135 #30000 burst_usb_read(256);
145 /////////////////////////////////////////////////
148 initial enable_tx = 1'b0;
149 initial #40000 enable_tx = 1'b1;
150 initial enable_rx = 1'b0;
151 initial #40000 enable_rx = 1'b1;
153 //////////////////////////////////////////////////
154 // Set up control bus
158 #1000 send_config_word(`ch1in_freq,32'h0); // 1 MHz on 60 MHz clock
159 send_config_word(`ch2in_freq,32'h0);
160 send_config_word(`ch3in_freq,32'h0);
161 send_config_word(`ch4in_freq,32'h0);
162 send_config_word(`ch1out_freq,32'h01234567);
163 send_config_word(`ch2out_freq,32'h0);
164 send_config_word(`ch3out_freq,32'h0);
165 send_config_word(`ch4out_freq,32'h0);
166 send_config_word(`misc,32'h0);
167 send_config_word(`rates,{8'd2,8'd12,8'h0f,8'h07});
168 // adc, ext, interp, decim
171 /////////////////////////////////////////////////////////