summaryrefslogtreecommitdiff
path: root/gr-radar-mono/src/fpga/tb
diff options
context:
space:
mode:
authorjcorgan2007-07-18 20:20:30 +0000
committerjcorgan2007-07-18 20:20:30 +0000
commit0c30f34bf0afa14e8f2ee128dd4168c7c372b862 (patch)
tree080a5617dced0b5c60e2b0a3a3423e9d4eabd875 /gr-radar-mono/src/fpga/tb
parent21a86c72fb9059cd975603dbae7d06665cfab373 (diff)
downloadgnuradio-0c30f34bf0afa14e8f2ee128dd4168c7c372b862.tar.gz
gnuradio-0c30f34bf0afa14e8f2ee128dd4168c7c372b862.tar.bz2
gnuradio-0c30f34bf0afa14e8f2ee128dd4168c7c372b862.zip
Merged r5945:6012 from jcorgan/radar into trunk. Updates gr-radar-mono component. Trunk passes distcheck.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6013 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-radar-mono/src/fpga/tb')
-rw-r--r--gr-radar-mono/src/fpga/tb/radar_tb.sav15
-rw-r--r--gr-radar-mono/src/fpga/tb/radar_tb.v102
2 files changed, 73 insertions, 44 deletions
diff --git a/gr-radar-mono/src/fpga/tb/radar_tb.sav b/gr-radar-mono/src/fpga/tb/radar_tb.sav
index a4015a764..dbc321fce 100644
--- a/gr-radar-mono/src/fpga/tb/radar_tb.sav
+++ b/gr-radar-mono/src/fpga/tb/radar_tb.sav
@@ -1,17 +1,17 @@
-*-20.535921 1109000 -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
+*-24.712317 37100000 -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
radar_tb.clk
radar_tb.ena
radar_tb.rst
radar_tb.uut.reset
-radar_tb.uut.tx_enable
-radar_tb.uut.rx_enable
@200
-
-@24
-radar_tb.uut.freq[31:0]
-@421
+@420
radar_tb.uut.controller.ampl_o[15:0]
+@22
+radar_tb.uut.controller.fstart_o[31:0]
+radar_tb.uut.controller.fincr_o[31:0]
+radar_tb.uut.transmitter.freq[31:0]
@200
-
@28
@@ -21,3 +21,6 @@ radar_tb.uut.tx_dac_i_o[13:0]
radar_tb.uut.tx_dac_q_o[13:0]
@200
-
+@28
+radar_tb.uut.controller.tx_ctrl_o
+radar_tb.uut.controller.rx_ctrl_o
diff --git a/gr-radar-mono/src/fpga/tb/radar_tb.v b/gr-radar-mono/src/fpga/tb/radar_tb.v
index 5551a1672..0620582e6 100644
--- a/gr-radar-mono/src/fpga/tb/radar_tb.v
+++ b/gr-radar-mono/src/fpga/tb/radar_tb.v
@@ -36,7 +36,7 @@ module radar_tb;
reg s_strobe;
// DAC bus
- reg tx_strobe;
+ wire tx_strobe;
wire [13:0] tx_dac_i;
wire [13:0] tx_dac_q;
@@ -55,14 +55,10 @@ module radar_tb;
radar 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),
+ .tx_strobe_o(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_ech_i_o(fifo_i),.rx_ech_q_o(fifo_q));
- // Drive tx_strobe @ half clock rate
- always @(posedge clk)
- tx_strobe <= ~tx_strobe;
-
// Start up initialization
initial
begin
@@ -72,7 +68,6 @@ module radar_tb;
saddr = 0;
sdata = 0;
s_strobe = 0;
- tx_strobe = 0;
rx_strobe = 1;
rx_adc_i = 0;
rx_adc_q = 0;
@@ -122,54 +117,85 @@ module radar_tb;
end
endtask // reset
- // Enable/disable transmitter
- task enable_tx;
- input enabled;
-
+ // Waveform on time
+ task set_ton;
+ input [23:0] t_on;
+
begin
- mode = enabled ? (mode | `bmFR_RADAR_MODE_TX) : (mode & ~`bmFR_RADAR_MODE_TX);
- write_cfg_register(`FR_RADAR_MODE, mode);
+ write_cfg_register(`FR_RADAR_TON, t_on);
end
- endtask // enable_tx
-
- // Enable/disable receiver
- task enable_rx;
- input enabled;
-
+ endtask // set_ton
+
+ // Transmitter switching time
+ task set_tsw;
+ input [23:0] t_sw;
+
begin
- mode = enabled ? (mode | `bmFR_RADAR_MODE_RX) : (mode & ~`bmFR_RADAR_MODE_RX);
- write_cfg_register(`FR_RADAR_MODE, mode);
+ write_cfg_register(`FR_RADAR_TSW, t_sw);
end
- endtask // enable_rx
-
- // Waveform amplitude
- task set_amplitude;
- input [13:0] amp;
+ endtask // t_sw
+
+ // Receiver look time
+ task set_tlook;
+ input [23:0] t_look;
+
+ begin
+ write_cfg_register(`FR_RADAR_TLOOK, t_look);
+ end
+ endtask // set_tlook
+
+ // Inter-pulse idle time
+ task set_tidle;
+ input [23:0] t_idle;
+
+ begin
+ write_cfg_register(`FR_RADAR_TIDLE, t_idle);
+ end
+ endtask // set_tidle
+
+ // Chirp amplitude
+ task set_ampl;
+ input [31:0] ampl;
begin
- write_cfg_register(`FR_RADAR_AMPL, amp);
+ write_cfg_register(`FR_RADAR_AMPL, ampl);
end
- endtask // set_amplitude
+ endtask // set_ampl
+
+ // Chirp start frequency
+ task set_fstart;
+ input [31:0] fstart;
- // Waveform frequency
- task set_frequency;
- input [31:0] freq;
+ begin
+ write_cfg_register(`FR_RADAR_FSTART, fstart);
+ end
+ endtask // set_fstart
+
+ // Chirp frequency increment
+ task set_fincr;
+ input [31:0] fincr;
begin
- write_cfg_register(`FR_RADAR_FREQ1N, freq);
+ write_cfg_register(`FR_RADAR_FINCR, fincr);
end
- endtask // frequency
+ endtask // set_fincr
// Test transmitter functionality
task test_tx;
begin
#20 set_reset(1);
- #20 set_amplitude(16'd9946);
- #20 set_frequency(32'h08000000);
- #20 enable_tx(1);
- #20 enable_rx(0);
+
+ #20 set_ton(320-1); // 5us on time
+ #20 set_tsw(26-1); // 406ns switching time
+ #20 set_tlook(320-1); // 5us look time
+ #20 set_tidle(3174-1); // 60us pulse period
+
+ #20 set_ampl(16'd9946);
+ #20 set_fstart(32'h80000000); // -16 to 16 MHz
+ #20 set_fincr (32'h0199999A);
+
#20 set_reset(0);
- #10000;
+ #200000;
end
endtask // test_tx