Imported Upstream version 3.2.2
[debian/gnuradio] / gr-sounder / src / fpga / lib / sounder_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 `include "../../../../usrp/firmware/include/fpga_regs_common.v"
23 `include "../../../../usrp/firmware/include/fpga_regs_standard.v"
24
25 module sounder_tx(clk_i,rst_i,ena_i,strobe_i,ampl_i,mask_i,tx_i_o,tx_q_o);
26    input         clk_i;
27    input         rst_i;
28    input         ena_i;
29    input         strobe_i;
30    input  [13:0] ampl_i;
31    input  [15:0] mask_i;
32    output [13:0] tx_i_o;
33    output [13:0] tx_q_o;
34
35    wire          pn;
36    wire   [13:0] min_value = (~ampl_i)+14'b1;
37    
38    lfsr pn_code
39      ( .clk_i(clk_i),.rst_i(rst_i),.ena_i(ena_i),.strobe_i(strobe_i),.mask_i(mask_i),.pn_o(pn) );
40
41    assign tx_i_o = ena_i ? (pn ? ampl_i : min_value) : 14'b0; // Bipolar
42    assign tx_q_o = 14'b0;
43
44 endmodule // sounder_tx