summaryrefslogtreecommitdiff
path: root/gr-radar-mono/src/fpga/lib/radar_tx.v
blob: c20dd0c1a1ca5aa1f9c0252239bb271db2dd8f3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// -*- verilog -*-
//
//  USRP - Universal Software Radio Peripheral
//
//  Copyright (C) 2007 Corgan Enterprises LLC
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301  USA
//

module radar_tx(clk_i,rst_i,ena_i,strobe_i,
		ampl_i,fstart_i,fincr_i,
		tx_i_o,tx_q_o);

   // System control
   input clk_i;
   input rst_i;
   input ena_i;
   input strobe_i;
   
   // Configuration
   input [15:0]  ampl_i;
   input [31:0]  fstart_i;
   input [31:0]  fincr_i;
   
   // Chirp output
   output [13:0] tx_i_o;
   output [13:0] tx_q_o;
   wire   [15:0] cordic_i, cordic_q;

   // Chirp generator
   reg [31:0] freq;

   always @(posedge clk_i)
     if (rst_i | ~ena_i)
       freq <= fstart_i;
     else
       if (strobe_i)
	 freq <= freq + fincr_i;
   
   cordic_nco nco(.clk_i(clk_i),.rst_i(rst_i),.ena_i(ena_i),.strobe_i(strobe_i),
		  .ampl_i(ampl_i),.freq_i(freq),.phs_i(0),
		  .data_i_o(cordic_i),.data_q_o(cordic_q));

   assign tx_i_o = cordic_i[13:0];
   assign tx_q_o = cordic_q[13:0];
	  
endmodule // radar_tx