~ubuntu-branches/ubuntu/trusty/gnuradio/trusty

« back to all changes in this revision

Viewing changes to gr-sounder/src/fpga/lib/sounder.v

  • Committer: Bazaar Package Importer
  • Author(s): Kamal Mostafa
  • Date: 2010-03-13 07:46:01 UTC
  • mfrom: (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100313074601-zjsa893a87bozyh7
Tags: 3.2.2.dfsg-1ubuntu1
* Fix build for Ubuntu lucid (LP: #260406)
  - add binary package dep for libusrp0, libusrp2-0: adduser
  - debian/rules clean: remove pre-built Qt moc files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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(clk_i, saddr_i, sdata_i, s_strobe_i,
 
26
               tx_strobe_o, tx_dac_i_o, tx_dac_q_o,
 
27
               rx_adc_i_i,rx_adc_q_i,
 
28
               rx_strobe_o, rx_imp_i_o,rx_imp_q_o);
 
29
 
 
30
   // System interface
 
31
   input         clk_i;         // Master clock @ 64 MHz
 
32
   input  [6:0]  saddr_i;       // Configuration bus address
 
33
   input  [31:0] sdata_i;       // Configuration bus data
 
34
   input         s_strobe_i;    // Configuration bus write
 
35
   
 
36
   // Transmit subsystem
 
37
   output        tx_strobe_o;   // Generate an transmitter output sample
 
38
   output [13:0] tx_dac_i_o;    // I channel transmitter output to DAC
 
39
   output [13:0] tx_dac_q_o;    // Q channel transmitter output to DAC
 
40
 
 
41
   // Receive subsystem
 
42
   output        rx_strobe_o;   // Indicates output samples ready for Rx FIFO
 
43
   input  [15:0] rx_adc_i_i;    // I channel input from ADC interface module
 
44
   input  [15:0] rx_adc_q_i;    // Q channel input from ADC interface module
 
45
   output [15:0] rx_imp_i_o;    // I channel impulse response to Rx FIFO
 
46
   output [15:0] rx_imp_q_o;    // Q channel impulse response to Rx FIFO
 
47
         
 
48
   // Internal variables
 
49
   wire          reset;
 
50
   wire          transmit;
 
51
   wire          receive;
 
52
   wire          loopback;
 
53
 
 
54
   wire [4:0]    degree;
 
55
   wire [13:0]   ampl;
 
56
   wire [15:0]   mask;
 
57
 
 
58
   wire          ref_strobe;
 
59
   wire          sum_strobe;
 
60
   sounder_ctrl  master(.clk_i(clk_i),.rst_i(reset),.saddr_i(saddr_i),
 
61
                        .sdata_i(sdata_i),.s_strobe_i(s_strobe_i),
 
62
                        .reset_o(reset),.transmit_o(transmit),.receive_o(receive),.loopback_o(loopback),
 
63
                        .degree_o(degree),.ampl_o(ampl),.mask_o(mask),.tx_strobe_o(tx_strobe_o),
 
64
                        .rx_strobe_o(rx_strobe_o),.sum_strobe_o(sum_strobe),.ref_strobe_o(ref_strobe));
 
65
      
 
66
   // Loopback implementation
 
67
   wire [13:0] tx_i, tx_q;      
 
68
   wire [15:0] tx_i_ext, tx_q_ext;
 
69
   wire [15:0] rx_i, rx_q; 
 
70
 
 
71
   sign_extend #(14,16) tx_i_extender(tx_i, tx_i_ext);
 
72
   sign_extend #(14,16) tx_q_extender(tx_q, tx_q_ext);
 
73
 
 
74
   assign tx_dac_i_o = loopback ? 14'b0 : tx_i;
 
75
   assign tx_dac_q_o = loopback ? 14'b0 : tx_q;
 
76
   assign rx_i       = loopback ? tx_i_ext : rx_adc_i_i;
 
77
   assign rx_q       = loopback ? tx_q_ext : rx_adc_q_i;
 
78
   
 
79
   sounder_tx transmitter
 
80
     ( .clk_i(clk_i),.rst_i(reset),.ena_i(transmit),
 
81
       .strobe_i(tx_strobe_o),.mask_i(mask),.ampl_i(ampl),
 
82
       .tx_i_o(tx_i),.tx_q_o(tx_q) );
 
83
   
 
84
   sounder_rx receiver
 
85
     ( .clk_i(clk_i),.rst_i(reset),.ena_i(receive),
 
86
       .sum_strobe_i(sum_strobe),.ref_strobe_i(ref_strobe),
 
87
       .mask_i(mask),.degree_i(degree),
 
88
       .rx_in_i_i(rx_i),.rx_in_q_i(rx_q),.rx_i_o(rx_imp_i_o),.rx_q_o(rx_imp_q_o));
 
89
 
 
90
endmodule // sounder