Imported Upstream version 3.2.2
[debian/gnuradio] / gr-radar-mono / src / fpga / lib / radar_tx.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 module radar_tx(clk_i,rst_i,ena_i,strobe_i,
23                 ampl_i,fstart_i,fincr_i,
24                 tx_i_o,tx_q_o);
25
26    // System control
27    input clk_i;
28    input rst_i;
29    input ena_i;
30    input strobe_i;
31    
32    // Configuration
33    input [15:0]  ampl_i;
34    input [31:0]  fstart_i;
35    input [31:0]  fincr_i;
36    
37    // Chirp output
38    output [13:0] tx_i_o;
39    output [13:0] tx_q_o;
40    wire   [15:0] cordic_i, cordic_q;
41
42    // Chirp generator
43    reg [31:0] freq;
44
45    always @(posedge clk_i)
46      if (rst_i | ~ena_i)
47        freq <= fstart_i;
48      else
49        if (strobe_i)
50          freq <= freq + fincr_i;
51    
52    cordic_nco nco(.clk_i(clk_i),.rst_i(rst_i),.ena_i(ena_i),.strobe_i(strobe_i),
53                   .ampl_i(ampl_i),.freq_i(freq),.phs_i(0),
54                   .data_i_o(cordic_i),.data_q_o(cordic_q));
55
56    assign tx_i_o = cordic_i[13:0];
57    assign tx_q_o = cordic_q[13:0];
58           
59 endmodule // radar_tx