3 // USRP - Universal Software Radio Peripheral
5 // Copyright (C) 2003,2004 Matt Ettus
6 // Copyright (C) 2007 Corgan Enterprises LLC
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA
23 module usrp_radar_mono
24 (output MYSTERY_SIGNAL,
35 input wire [11:0] rx_a_a,
36 input wire [11:0] rx_b_a,
37 input wire [11:0] rx_a_b,
38 input wire [11:0] rx_b_b,
40 output wire [13:0] tx_a,
41 output wire [13:0] tx_b,
48 input wire [2:0] usbctl,
49 output wire [1:0] usbrdy,
50 inout [15:0] usbdata, // NB Careful, inout
52 // These are the general purpose i/o's that go to the daughterboard slots
53 inout wire [15:0] io_tx_a,
54 inout wire [15:0] io_tx_b,
55 inout wire [15:0] io_rx_a,
56 inout wire [15:0] io_rx_b
58 wire [15:0] debugdata,debugctrl;
59 assign MYSTERY_SIGNAL = 1'b0;
63 // wire WR = usbctl[0];
68 assign usbrdy[0] = 1'b0; // have_space;
69 assign usbrdy[1] = have_pkt_rdy;
71 wire tx_underrun, rx_overrun;
72 wire clear_status = FX2_1;
73 assign FX2_2 = rx_overrun;
74 assign FX2_3 = 1'b0; // tx_underrun;
76 wire [15:0] usbdata_out;
78 wire [3:0] rx_numchan;
79 wire enable_tx, enable_rx;
80 wire tx_dsp_reset, rx_dsp_reset, tx_bus_reset, rx_bus_reset;
82 // Tri-state bus macro
83 bustri bustri( .data(usbdata_out),.enabledt(OE),.tridata(usbdata) );
85 assign clk64 = master_clk;
88 wire tx_sample_strobe;
92 wire [6:0] serial_addr;
93 wire [31:0] serial_data;
95 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
98 wire [13:0] tx_i, tx_q;
101 dac_interface dac(.clk_i(clk64),.rst_i(tx_dsp_reset),.ena_i(enable_tx),
102 .strobe_i(tx_sample_strobe),.tx_i_i(tx_i),.tx_q_i(tx_q),
103 .tx_data_o(tx_dac),.tx_sync_o(TXSYNC_A));
105 assign tx_a = tx_dac;
107 // Wedge DAC #2 at zero
108 assign TXSYNC_B = 1'b0;
111 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
113 wire rx_sample_strobe, rx_strobe;
114 wire [15:0] rx_adc0_i, rx_adc0_q;
115 wire [15:0] rx_buf_i, rx_buf_q;
117 adc_interface adc_interface(.clock(clk64),.reset(rx_dsp_reset),.enable(enable_rx),
118 .serial_addr(serial_addr),.serial_data(serial_data),.serial_strobe(serial_strobe),
119 .rx_a_a(rx_a_a),.rx_b_a(rx_b_a),.rx_a_b(),.rx_b_b(),
120 .rssi_0(),.rssi_1(),.rssi_2(),.rssi_3(),
121 .ddc0_in_i(rx_adc0_i),.ddc0_in_q(rx_adc0_q),
122 .ddc1_in_i(),.ddc1_in_q(),
123 .ddc2_in_i(),.ddc2_in_q(),
124 .ddc3_in_i(),.ddc3_in_q(),.rx_numchan(rx_numchan) );
127 ( .usbclk(usbclk),.bus_reset(rx_bus_reset),.reset(rx_dsp_reset),
128 .reset_regs(rx_dsp_reset),
129 .usbdata(usbdata_out),.RD(RD),.have_pkt_rdy(have_pkt_rdy),.rx_overrun(rx_overrun),
130 .channels(rx_numchan),
131 .ch_0(rx_buf_i),.ch_1(rx_buf_q),
135 .rxclk(clk64),.rxstrobe(rx_strobe),
136 .clear_status(clear_status),
137 .serial_addr(serial_addr),.serial_data(serial_data),.serial_strobe(serial_strobe),
141 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
142 // Top level application
144 radar radar_mono ( .clk_i(clk64),.saddr_i(serial_addr),.sdata_i(serial_data),.s_strobe_i(serial_strobe),
145 .tx_strobe_o(tx_sample_strobe),.tx_dac_i_o(tx_i),.tx_dac_q_o(tx_q),
146 .rx_strobe_i(rx_sample_strobe),.rx_adc_i_i(rx_adc0_i),.rx_adc_q_i(rx_adc0_q),
147 .rx_strobe_o(rx_strobe),.rx_ech_i_o(rx_buf_i),.rx_ech_q_o(rx_buf_q)
150 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
153 wire [31:0] capabilities;
154 assign capabilities[7] = 0; // `TX_CAP_HB;
155 assign capabilities[6:4] = 2; // `TX_CAP_NCHAN;
156 assign capabilities[3] = 0; // `RX_CAP_HB;
157 assign capabilities[2:0] = 2; // `RX_CAP_NCHAN;
160 ( .master_clk(clk64),.serial_clock(SCLK),.serial_data_in(SDI),
161 .enable(SEN_FPGA),.reset(1'b0),.serial_data_out(SDO),
162 .serial_addr(serial_addr),.serial_data(serial_data),.serial_strobe(serial_strobe),
163 .readback_0({io_rx_a,io_tx_a}),.readback_1({io_rx_b,io_tx_b}),.readback_2(capabilities),.readback_3(32'hf0f0931a),
164 .readback_4(),.readback_5(),.readback_6(),.readback_7()
167 wire [15:0] reg_0,reg_1,reg_2,reg_3;
168 master_control master_control
169 ( .master_clk(clk64),.usbclk(usbclk),
170 .serial_addr(serial_addr),.serial_data(serial_data),.serial_strobe(serial_strobe),
171 .tx_bus_reset(tx_bus_reset),.rx_bus_reset(rx_bus_reset),
172 .tx_dsp_reset(tx_dsp_reset),.rx_dsp_reset(rx_dsp_reset),
173 .enable_tx(enable_tx),.enable_rx(enable_rx),
174 .interp_rate(),.decim_rate(),
175 .tx_sample_strobe(),.strobe_interp(), // tx_sample_strobe now generated by radar transmitter module
176 .rx_sample_strobe(rx_sample_strobe),.strobe_decim(),
178 .debug_0(),.debug_1(),
179 .debug_2(),.debug_3(),
180 .reg_0(reg_0),.reg_1(reg_1),.reg_2(reg_2),.reg_3(reg_3) );
183 (.io_0(io_tx_a),.io_1(io_rx_a),.io_2(io_tx_b),.io_3(io_rx_b),
184 .reg_0(reg_0),.reg_1(reg_1),.reg_2(reg_2),.reg_3(reg_3),
185 .clock(clk64),.rx_reset(rx_dsp_reset),.tx_reset(tx_dsp_reset),
186 .serial_addr(serial_addr),.serial_data(serial_data),.serial_strobe(serial_strobe));
188 endmodule // usrp_radar_mono