9aa2e217b7c264aed8b5954958826857115b4f9c
[debian/gnuradio] / gr-radar-mono / src / fpga / lib / radar_control.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_control(clk_i,rst_i,ena_i,saddr_i,sdata_i,s_strobe_i,
25                      reset_o,tx_ena_o,rx_ena_o,ampl_o,freq_o);
26
27    // System interface
28    input         clk_i;         // Master clock @ 64 MHz
29    input         rst_i;         // Master reset
30    input         ena_i;         // Module level enable
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    // Configuration outputs
36    output        reset_o;
37    output        tx_ena_o;
38    output        rx_ena_o;
39    
40    output [15:0] ampl_o;
41    output [31:0] freq_o;
42
43    // Internal configuration
44    wire          lp_ena;
45    wire          dr_ena;
46    wire          md_ena;
47    wire [1:0]    chirps;
48
49    // Configuration from host
50    setting_reg #(`FR_RADAR_MODE) sr_mode(.clock(clk_i),.reset(rst_i),.strobe(s_strobe_i),.addr(saddr_i),.in(sdata_i),
51                                        .out({chirps,md_ena,dr_ena,lp_ena,rx_ena_o,tx_ena_o,reset_o}));
52                                      
53    setting_reg #(`FR_RADAR_AMPL) sr_ampl(.clock(clk_i),.reset(rst_i),.strobe(s_strobe_i),.addr(saddr_i),.in(sdata_i),
54                                        .out(ampl_o));
55
56    setting_reg #(`FR_RADAR_FREQ1N) sr_freq(.clock(clk_i),.reset(rst_i),.strobe(s_strobe_i),.addr(saddr_i),.in(sdata_i),
57                                          .out(freq_o));
58    
59 endmodule // radar_control