commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r5483 - in gnuradio/branches/developers/jcorgan/snd/gr


From: jcorgan
Subject: [Commit-gnuradio] r5483 - in gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga: lib tb top
Date: Wed, 16 May 2007 17:03:31 -0600 (MDT)

Author: jcorgan
Date: 2007-05-16 17:03:31 -0600 (Wed, 16 May 2007)
New Revision: 5483

Modified:
   gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder.v
   gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_rx.v
   gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_tx.v
   
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/tb/sounder_tb.sav
   gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/tb/sounder_tb.v
   
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/top/usrp_sounder.rbf
Log:
Work in progress.

Modified: 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder.v
===================================================================
--- gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder.v  
2007-05-16 22:18:33 UTC (rev 5482)
+++ gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder.v  
2007-05-16 23:03:31 UTC (rev 5483)
@@ -66,13 +66,17 @@
    lfsr_constants constants(.degree_i(degree),.mask_o(mask),.len_o(len));
 
    // Loopback implementation
-   wire [13:0] tx_i, tx_q; // Internal transmit and receive data busses
+   wire [13:0] tx_i, tx_q;      
+   wire [15:0] tx_i_ext, tx_q_ext;
    wire [15:0] rx_i, rx_q; 
 
-   assign tx_dac_i_o = loopback ? 13'b0 : tx_i;
-   assign tx_dac_q_o = loopback ? 13'b0 : tx_q;
-   assign rx_i       = loopback ? {tx_i,2'b00} : rx_adc_i_i;
-   assign rx_q       = loopback ? {tx_q,2'b00} : rx_adc_q_i;
+   sign_extend #(14,16) tx_i_extender(tx_i, tx_i_ext);
+   sign_extend #(14,16) tx_q_extender(tx_q, tx_q_ext);
+
+   assign tx_dac_i_o = loopback ? 14'b0 : tx_i;
+   assign tx_dac_q_o = loopback ? 14'b0 : tx_q;
+   assign rx_i       = loopback ? tx_i_ext : rx_adc_i_i;
+   assign rx_q       = loopback ? tx_q_ext : rx_adc_q_i;
    
    sounder_tx transmitter
      ( .clk_i(clk_i),.rst_i(reset),.ena_i(transmit),
@@ -81,7 +85,7 @@
    
    sounder_rx receiver
      ( .clk_i(clk_i),.rst_i(reset),.ena_i(receive),
-       
.rx_strobe_i(rx_strobe_i),.tx_strobe_i(tx_strobe_i),.mask_i(mask),.len_i(len),
+       
.rx_strobe_i(rx_strobe_i),.tx_strobe_i(tx_strobe_i),.mask_i(mask),.degree_i(degree),.len_i(len),
        
.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),
        .rx_strobe_o(rx_strobe_o),.loop_i(loopback));
 

Modified: 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_rx.v
===================================================================
--- 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_rx.v   
    2007-05-16 22:18:33 UTC (rev 5482)
+++ 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_rx.v   
    2007-05-16 23:03:31 UTC (rev 5483)
@@ -19,7 +19,7 @@
 //  Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301  USA
 //
 
-module sounder_rx(clk_i,rst_i,ena_i,rx_strobe_i,tx_strobe_i,mask_i,len_i,
+module 
sounder_rx(clk_i,rst_i,ena_i,rx_strobe_i,tx_strobe_i,mask_i,degree_i,len_i,
                  rx_in_i_i,rx_in_q_i,rx_i_o,rx_q_o,rx_strobe_o,
                  loop_i);
    
@@ -30,6 +30,7 @@
    input         tx_strobe_i;  // Strobe every transmitted sample
     
    input  [15:0] mask_i;       // PN code LFSR mask
+   input  [4:0]  degree_i;     // PN code LFSR sequency degree
    input  [15:0] len_i;                // PN code LFSR sequence length
    input  [15:0] rx_in_i_i;    // I channel on receive
    input  [15:0] rx_in_q_i;    // Q channel on receive
@@ -53,6 +54,7 @@
 
    // For debugging, accumulate the sum of the input over one phase period
    reg [31:0]  sum_i;
+   wire [31:0] sum_scaled_i = sum_i << (5'd16-degree_i);
    
    wire [31:0] i_ext;
    wire [31:0] q_ext;
@@ -69,8 +71,8 @@
        end
      else if (rx_strobe_o)
        begin
-         rx_i_o <= sum_i[31:16];
-         rx_q_o <= sum_i[15:0];
+         rx_i_o <= sum_scaled_i[31:16];
+         rx_q_o <= sum_scaled_i[15:0];
          sum_i <= i_ext;
        end
      else if (strobe_in)

Modified: 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_tx.v
===================================================================
--- 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_tx.v   
    2007-05-16 22:18:33 UTC (rev 5482)
+++ 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_tx.v   
    2007-05-16 23:03:31 UTC (rev 5483)
@@ -23,7 +23,7 @@
 `include "../../../../usrp/firmware/include/fpga_regs_standard.v"
 
 `define MAX_VALUE 14'h1FFF // 2s complement
-`define MIN_VALUE 14'h2000
+`define MIN_VALUE 14'h2001
 
 module sounder_tx(clk_i,rst_i,ena_i,strobe_i,mask_i,tx_i_o,tx_q_o);
    input         clk_i;

Modified: 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/tb/sounder_tb.sav
===================================================================
--- 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/tb/sounder_tb.sav  
    2007-05-16 22:18:33 UTC (rev 5482)
+++ 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/tb/sounder_tb.sav  
    2007-05-16 23:03:31 UTC (rev 5483)
@@ -1,4 +1,4 @@
-*-15.000000 119600 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 
-1 -1 -1 -1 -1 -1
+*-17.000000 321700 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 
-1 -1 -1 -1 -1 -1
 @28
 sounder_tb.uut.clk_i
 sounder_tb.rst
@@ -7,3 +7,34 @@
 sounder_tb.sdata[31:0]
 @28
 sounder_tb.uut.reset
+sounder_tb.uut.transmit
+sounder_tb.uut.receive
+sounder_tb.uut.loopback
address@hidden
+-
address@hidden
+sounder_tb.uut.degree[4:0]
+sounder_tb.uut.len[15:0]
address@hidden
+-
address@hidden
+sounder_tb.tx_strobe
+sounder_tb.tx_dac_i[13:0]
address@hidden
+-
address@hidden
+sounder_tb.fifo_strobe
address@hidden
+sounder_tb.fifo_i[15:0]
+sounder_tb.fifo_q[15:0]
address@hidden
+-
address@hidden
+sounder_tb.uut.transmitter.pn_code.pn_o
+sounder_tb.uut.transmitter.tx_i_o[13:0]
address@hidden
+sounder_tb.uut.receiver.phase_strobe.count_o[16:0]
+sounder_tb.uut.receiver.i_ext[31:0]
address@hidden
+sounder_tb.uut.receiver.sum_i[31:0]
+sounder_tb.uut.receiver.sum_scaled_i[31:0]

Modified: 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/tb/sounder_tb.v
===================================================================
--- 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/tb/sounder_tb.v    
    2007-05-16 22:18:33 UTC (rev 5482)
+++ 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/tb/sounder_tb.v    
    2007-05-16 23:03:31 UTC (rev 5483)
@@ -25,6 +25,9 @@
 
 `define FR_MODE                7'd64
 `define bmFR_MODE_RESET                32'h0001
+`define bmFR_MODE_TX            32'h0002
+`define bmFR_MODE_RX            32'h0004
+`define bmFR_MODE_LP            32'h0008
 
 `define FR_DEGREE              7'd65
 
@@ -41,7 +44,7 @@
    reg                s_strobe;
 
    // DAC bus
-   wire        tx_strobe;
+   reg         tx_strobe;
    wire [13:0] tx_dac_i;
    wire [13:0] tx_dac_q;
 
@@ -49,23 +52,26 @@
    reg         rx_strobe;
    reg [15:0]  rx_adc_i;
    reg [15:0]  rx_adc_q;
-
+   
    // FIFO bus
    wire        fifo_strobe;
    wire [15:0] fifo_i;
    wire [15:0] fifo_q;
-
+   
    // Configuration shadow registers
-   reg [31:0] mode;
-   reg [31:0] degree;
+   reg [31:0]  mode;
+   reg [31:0]  degree;
    
    sounder uut
      (.clk_i(clk),.saddr_i(saddr),.sdata_i(sdata),.s_strobe_i(s_strobe),
       .tx_strobe_i(tx_strobe),.tx_dac_i_o(tx_dac_i),.tx_dac_q_o(tx_dac_q),
       .rx_strobe_i(rx_strobe),.rx_adc_i_i(rx_adc_i),.rx_adc_q_i(rx_adc_q),
       .rx_strobe_o(fifo_strobe),.rx_imp_i_o(fifo_i),.rx_imp_q_o(fifo_q));
+   
+   // Drive tx_strobe @ half clock rate
+   always @(posedge clk)
+     tx_strobe = ~tx_strobe;
 
-
    // Start up initialization
    initial
      begin
@@ -75,7 +81,8 @@
        saddr = 0;
        sdata = 0;
        s_strobe = 0;
-       rx_strobe = 0;
+       tx_strobe = 0;
+       rx_strobe = 1;
        rx_adc_i = 0;
        rx_adc_q = 0;
        mode = 0;
@@ -88,21 +95,21 @@
        @(posedge clk);
        ena = 1;
      end
-
+   
    always
      #5 clk <= ~clk;
-
+   
    initial
      begin
        $dumpfile("sounder_tb.vcd");
        $dumpvars(0, sounder_tb);
      end
-   
+
    // Test tasks
    task write_cfg_register;
       input [6:0]  regno;
       input [31:0] value;
-
+      
       begin
         @(posedge clk);
         saddr <= regno;
@@ -112,22 +119,88 @@
         s_strobe <= 0;
       end
    endtask // write_cfg_register
-
-   task reset;
-     begin
-       mode = mode | `bmFR_MODE_RESET;
-       write_cfg_register(`FR_MODE, mode);
-       mode = mode & ~`bmFR_MODE_RESET;
-       write_cfg_register(`FR_MODE, mode);
-     end
+   
+   // Application reset line
+   task set_reset;
+      input reset;
+      
+      begin
+        mode = reset ? (mode | `bmFR_MODE_RESET) : (mode & ~`bmFR_MODE_RESET);
+        write_cfg_register(`FR_MODE, mode);
+      end
    endtask // reset
    
+   // Set the PN code degree
+   task set_degree;
+      input [5:0] degree;
+      begin
+        write_cfg_register(`FR_DEGREE, degree);
+      end
+   endtask // set_degree
    
+   // Turn on or off the transmitter
+   task enable_tx;
+      input tx;
+
+      begin
+        mode = tx ? (mode | `bmFR_MODE_TX) : (mode & ~`bmFR_MODE_TX);
+        write_cfg_register(`FR_MODE, mode);
+      end
+   endtask // enable_tx
+
+   // Turn on or off the receiver
+   task enable_rx;
+      input rx;
+
+      begin
+        mode = rx ? (mode | `bmFR_MODE_RX) : (mode & ~`bmFR_MODE_RX);
+        write_cfg_register(`FR_MODE, mode);
+      end
+   endtask // enable_rx
+
+
+   // Turn on or off digital loopback
+   task enable_lp;
+      input lp;
+
+      begin
+        mode = lp ? (mode | `bmFR_MODE_LP) : (mode & ~`bmFR_MODE_LP);
+        write_cfg_register(`FR_MODE, mode);
+      end
+   endtask // enable_lp
+   
+   // Test transmitter functionality
+   task test_tx;
+      input [5:0] degree;
+      
+      begin
+        #20 set_reset(1);
+        #20 set_degree(degree);
+        #20 enable_tx(1);
+        #20 set_reset(0);
+      end
+   endtask // test_tx
+   
+   // Test loopback functionality
+   task test_lp;
+      input [5:0] degree;
+      
+      begin
+        #20 set_reset(1);
+        #20 set_degree(degree);
+        #20 enable_tx(1);
+        #20 enable_rx(1);
+        #20 enable_lp(1);
+        #20 set_reset(0);
+      end
+   endtask // test_lp
+   
    // Execute tests
    initial
      begin
-       #100 reset;
-       #1000 $finish;
+       #20 test_lp(8);
+       
+       #10000 $finish;
      end
 endmodule
 

Modified: 
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/top/usrp_sounder.rbf
===================================================================
(Binary files differ)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]