[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5070 - in gnuradio/branches/developers/jcorgan/snd/gr
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r5070 - in gnuradio/branches/developers/jcorgan/snd/gr-sounder/src: fpga/lib fpga/rbf/rev2 fpga/rbf/rev4 fpga/top python |
Date: |
Sun, 22 Apr 2007 00:59:25 -0600 (MDT) |
Author: jcorgan
Date: 2007-04-22 00:59:25 -0600 (Sun, 22 Apr 2007)
New Revision: 5070
Added:
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/lfsr_constants.v
Modified:
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder.v
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_tx.v
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/rbf/rev2/usrp_sounder.rbf
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/rbf/rev4/usrp_sounder.rbf
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/top/usrp_sounder.qsf
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/python/usrp_sounder.py
Log:
Work in progress, now able to set PN sequence length from command line.
Added:
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/lfsr_constants.v
===================================================================
---
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/lfsr_constants.v
(rev 0)
+++
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/lfsr_constants.v
2007-04-22 06:59:25 UTC (rev 5070)
@@ -0,0 +1,51 @@
+// -*- 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 lfsr_constants(degree_i,mask_o,len_o);
+ input wire [4:0] degree_i;
+ output reg [15:0] mask_o;
+ output wire [15:0] len_o;
+
+ assign len_o = 16'b1 << degree_i - 1;
+
+ always @*
+ case (degree_i)
+ 5'd00: mask_o = 16'h0000;
+ 5'd01: mask_o = 16'h0001;
+ 5'd02: mask_o = 16'h0003;
+ 5'd03: mask_o = 16'h0005;
+ 5'd04: mask_o = 16'h0009;
+ 5'd05: mask_o = 16'h0012;
+ 5'd06: mask_o = 16'h0021;
+ 5'd07: mask_o = 16'h0041;
+ 5'd08: mask_o = 16'h008E;
+ 5'd09: mask_o = 16'h0108;
+ 5'd10: mask_o = 16'h0204;
+ 5'd11: mask_o = 16'h0402;
+ 5'd12: mask_o = 16'h0829;
+ 5'd13: mask_o = 16'h100D;
+ 5'd14: mask_o = 16'h2015;
+ 5'd15: mask_o = 16'h4001;
+ 5'd16: mask_o = 16'h8016;
+ default: mask_o = 16'h0000;
+ endcase // case(degree_i)
+
+endmodule // lfsr_constants
Property changes on:
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/lfsr_constants.v
___________________________________________________________________
Name: svn:executable
+ *
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-04-22 00:52:33 UTC (rev 5069)
+++ gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder.v
2007-04-22 06:59:25 UTC (rev 5070)
@@ -50,40 +50,23 @@
output [15:0] rx_imp_q_o; // Q channel impulse response to Rx FIFO
output [15:0] rx_debug_o; // Receive subsystem debugger bus
- wire [15:0] lfsr_mask; // PN code parity mask
+ wire [4:0] degree; // LFSR register length
+ wire [15:0] mask; // LFSR parity mask
+ wire [15:0] len; // PN code sequence length
- setting_reg #(`FR_USER_0) sr_lfsr_mask
- ( .clock(clk_i),
- .reset(1'b0),
- .strobe(s_strobe_i),
- .addr(saddr_i),
- .in(sdata_i),
- .out(lfsr_mask)
- );
+ setting_reg #(`FR_USER_0) sr_lfsr_degree
+ (
.clock(clk_i),.reset(1'b0),.strobe(s_strobe_i),.addr(saddr_i),.in(sdata_i),.out(degree)
);
+ lfsr_constants constants(.degree_i(degree),.mask_o(mask),.len_o(len));
+
sounder_tx transmitter
- ( .clk_i(clk_i),
- .rst_i(tx_rst_i),
- .ena_i(tx_enable_i),
- .strobe_i(tx_strobe_i),
- .lfsr_mask_i(lfsr_mask),
- .tx_i_o(tx_dac_i_o),
- .tx_q_o(tx_dac_q_o),
- .debug_o(tx_debug_o)
- );
+ (
.clk_i(clk_i),.rst_i(tx_rst_i),.ena_i(tx_enable_i),.strobe_i(tx_strobe_i),.mask_i(mask),
+ .tx_i_o(tx_dac_i_o),.tx_q_o(tx_dac_q_o),.debug_o(tx_debug_o) );
sounder_rx receiver
- ( .clk_i(clk_i),
- .rst_i(rx_rst_i),
- .ena_i(rx_enable_i),
- .strobe_i(1'b1),
- .rx_in_i_i(rx_adc_i_i),
- .rx_in_q_i(rx_adc_q_i),
- .rx_i_o(rx_imp_i_o),
- .rx_q_o(rx_imp_q_o),
- .rx_strobe_o(rx_strobe_o),
- .debug_o(rx_debug_o)
- );
+ (
.clk_i(clk_i),.rst_i(rx_rst_i),.ena_i(rx_enable_i),.strobe_i(1'b1),.rx_in_i_i(rx_adc_i_i),
+
.rx_in_q_i(rx_adc_q_i),.rx_i_o(rx_imp_i_o),.rx_q_o(rx_imp_q_o),.rx_strobe_o(rx_strobe_o),
+ .debug_o(rx_debug_o));
endmodule // sounder
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-04-22 00:52:33 UTC (rev 5069)
+++
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/lib/sounder_tx.v
2007-04-22 06:59:25 UTC (rev 5070)
@@ -25,13 +25,12 @@
`define MAX_VALUE 16'h7FFF // 2s complement
`define MIN_VALUE 16'h8000
-module
sounder_tx(clk_i,rst_i,ena_i,strobe_i,tx_i_o,tx_q_o,lfsr_mask_i,debug_o);
+module sounder_tx(clk_i,rst_i,ena_i,strobe_i,mask_i,tx_i_o,tx_q_o,debug_o);
input clk_i;
input rst_i;
input ena_i;
input strobe_i;
- input [15:0] lfsr_mask_i;
-
+ input [15:0] mask_i;
output [15:0] tx_i_o;
output [15:0] tx_q_o;
output [15:0] debug_o;
@@ -39,7 +38,7 @@
wire pn;
lfsr pn_code
- (
.clk_i(clk_i),.rst_i(rst_i),.ena_i(ena_i),.strobe_i(strobe_i),.mask_i(lfsr_mask_i),.pn_o(pn)
);
+ (
.clk_i(clk_i),.rst_i(rst_i),.ena_i(ena_i),.strobe_i(strobe_i),.mask_i(mask_i),.pn_o(pn)
);
assign tx_i_o = pn ? `MAX_VALUE : `MIN_VALUE; // Bipolar
assign tx_q_o = 16'b0;
Modified:
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/rbf/rev2/usrp_sounder.rbf
===================================================================
(Binary files differ)
Modified:
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/rbf/rev4/usrp_sounder.rbf
===================================================================
(Binary files differ)
Modified:
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/top/usrp_sounder.qsf
===================================================================
---
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/top/usrp_sounder.qsf
2007-04-22 00:52:33 UTC (rev 5069)
+++
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/fpga/top/usrp_sounder.qsf
2007-04-22 06:59:25 UTC (rev 5070)
@@ -368,6 +368,7 @@
set_instance_assignment -name PARTITION_HIERARCHY no_file_for_top_partition
-to | -section_id Top
set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
+set_global_assignment -name VERILOG_FILE ../lib/lfsr_constants.v
set_global_assignment -name VERILOG_FILE ../lib/sounder.v
set_global_assignment -name VERILOG_FILE ../lib/lfsr.v
set_global_assignment -name VERILOG_FILE
../../../../usrp/fpga/sdr_lib/atr_delay.v
Modified:
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/python/usrp_sounder.py
===================================================================
---
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/python/usrp_sounder.py
2007-04-22 00:52:33 UTC (rev 5069)
+++
gnuradio/branches/developers/jcorgan/snd/gr-sounder/src/python/usrp_sounder.py
2007-04-22 06:59:25 UTC (rev 5070)
@@ -24,20 +24,22 @@
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-import time
+import sys, time
+n2s = eng_notation.num_to_str
+
# Set to 0 for 32 MHz tx clock, 1 for 64 MHz tx clock
# Must match config.vh in FPGA code
TX_RATE_MAX = 0
_tx_freq_divisor = 32e6*(TX_RATE_MAX+1)
class sounder_tx:
- def __init__(self, frequency, mask):
+ def __init__(self, frequency, degree):
self.trans = usrp.sink_s(fpga_filename='usrp_sounder.rbf')
self.subdev_spec = usrp.pick_tx_subdevice(self.trans)
self.subdev = usrp.selected_subdev(self.trans, self.subdev_spec)
self.trans.tune(0, self.subdev, frequency)
- self.set_mask(mask);
+ self.set_degree(degree);
def turn_on(self):
self.trans.start()
@@ -45,24 +47,24 @@
def turn_off(self):
self.trans.stop()
- def set_mask(self, value):
+ def set_degree(self, value):
return self.trans._write_fpga_reg(usrp.FR_USER_0, value);
class sounder_rx:
- def __init__(self, frequency, mask):
+ def __init__(self, frequency, degree):
self.fg = gr.flow_graph()
self.rcvr = usrp.source_s(fpga_filename='usrp_sounder.rbf',
decim_rate=8)
self.subdev_spec = usrp.pick_rx_subdevice(self.rcvr)
self.subdev = usrp.selected_subdev(self.rcvr, self.subdev_spec)
self.rcvr.tune(0, self.subdev, frequency)
- self.set_mask(mask);
+ self.set_degree(degree);
self.sink = gr.file_sink(gr.sizeof_short, "output.dat")
self.fg.connect(self.rcvr, self.sink)
def receive(self):
self.fg.run()
- def set_mask(self, value):
+ def set_degree(self, value):
return self.rcvr._write_fpga_reg(usrp.FR_USER_0, value);
def main():
@@ -71,28 +73,32 @@
help="set frequency to FREQ in Hz, default is %default",
metavar="FREQ")
parser.add_option("-t", "--transmit", action="store_true", default=False,
- help="enable sounding transmitter, default is %default")
+ help="enable sounding transmitter")
parser.add_option("-r", "--receive", action="store_true", default=False,
- help="enable sounding receiver, default is %default")
+ help="enable sounding receiver")
+ parser.add_option("-d", "--degree", type="int", default=16,
+ help="set souding sequence degree (len=2^degree-1),
default is %default")
+
(options, args) = parser.parse_args()
- options.mask = 0x0801;
-
- if len(args) != 0:
+ if len(args) != 0 or not (options.transmit | options.receive):
parser.print_help()
sys.exit(1)
+ print "Using PN code degree of", options.degree, "length",
2**options.degree-1
+ print "Sounding frequency range is", n2s(options.frequency-16e6), "to",
n2s(options.frequency+16e6)
+
if (options.transmit):
print "Enabling sounder transmitter."
- tx = sounder_tx(options.frequency, options.mask)
+ tx = sounder_tx(options.frequency, options.degree)
tx.turn_on()
try:
if (options.receive):
print "Enabling sounder receiver."
- rx = sounder_rx(options.frequency, options.mask)
+ rx = sounder_rx(options.frequency, options.degree)
rx.receive()
else:
if (options.transmit):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5070 - in gnuradio/branches/developers/jcorgan/snd/gr-sounder/src: fpga/lib fpga/rbf/rev2 fpga/rbf/rev4 fpga/top python,
jcorgan <=