Merged r5945:6012 from jcorgan/radar into trunk. Updates gr-radar-mono component...
[debian/gnuradio] / gr-radar-mono / src / fpga / lib / radar.v
1 // -*- verilog -*-
2 //
3 //  USRP - Universal Software Radio Peripheral
4 //
5 //  Copyright (C) 2007 Corgan Enterprises LLC
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 `include "../lib/radar_config.vh"
23
24 module radar(clk_i,saddr_i,sdata_i,s_strobe_i,
25              tx_strobe_o,tx_dac_i_o,tx_dac_q_o,
26              rx_strobe_i,rx_adc_i_i,rx_adc_q_i,
27              rx_strobe_o,rx_ech_i_o,rx_ech_q_o);
28
29    // System interface
30    input         clk_i;         // Master clock @ 64 MHz
31    input  [6:0]  saddr_i;       // Configuration bus address
32    input  [31:0] sdata_i;       // Configuration bus data
33    input         s_strobe_i;    // Configuration bus write
34    
35    // Transmit subsystem
36    output        tx_strobe_o;   // Generate an transmitter output sample
37    output [13:0] tx_dac_i_o;    // I channel transmitter output to DAC
38    output [13:0] tx_dac_q_o;    // Q channel transmitter output to DAC
39
40    // Receive subsystem
41    input         rx_strobe_i;   // Indicates receive sample ready from ADC
42    input  [15:0] rx_adc_i_i;    // I channel input from ADC
43    input  [15:0] rx_adc_q_i;    // Q channel input from ADC
44    output        rx_strobe_o;   // Indicates output samples ready for Rx FIFO
45    output [15:0] rx_ech_i_o;    // I channel processed echos to Rx FIFO
46    output [15:0] rx_ech_q_o;    // Q channel processed echos to Rx FIFO
47
48    // Application control
49    wire          reset;         // Master application reset
50    wire          tx_enable;     // Transmitter enable
51    wire          rx_enable;     // Receiver enable
52    wire          tx_ctrl;       // Transmitter on control
53    wire          rx_ctrl;       // Receiver on control
54          
55    // Configuration
56    wire [15:0]   ampl;          // Pulse amplitude
57    wire [31:0]   fstart;        // Chirp start frequency
58    wire [31:0]   fincr;         // Chirp per strobe frequency increment
59
60    radar_control controller
61      (.clk_i(clk_i),.saddr_i(saddr_i),.sdata_i(sdata_i),.s_strobe_i(s_strobe_i),
62       .reset_o(reset),.tx_strobe_o(tx_strobe_o),.tx_ctrl_o(tx_ctrl),.rx_ctrl_o(rx_ctrl),
63       .ampl_o(ampl),.fstart_o(fstart),.fincr_o(fincr));
64
65    radar_tx transmitter
66      ( .clk_i(clk_i),.rst_i(reset),.ena_i(tx_ctrl),.strobe_i(tx_strobe_o),
67        .ampl_i(ampl),.fstart_i(fstart),.fincr_i(fincr),
68        .tx_i_o(tx_dac_i_o),.tx_q_o(tx_dac_q_o) );
69    
70    radar_rx receiver
71      ( .clk_i(clk_i),.rst_i(reset),.ena_i(rx_ctrl & 1'b0), // Disable receiver for now
72        .strobe_i(rx_strobe_i),.rx_in_i_i(rx_adc_i_i),.rx_in_q_i(rx_adc_q_i),
73        .rx_strobe_o(rx_strobe_o),.rx_i_o(rx_ech_i_o),.rx_q_o(rx_ech_q_o) );
74    
75 endmodule // radar