]> git.gag.com Git - debian/gnuradio/blob - gr-radar-mono/src/fpga/lib/radar_rx.v
Merged r5945:6012 from jcorgan/radar into trunk. Updates gr-radar-mono component...
[debian/gnuradio] / gr-radar-mono / src / fpga / lib / radar_rx.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 "../../../../usrp/firmware/include/fpga_regs_common.v"
23 `include "../../../../usrp/firmware/include/fpga_regs_standard.v"
24
25 module radar_rx(clk_i,rst_i,ena_i,strobe_i,saddr_i,sdata_i,s_strobe_i,
26                 rx_in_i_i,rx_in_q_i,rx_i_o,rx_q_o,rx_strobe_o);
27    
28    input clk_i;
29    input rst_i;
30    input ena_i;
31    input strobe_i;
32
33    input [6:0] saddr_i;
34    input [31:0] sdata_i;
35    input s_strobe_i;
36
37    input [15:0] rx_in_i_i;
38    input [15:0] rx_in_q_i;
39    
40    output [15:0] rx_i_o;
41    output [15:0] rx_q_o;
42    output rx_strobe_o;
43
44    // Just count up for debugging
45    reg [31:0] counter;
46
47    always @(posedge clk_i)
48      begin
49         if (rst_i | ~ena_i)
50           counter <= 32'b0;
51         else if (strobe_i & rx_strobe_o)
52           counter <= counter + 32'b1;
53      end
54
55    assign rx_i_o = ena_i ? counter[31:16] : 16'b0;
56    assign rx_q_o = ena_i ? counter[15:0] : 16'b0;
57    
58    // Temporarily we duplicate what master_control.v did to generate decim_strobe
59    // so we can do receive debugging. Later we'll drive rx_strobe_o in bursts to
60    // load receiver data into the rx fifo.
61    strobe_gen rx_strobe_gen
62      ( .clock(clk_i),.reset(rst_i),.enable(ena_i),.rate(7),.strobe_in(strobe_i),.strobe(rx_strobe_o) );
63    
64 endmodule // radar_rx