summaryrefslogtreecommitdiff
path: root/gr-digital
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital')
-rw-r--r--gr-digital/examples/demod/ber_simulation.grc320
-rw-r--r--gr-digital/examples/demod/digital_freq_lock.grc96
-rw-r--r--gr-digital/examples/demod/pam_sync.grc524
-rw-r--r--gr-digital/examples/demod/pam_timing.grc756
-rw-r--r--gr-digital/grc/digital_block_tree.xml1
-rw-r--r--gr-digital/grc/digital_simple_correlator.xml25
-rw-r--r--gr-digital/include/CMakeLists.txt1
-rw-r--r--gr-digital/include/digital_simple_correlator.h107
-rw-r--r--gr-digital/lib/CMakeLists.txt1
-rw-r--r--gr-digital/lib/digital_simple_correlator.cc231
-rwxr-xr-xgr-digital/python/qa_simple_correlator.py62
-rw-r--r--gr-digital/swig/CMakeLists.txt1
-rw-r--r--gr-digital/swig/digital_simple_correlator.i31
-rw-r--r--gr-digital/swig/digital_swig.i2
14 files changed, 1245 insertions, 913 deletions
diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc
index daf8bfde0..9d7b9c946 100644
--- a/gr-digital/examples/demod/ber_simulation.grc
+++ b/gr-digital/examples/demod/ber_simulation.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Thu Jul 5 15:57:06 2012</timestamp>
+ <timestamp>Mon Jan 14 11:20:53 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -123,29 +123,6 @@
</param>
</block>
<block>
- <key>digital_constellation_decoder_cb</key>
- <param>
- <key>id</key>
- <value>digital_constellation_decoder_cb_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>constellation</key>
- <value>const.base()</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(618, 164)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>wxgui_numbersink2</key>
<param>
<key>id</key>
@@ -256,22 +233,54 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>variable_slider</key>
<param>
<key>id</key>
- <value>const</value>
+ <value>EbN0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
+ <key>label</key>
+ <value>Eb/N0 (dB)</value>
+ </param>
+ <param>
<key>value</key>
- <value>digital.qpsk_constellation()</value>
+ <value>10</value>
+ </param>
+ <param>
+ <key>min</key>
+ <value>-10</value>
+ </param>
+ <param>
+ <key>max</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>211</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(116, 310)</value>
+ <value>(311, 309)</value>
</param>
<param>
<key>_rotation</key>
@@ -282,7 +291,7 @@
<key>variable</key>
<param>
<key>id</key>
- <value>samp_rate</value>
+ <value>const</value>
</param>
<param>
<key>_enabled</key>
@@ -290,11 +299,11 @@
</param>
<param>
<key>value</key>
- <value>100e3</value>
+ <value>(digital.constellation_bpsk(), digital.constellation_qpsk(), digital.constellation_8psk())</value>
</param>
<param>
<key>_coordinate</key>
- <value>(16, 308)</value>
+ <value>(116, 310)</value>
</param>
<param>
<key>_rotation</key>
@@ -302,10 +311,10 @@
</param>
</block>
<block>
- <key>wxgui_scopesink2</key>
+ <key>random_source_x</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0</value>
+ <value>random_source_x</value>
</param>
<param>
<key>_enabled</key>
@@ -313,63 +322,101 @@
</param>
<param>
<key>type</key>
- <value>complex</value>
+ <value>byte</value>
</param>
<param>
- <key>title</key>
- <value>"Constellation: "+str(const.arity()) + "-PSK"</value>
+ <key>min</key>
+ <value>0</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>max</key>
+ <value>const[const_type].arity()</value>
</param>
<param>
- <key>v_scale</key>
- <value>0</value>
+ <key>num_samps</key>
+ <value>10000000</value>
</param>
<param>
- <key>v_offset</key>
- <value>0</value>
+ <key>repeat</key>
+ <value>True</value>
</param>
<param>
- <key>t_scale</key>
+ <key>_coordinate</key>
+ <value>(17, 125)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
<value>0</value>
</param>
+ </block>
+ <block>
+ <key>gr_noise_source_x</key>
<param>
- <key>ac_couple</key>
- <value>False</value>
+ <key>id</key>
+ <value>gr_noise_source_x</value>
</param>
<param>
- <key>xy_mode</key>
+ <key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>num_inputs</key>
- <value>1</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>win_size</key>
- <value></value>
+ <key>noise_type</key>
+ <value>gr.GR_GAUSSIAN</value>
</param>
<param>
- <key>grid_pos</key>
- <value>2, 0, 1, 1</value>
+ <key>amp</key>
+ <value>1.0 / math.sqrt(2.0 * const[const_type].bits_per_symbol() * 10**(EbN0/10))</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>seed</key>
+ <value>42</value>
</param>
<param>
- <key>trig_mode</key>
- <value>gr.gr_TRIG_MODE_AUTO</value>
+ <key>_coordinate</key>
+ <value>(16, 224)</value>
</param>
<param>
- <key>y_axis_label</key>
- <value>Counts</value>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_chunks_to_symbols_xx</key>
+ <param>
+ <key>id</key>
+ <value>gr_chunks_to_symbols_xx</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>in_type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>out_type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>symbol_table</key>
+ <value>const[const_type].points()</value>
+ </param>
+ <param>
+ <key>dimension</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>num_ports</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(623, 228)</value>
+ <value>(240, 140)</value>
</param>
<param>
<key>_rotation</key>
@@ -396,7 +443,7 @@
</param>
<param>
<key>bits_per_symbol</key>
- <value>const.bits_per_symbol()</value>
+ <value>const[const_type].bits_per_symbol()</value>
</param>
<param>
<key>_coordinate</key>
@@ -408,10 +455,33 @@
</param>
</block>
<block>
- <key>gr_noise_source_x</key>
+ <key>digital_constellation_decoder_cb</key>
<param>
<key>id</key>
- <value>gr_noise_source_x</value>
+ <value>digital_constellation_decoder_cb_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>constellation</key>
+ <value>const[const_type].base()</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(618, 164)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_scopesink2</key>
+ <param>
+ <key>id</key>
+ <value>wxgui_scopesink2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -422,59 +492,60 @@
<value>complex</value>
</param>
<param>
- <key>noise_type</key>
- <value>gr.GR_GAUSSIAN</value>
+ <key>title</key>
+ <value>"Constellation: "+str(const[const_type].arity()) + "-PSK"</value>
</param>
<param>
- <key>amp</key>
- <value>1.0 / math.sqrt(2.0 * const.bits_per_symbol() * 10**(EbN0/10))</value>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>seed</key>
- <value>42</value>
+ <key>v_scale</key>
+ <value>0</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(16, 224)</value>
+ <key>v_offset</key>
+ <value>0</value>
</param>
<param>
- <key>_rotation</key>
+ <key>t_scale</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>gr_chunks_to_symbols_xx</key>
<param>
- <key>id</key>
- <value>gr_chunks_to_symbols_xx</value>
+ <key>ac_couple</key>
+ <value>False</value>
</param>
<param>
- <key>_enabled</key>
+ <key>xy_mode</key>
<value>True</value>
</param>
<param>
- <key>in_type</key>
- <value>byte</value>
+ <key>num_inputs</key>
+ <value>1</value>
</param>
<param>
- <key>out_type</key>
- <value>complex</value>
+ <key>win_size</key>
+ <value></value>
</param>
<param>
- <key>symbol_table</key>
- <value>const.points()</value>
+ <key>grid_pos</key>
+ <value>2, 0, 1, 1</value>
</param>
<param>
- <key>dimension</key>
- <value>1</value>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
- <key>num_ports</key>
- <value>1</value>
+ <key>trig_mode</key>
+ <value>gr.gr_TRIG_MODE_AUTO</value>
+ </param>
+ <param>
+ <key>y_axis_label</key>
+ <value>Counts</value>
</param>
<param>
<key>_coordinate</key>
- <value>(240, 140)</value>
+ <value>(623, 228)</value>
</param>
<param>
<key>_rotation</key>
@@ -482,54 +553,45 @@
</param>
</block>
<block>
- <key>variable_slider</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>EbN0</value>
+ <value>samp_rate</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>Eb/N0 (dB)</value>
- </param>
- <param>
<key>value</key>
- <value>10</value>
- </param>
- <param>
- <key>min</key>
- <value>-10</value>
- </param>
- <param>
- <key>max</key>
- <value>200</value>
+ <value>100e3</value>
</param>
<param>
- <key>num_steps</key>
- <value>211</value>
+ <key>_coordinate</key>
+ <value>(16, 308)</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>id</key>
+ <value>const_type</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>value</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(311, 309)</value>
+ <value>(18, 428)</value>
</param>
<param>
<key>_rotation</key>
@@ -537,38 +599,42 @@
</param>
</block>
<block>
- <key>random_source_x</key>
+ <key>variable_static_text</key>
<param>
<key>id</key>
- <value>random_source_x</value>
+ <value>variable_static_text_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>byte</value>
+ <key>label</key>
+ <value>Constellation Type</value>
</param>
<param>
- <key>min</key>
- <value>0</value>
+ <key>value</key>
+ <value>{0: 'BPSK', 1: 'QPSK', 2: '8-PSK'}[const_type] + " - Change const_type for different constellation types!"</value>
</param>
<param>
- <key>max</key>
- <value>const.arity()</value>
+ <key>converver</key>
+ <value>str_converter</value>
</param>
<param>
- <key>num_samps</key>
- <value>10000000</value>
+ <key>formatter</key>
+ <value>None</value>
</param>
<param>
- <key>repeat</key>
- <value>True</value>
+ <key>grid_pos</key>
+ <value></value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(17, 125)</value>
+ <value>(422, 311)</value>
</param>
<param>
<key>_rotation</key>
diff --git a/gr-digital/examples/demod/digital_freq_lock.grc b/gr-digital/examples/demod/digital_freq_lock.grc
index 09d3085dd..589c651f4 100644
--- a/gr-digital/examples/demod/digital_freq_lock.grc
+++ b/gr-digital/examples/demod/digital_freq_lock.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Thu Jul 5 18:11:22 2012</timestamp>
+ <timestamp>Mon Jan 14 10:49:20 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -609,53 +609,6 @@
</param>
</block>
<block>
- <key>digital_psk_mod</key>
- <param>
- <key>id</key>
- <value>digital_psk_mod_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>constellation_points</key>
- <value>2</value>
- </param>
- <param>
- <key>mod_code</key>
- <value>"gray"</value>
- </param>
- <param>
- <key>differential</key>
- <value>False</value>
- </param>
- <param>
- <key>samples_per_symbol</key>
- <value>sps</value>
- </param>
- <param>
- <key>excess_bw</key>
- <value>0.35</value>
- </param>
- <param>
- <key>verbose</key>
- <value>False</value>
- </param>
- <param>
- <key>log</key>
- <value>False</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(194, 104)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
@@ -856,6 +809,53 @@
<value>0</value>
</param>
</block>
+ <block>
+ <key>digital_psk_mod</key>
+ <param>
+ <key>id</key>
+ <value>digital_psk_mod_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>constellation_points</key>
+ <value>2</value>
+ </param>
+ <param>
+ <key>mod_code</key>
+ <value>"gray"</value>
+ </param>
+ <param>
+ <key>differential</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>samples_per_symbol</key>
+ <value>sps</value>
+ </param>
+ <param>
+ <key>excess_bw</key>
+ <value>rolloff</value>
+ </param>
+ <param>
+ <key>verbose</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>log</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(194, 104)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
<connection>
<source_block_id>gr_channel_model_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc
index dbd4befa6..7bc071d11 100644
--- a/gr-digital/examples/demod/pam_sync.grc
+++ b/gr-digital/examples/demod/pam_sync.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Thu Jul 5 17:54:54 2012</timestamp>
+ <timestamp>Mon Jan 14 10:47:40 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -84,98 +84,6 @@
</param>
</block>
<block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>rrctaps</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), rolloff, int(11*spb*nfilts))</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(686, -1)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>rolloff</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>0.35</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(607, -1)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>spb</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>4.0</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(542, -1)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>sig_amp</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>1.0</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(861, 0)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>virtual_sink</key>
<param>
<key>id</key>
@@ -296,29 +204,6 @@
<key>variable</key>
<param>
<key>id</key>
- <value>nfilts</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>32</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(598, 186)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable</key>
- <param>
- <key>id</key>
<value>samp_rate</value>
</param>
<param>
@@ -378,76 +263,6 @@
</param>
</block>
<block>
- <key>gr_chunks_to_symbols_xx</key>
- <param>
- <key>id</key>
- <value>gr_chunks_to_symbols_xx</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>in_type</key>
- <value>byte</value>
- </param>
- <param>
- <key>out_type</key>
- <value>complex</value>
- </param>
- <param>
- <key>symbol_table</key>
- <value>const.points()</value>
- </param>
- <param>
- <key>dimension</key>
- <value>1</value>
- </param>
- <param>
- <key>num_ports</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(196, 87)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>blks2_pfb_arb_resampler_ccf</key>
- <param>
- <key>id</key>
- <value>blks2_pfb_arb_resampler_ccf_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>rate</key>
- <value>spb</value>
- </param>
- <param>
- <key>taps</key>
- <value>firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32)</value>
- </param>
- <param>
- <key>size</key>
- <value>32</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(435, 80)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>gr_channel_model</key>
<param>
<key>id</key>
@@ -487,37 +302,6 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
- <param>
- <key>id</key>
- <value>gr_multiply_const_vxx_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>complex</value>
- </param>
- <param>
- <key>const</key>
- <value>sig_amp</value>
- </param>
- <param>
- <key>vlen</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(659, 95)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>gr_throttle</key>
<param>
<key>id</key>
@@ -572,33 +356,6 @@
</param>
</block>
<block>
- <key>digital_costas_loop_cc</key>
- <param>
- <key>id</key>
- <value>digital_costas_loop_cc_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>w</key>
- <value>phase_bw</value>
- </param>
- <param>
- <key>order</key>
- <value>4</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(866, 246)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
@@ -1241,10 +998,226 @@
</param>
</block>
<block>
+ <key>gr_multiply_const_vxx</key>
+ <param>
+ <key>id</key>
+ <value>gr_multiply_const_vxx_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>const</key>
+ <value>sig_amp</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(659, 95)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_chunks_to_symbols_xx</key>
+ <param>
+ <key>id</key>
+ <value>gr_chunks_to_symbols_xx</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>in_type</key>
+ <value>byte</value>
+ </param>
+ <param>
+ <key>out_type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>symbol_table</key>
+ <value>const.points()</value>
+ </param>
+ <param>
+ <key>dimension</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>num_ports</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(178, 87)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>spb</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>4.0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(513, -1)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>rolloff</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0.35</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(578, -1)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>rrctaps</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(nfilts*spb), rolloff, int(11*spb*nfilts))</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(660, 0)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>sig_amp</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(887, -1)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>nfilts</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(816, 0)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blks2_pfb_arb_resampler_ccf</key>
+ <param>
+ <key>id</key>
+ <value>blks2_pfb_arb_resampler_ccf_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>rate</key>
+ <value>spb</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>firdes.root_raised_cosine(nfilts, 1.0, 1.0/nfilts, rolloff, int(11*spb*nfilts))</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>nfilts</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(411, 80)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
<key>variable_slider</key>
<param>
<key>id</key>
- <value>noise_amp</value>
+ <value>freq_offset</value>
</param>
<param>
<key>_enabled</key>
@@ -1252,7 +1225,7 @@
</param>
<param>
<key>label</key>
- <value>Channel Noise</value>
+ <value>Frequency Offset</value>
</param>
<param>
<key>value</key>
@@ -1260,11 +1233,11 @@
</param>
<param>
<key>min</key>
- <value>0</value>
+ <value>-0.5</value>
</param>
<param>
<key>max</key>
- <value>1.0</value>
+ <value>0.5</value>
</param>
<param>
<key>num_steps</key>
@@ -1280,7 +1253,7 @@
</param>
<param>
<key>grid_pos</key>
- <value>(1,2,1,1)</value>
+ <value>(2,2,1,1)</value>
</param>
<param>
<key>notebook</key>
@@ -1288,7 +1261,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(125, 284)</value>
+ <value>(-1, 285)</value>
</param>
<param>
<key>_rotation</key>
@@ -1299,7 +1272,7 @@
<key>variable_slider</key>
<param>
<key>id</key>
- <value>freq_offset</value>
+ <value>noise_amp</value>
</param>
<param>
<key>_enabled</key>
@@ -1307,7 +1280,7 @@
</param>
<param>
<key>label</key>
- <value>Frequency Offset</value>
+ <value>Channel Noise</value>
</param>
<param>
<key>value</key>
@@ -1315,11 +1288,11 @@
</param>
<param>
<key>min</key>
- <value>-0.5</value>
+ <value>0</value>
</param>
<param>
<key>max</key>
- <value>0.5</value>
+ <value>1.0</value>
</param>
<param>
<key>num_steps</key>
@@ -1335,7 +1308,7 @@
</param>
<param>
<key>grid_pos</key>
- <value>(2,2,1,1)</value>
+ <value>(1,2,1,1)</value>
</param>
<param>
<key>notebook</key>
@@ -1343,7 +1316,34 @@
</param>
<param>
<key>_coordinate</key>
- <value>(6, 284)</value>
+ <value>(129, 285)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>digital_costas_loop_cc</key>
+ <param>
+ <key>id</key>
+ <value>digital_costas_loop_cc_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>w</key>
+ <value>phase_bw</value>
+ </param>
+ <param>
+ <key>order</key>
+ <value>const.arity()</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(866, 246)</value>
</param>
<param>
<key>_rotation</key>
@@ -1381,12 +1381,6 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_chunks_to_symbols_xx</source_block_id>
- <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
<source_block_id>gr_channel_model_0</source_block_id>
<sink_block_id>digital_fll_band_edge_cc_0</sink_block_id>
<source_key>0</source_key>
@@ -1428,4 +1422,10 @@
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
+ <connection>
+ <source_block_id>gr_chunks_to_symbols_xx</source_block_id>
+ <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
</flow_graph>
diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc
index c253d9a9f..af14191eb 100644
--- a/gr-digital/examples/demod/pam_timing.grc
+++ b/gr-digital/examples/demod/pam_timing.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Thu Jul 5 17:55:51 2012</timestamp>
+ <timestamp>Mon Jan 14 11:00:42 2013</timestamp>
<block>
<key>options</key>
<param>
@@ -53,7 +53,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(10, 10)</value>
+ <value>(-1, 0)</value>
</param>
<param>
<key>_rotation</key>
@@ -61,71 +61,65 @@
</param>
</block>
<block>
- <key>gr_uchar_to_float</key>
+ <key>variable_slider</key>
<param>
<key>id</key>
- <value>gr_uchar_to_float_0</value>
+ <value>beta</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(217, 108)</value>
+ <key>label</key>
+ <value>Timing Beta</value>
</param>
<param>
- <key>_rotation</key>
+ <key>value</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>gr_uchar_to_float</key>
<param>
- <key>id</key>
- <value>gr_uchar_to_float_0_0</value>
+ <key>min</key>
+ <value>0.0</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>max</key>
+ <value>0.1</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(216, 273)</value>
+ <key>num_steps</key>
+ <value>1000</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
</param>
- </block>
- <block>
- <key>variable</key>
<param>
- <key>id</key>
- <value>samp_rate</value>
+ <key>converver</key>
+ <value>float_converter</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>grid_pos</key>
+ <value></value>
</param>
<param>
- <key>value</key>
- <value>32000</value>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(128, 9)</value>
+ <value>(668, 5)</value>
</param>
<param>
<key>_rotation</key>
- <value>0</value>
+ <value>180</value>
</param>
</block>
<block>
<key>variable_slider</key>
<param>
<key>id</key>
- <value>freq_offset</value>
+ <value>alpha</value>
</param>
<param>
<key>_enabled</key>
@@ -133,7 +127,7 @@
</param>
<param>
<key>label</key>
- <value>Frequency Offset</value>
+ <value>Timing Alpha</value>
</param>
<param>
<key>value</key>
@@ -141,11 +135,11 @@
</param>
<param>
<key>min</key>
- <value>-0.5</value>
+ <value>0</value>
</param>
<param>
<key>max</key>
- <value>0.5</value>
+ <value>1</value>
</param>
<param>
<key>num_steps</key>
@@ -169,7 +163,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(293, 684)</value>
+ <value>(552, 4)</value>
</param>
<param>
<key>_rotation</key>
@@ -180,7 +174,7 @@
<key>random_source_x</key>
<param>
<key>id</key>
- <value>random_source_x_0</value>
+ <value>random_source_x</value>
</param>
<param>
<key>_enabled</key>
@@ -196,11 +190,11 @@
</param>
<param>
<key>max</key>
- <value>pam_amp</value>
+ <value>const.arity()</value>
</param>
<param>
<key>num_samps</key>
- <value>10000</value>
+ <value>10000000</value>
</param>
<param>
<key>repeat</key>
@@ -208,7 +202,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(13, 80)</value>
+ <value>(-1, 163)</value>
</param>
<param>
<key>_rotation</key>
@@ -216,38 +210,38 @@
</param>
</block>
<block>
- <key>random_source_x</key>
+ <key>gr_chunks_to_symbols_xx</key>
<param>
<key>id</key>
- <value>random_source_x_0_0</value>
+ <value>gr_chunks_to_symbols_xx</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
+ <key>in_type</key>
<value>byte</value>
</param>
<param>
- <key>min</key>
- <value>0</value>
+ <key>out_type</key>
+ <value>complex</value>
</param>
<param>
- <key>max</key>
- <value>pam_amp</value>
+ <key>symbol_table</key>
+ <value>const.points()</value>
</param>
<param>
- <key>num_samps</key>
- <value>10000</value>
+ <key>dimension</key>
+ <value>1</value>
</param>
<param>
- <key>repeat</key>
- <value>True</value>
+ <key>num_ports</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(15, 245)</value>
+ <value>(203, 178)</value>
</param>
<param>
<key>_rotation</key>
@@ -255,10 +249,10 @@
</param>
</block>
<block>
- <key>const_source_x</key>
+ <key>gr_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>const_source_x_0</value>
+ <value>gr_multiply_const_vxx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -266,42 +260,19 @@
</param>
<param>
<key>type</key>
- <value>float</value>
+ <value>complex</value>
</param>
<param>
<key>const</key>
- <value>-0.5*(pam_amp-1)</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(213, 197)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>const_source_x</key>
- <param>
- <key>id</key>
- <value>const_source_x_0_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>float</value>
+ <value>sig_amp</value>
</param>
<param>
- <key>const</key>
- <value>-0.5*(pam_amp-1)</value>
+ <key>vlen</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(200, 360)</value>
+ <value>(651, 186)</value>
</param>
<param>
<key>_rotation</key>
@@ -309,65 +280,38 @@
</param>
</block>
<block>
- <key>notebook</key>
+ <key>gr_channel_model</key>
<param>
<key>id</key>
- <value>notebook_0</value>
+ <value>gr_channel_model_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>style</key>
- <value>wx.NB_TOP</value>
- </param>
- <param>
- <key>labels</key>
- <value>['error', 'phase', 'freq', 'Resampled Signal']</value>
- </param>
- <param>
- <key>grid_pos</key>
- <value></value>
- </param>
- <param>
- <key>notebook</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(729, 769)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>gr_add_xx</key>
- <param>
- <key>id</key>
- <value>gr_add_xx_0</value>
+ <key>noise_voltage</key>
+ <value>noise_amp</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>freq_offset</key>
+ <value>freq_offset</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>epsilon</key>
+ <value>interpratio</value>
</param>
<param>
- <key>num_inputs</key>
- <value>2</value>
+ <key>taps</key>
+ <value>1.0</value>
</param>
<param>
- <key>vlen</key>
- <value>1</value>
+ <key>seed</key>
+ <value>42</value>
</param>
<param>
<key>_coordinate</key>
- <value>(440, 167)</value>
+ <value>(73, 354)</value>
</param>
<param>
<key>_rotation</key>
@@ -375,10 +319,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>gr_throttle</key>
<param>
<key>id</key>
- <value>gr_add_xx_0_1</value>
+ <value>gr_throttle_0</value>
</param>
<param>
<key>_enabled</key>
@@ -386,11 +330,11 @@
</param>
<param>
<key>type</key>
- <value>float</value>
+ <value>complex</value>
</param>
<param>
- <key>num_inputs</key>
- <value>2</value>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
</param>
<param>
<key>vlen</key>
@@ -398,7 +342,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(430, 330)</value>
+ <value>(274, 384)</value>
</param>
<param>
<key>_rotation</key>
@@ -409,7 +353,7 @@
<key>variable</key>
<param>
<key>id</key>
- <value>nfilts</value>
+ <value>sig_amp</value>
</param>
<param>
<key>_enabled</key>
@@ -417,11 +361,11 @@
</param>
<param>
<key>value</key>
- <value>32</value>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(435, 686)</value>
+ <value>(662, 128)</value>
</param>
<param>
<key>_rotation</key>
@@ -432,7 +376,7 @@
<key>variable_slider</key>
<param>
<key>id</key>
- <value>noise_amp</value>
+ <value>interpratio</value>
</param>
<param>
<key>_enabled</key>
@@ -440,19 +384,19 @@
</param>
<param>
<key>label</key>
- <value>Channel Noise</value>
+ <value>Timing Offset</value>
</param>
<param>
<key>value</key>
- <value>0</value>
+ <value>1.00</value>
</param>
<param>
<key>min</key>
- <value>0</value>
+ <value>0.99</value>
</param>
<param>
<key>max</key>
- <value>1.0</value>
+ <value>1.01</value>
</param>
<param>
<key>num_steps</key>
@@ -476,18 +420,18 @@
</param>
<param>
<key>_coordinate</key>
- <value>(168, 684)</value>
+ <value>(-1, 465)</value>
</param>
<param>
<key>_rotation</key>
- <value>0</value>
+ <value>180</value>
</param>
</block>
<block>
<key>variable_slider</key>
<param>
<key>id</key>
- <value>interpratio</value>
+ <value>noise_amp</value>
</param>
<param>
<key>_enabled</key>
@@ -495,19 +439,19 @@
</param>
<param>
<key>label</key>
- <value>Timing Offset</value>
+ <value>Channel Noise</value>
</param>
<param>
<key>value</key>
- <value>1.00</value>
+ <value>0</value>
</param>
<param>
<key>min</key>
- <value>0.99</value>
+ <value>0</value>
</param>
<param>
<key>max</key>
- <value>1.01</value>
+ <value>1.0</value>
</param>
<param>
<key>num_steps</key>
@@ -531,18 +475,18 @@
</param>
<param>
<key>_coordinate</key>
- <value>(40, 684)</value>
+ <value>(114, 465)</value>
</param>
<param>
<key>_rotation</key>
- <value>180</value>
+ <value>0</value>
</param>
</block>
<block>
<key>variable_slider</key>
<param>
<key>id</key>
- <value>beta</value>
+ <value>freq_offset</value>
</param>
<param>
<key>_enabled</key>
@@ -550,7 +494,7 @@
</param>
<param>
<key>label</key>
- <value>Timing Beta</value>
+ <value>Frequency Offset</value>
</param>
<param>
<key>value</key>
@@ -558,11 +502,11 @@
</param>
<param>
<key>min</key>
- <value>0.0</value>
+ <value>-0.5</value>
</param>
<param>
<key>max</key>
- <value>0.1</value>
+ <value>0.5</value>
</param>
<param>
<key>num_steps</key>
@@ -586,62 +530,53 @@
</param>
<param>
<key>_coordinate</key>
- <value>(668, 5)</value>
+ <value>(236, 465)</value>
</param>
<param>
<key>_rotation</key>
- <value>180</value>
+ <value>0</value>
</param>
</block>
<block>
- <key>variable_slider</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>alpha</value>
+ <value>samp_rate</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>Timing Alpha</value>
- </param>
- <param>
<key>value</key>
- <value>0</value>
- </param>
- <param>
- <key>min</key>
- <value>0</value>
- </param>
- <param>
- <key>max</key>
- <value>1</value>
+ <value>32000</value>
</param>
<param>
- <key>num_steps</key>
- <value>1000</value>
+ <key>_coordinate</key>
+ <value>(282, 324)</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>id</key>
+ <value>const</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>value</key>
+ <value>digital.qpsk_constellation()</value>
</param>
<param>
<key>_coordinate</key>
- <value>(552, 4)</value>
+ <value>(206, 116)</value>
</param>
<param>
<key>_rotation</key>
@@ -649,22 +584,22 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>import</key>
<param>
<key>id</key>
- <value>pam_amp</value>
+ <value>import_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>2</value>
+ <key>import</key>
+ <value>from gnuradio import digital</value>
</param>
<param>
<key>_coordinate</key>
- <value>(223, 9)</value>
+ <value>(-1, 61)</value>
</param>
<param>
<key>_rotation</key>
@@ -675,7 +610,7 @@
<key>variable</key>
<param>
<key>id</key>
- <value>sig_amp</value>
+ <value>rolloff</value>
</param>
<param>
<key>_enabled</key>
@@ -683,11 +618,11 @@
</param>
<param>
<key>value</key>
- <value>1</value>
+ <value>.35</value>
</param>
<param>
<key>_coordinate</key>
- <value>(315, 9)</value>
+ <value>(459, 262)</value>
</param>
<param>
<key>_rotation</key>
@@ -695,74 +630,77 @@
</param>
</block>
<block>
- <key>wxgui_scopesink2</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0</value>
+ <value>nfilts</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
+ <key>value</key>
+ <value>32</value>
</param>
<param>
- <key>title</key>
- <value>Scope Plot</value>
+ <key>_coordinate</key>
+ <value>(539, 262)</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
+ </block>
+ <block>
+ <key>gr_pfb_clock_sync_xxx</key>
<param>
- <key>v_scale</key>
- <value>0</value>
+ <key>id</key>
+ <value>gr_pfb_clock_sync_xxx_0</value>
</param>
<param>
- <key>v_offset</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>t_scale</key>
- <value>0</value>
+ <key>type</key>
+ <value>ccf</value>
</param>
<param>
- <key>ac_couple</key>
- <value>False</value>
+ <key>sps</key>
+ <value>spb</value>
</param>
<param>
- <key>xy_mode</key>
- <value>False</value>
+ <key>alpha</key>
+ <value>alpha</value>
</param>
<param>
- <key>num_inputs</key>
- <value>1</value>
+ <key>beta</key>
+ <value>beta</value>
</param>
<param>
- <key>win_size</key>
- <value></value>
+ <key>taps</key>
+ <value>firdes.root_raised_cosine(nfilts, nfilts*spb, 1.0, rolloff, 44*nfilts)</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>filter_size</key>
+ <value>nfilts</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>init_phase</key>
+ <value>16</value>
</param>
<param>
- <key>trig_mode</key>
- <value>gr.gr_TRIG_MODE_AUTO</value>
+ <key>max_dev</key>
+ <value>1.5</value>
</param>
<param>
- <key>y_axis_label</key>
- <value>Counts</value>
+ <key>osps</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(1116, 500)</value>
+ <value>(444, 331)</value>
</param>
<param>
<key>_rotation</key>
@@ -770,30 +708,30 @@
</param>
</block>
<block>
- <key>gr_throttle</key>
+ <key>blks2_pfb_arb_resampler_ccf</key>
<param>
<key>id</key>
- <value>gr_throttle_0</value>
+ <value>blks2_pfb_arb_resampler_ccf_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
+ <key>rate</key>
+ <value>spb</value>
</param>
<param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
+ <key>taps</key>
+ <value>firdes.root_raised_cosine(nfilts, nfilts, 1.0, rolloff, 44*nfilts)</value>
</param>
<param>
- <key>vlen</key>
- <value>1</value>
+ <key>size</key>
+ <value>nfilts</value>
</param>
<param>
<key>_coordinate</key>
- <value>(290, 575)</value>
+ <value>(438, 171)</value>
</param>
<param>
<key>_rotation</key>
@@ -804,7 +742,7 @@
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0_0_0</value>
+ <value>wxgui_scopesink2_0_0_1</value>
</param>
<param>
<key>_enabled</key>
@@ -812,11 +750,11 @@
</param>
<param>
<key>type</key>
- <value>float</value>
+ <value>complex</value>
</param>
<param>
<key>title</key>
- <value>Scope Plot</value>
+ <value>Error</value>
</param>
<param>
<key>samp_rate</key>
@@ -824,7 +762,7 @@
</param>
<param>
<key>v_scale</key>
- <value>9</value>
+ <value>.5</value>
</param>
<param>
<key>v_offset</key>
@@ -856,7 +794,7 @@
</param>
<param>
<key>notebook</key>
- <value>notebook_0,1</value>
+ <value>notebook_0,3</value>
</param>
<param>
<key>trig_mode</key>
@@ -868,30 +806,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(1112, 881)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>rrctaps</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), .35, int(11*spb*nfilts))</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(513, 679)</value>
+ <value>(826, 112)</value>
</param>
<param>
<key>_rotation</key>
@@ -902,7 +817,7 @@
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0_0_1</value>
+ <value>wxgui_scopesink2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -914,7 +829,7 @@
</param>
<param>
<key>title</key>
- <value>Error</value>
+ <value>Scope Plot</value>
</param>
<param>
<key>samp_rate</key>
@@ -922,7 +837,7 @@
</param>
<param>
<key>v_scale</key>
- <value>.5</value>
+ <value>0</value>
</param>
<param>
<key>v_offset</key>
@@ -954,7 +869,7 @@
</param>
<param>
<key>notebook</key>
- <value>notebook_0,3</value>
+ <value></value>
</param>
<param>
<key>trig_mode</key>
@@ -966,7 +881,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(1115, 358)</value>
+ <value>(829, 266)</value>
</param>
<param>
<key>_rotation</key>
@@ -974,92 +889,74 @@
</param>
</block>
<block>
- <key>gr_float_to_complex</key>
+ <key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>gr_float_to_complex_0</value>
+ <value>wxgui_scopesink2_0_0_0_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>vlen</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(590, 184)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>blks2_pfb_arb_resampler_ccf</key>
- <param>
- <key>id</key>
- <value>blks2_pfb_arb_resampler_ccf_0</value>
+ <key>type</key>
+ <value>float</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>title</key>
+ <value>Scope Plot</value>
</param>
<param>
- <key>rate</key>
- <value>spb</value>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>taps</key>
- <value>firdes.root_raised_cosine(32, 32, 1.0, 0.35, 44*32)</value>
+ <key>v_scale</key>
+ <value>1.25</value>
</param>
<param>
- <key>size</key>
- <value>32</value>
+ <key>v_offset</key>
+ <value>0</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(816, 181)</value>
+ <key>t_scale</key>
+ <value>0</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>ac_couple</key>
+ <value>False</value>
</param>
- </block>
- <block>
- <key>gr_channel_model</key>
<param>
- <key>id</key>
- <value>gr_channel_model_0</value>
+ <key>xy_mode</key>
+ <value>False</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>num_inputs</key>
+ <value>1</value>
</param>
<param>
- <key>noise_voltage</key>
- <value>noise_amp</value>
+ <key>win_size</key>
+ <value></value>
</param>
<param>
- <key>freq_offset</key>
- <value>freq_offset</value>
+ <key>grid_pos</key>
+ <value></value>
</param>
<param>
- <key>epsilon</key>
- <value>interpratio</value>
+ <key>notebook</key>
+ <value>notebook_0,2</value>
</param>
<param>
- <key>taps</key>
- <value>1.0</value>
+ <key>trig_mode</key>
+ <value>gr.gr_TRIG_MODE_AUTO</value>
</param>
<param>
- <key>seed</key>
- <value>42</value>
+ <key>y_axis_label</key>
+ <value>Counts</value>
</param>
<param>
<key>_coordinate</key>
- <value>(59, 543)</value>
+ <value>(824, 485)</value>
</param>
<param>
<key>_rotation</key>
@@ -1067,10 +964,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_0</value>
+ <value>wxgui_scopesink2_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1078,97 +975,63 @@
</param>
<param>
<key>type</key>
- <value>complex</value>
+ <value>float</value>
</param>
<param>
- <key>const</key>
- <value>sig_amp</value>
+ <key>title</key>
+ <value>Error</value>
</param>
<param>
- <key>vlen</key>
- <value>1</value>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(714, 382)</value>
+ <key>v_scale</key>
+ <value>3</value>
</param>
<param>
- <key>_rotation</key>
+ <key>v_offset</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>spb</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>value</key>
- <value>4.2563</value>
- </param>
<param>
- <key>_coordinate</key>
- <value>(42, 840)</value>
- </param>
- <param>
- <key>_rotation</key>
+ <key>t_scale</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>gr_pfb_clock_sync_xxx</key>
- <param>
- <key>id</key>
- <value>gr_pfb_clock_sync_xxx_0</value>
- </param>
<param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>ccf</value>
- </param>
- <param>
- <key>sps</key>
- <value>spb</value>
+ <key>ac_couple</key>
+ <value>False</value>
</param>
<param>
- <key>alpha</key>
- <value>alpha</value>
+ <key>xy_mode</key>
+ <value>False</value>
</param>
<param>
- <key>beta</key>
- <value>beta</value>
+ <key>num_inputs</key>
+ <value>1</value>
</param>
<param>
- <key>taps</key>
- <value>rrctaps</value>
+ <key>win_size</key>
+ <value></value>
</param>
<param>
- <key>filter_size</key>
- <value>nfilts</value>
+ <key>grid_pos</key>
+ <value></value>
</param>
<param>
- <key>init_phase</key>
- <value>16</value>
+ <key>notebook</key>
+ <value>notebook_0,0</value>
</param>
<param>
- <key>max_dev</key>
- <value>1.5</value>
+ <key>trig_mode</key>
+ <value>gr.gr_TRIG_MODE_AUTO</value>
</param>
<param>
- <key>osps</key>
- <value>1</value>
+ <key>y_axis_label</key>
+ <value>Counts</value>
</param>
<param>
<key>_coordinate</key>
- <value>(512, 527)</value>
+ <value>(829, 358)</value>
</param>
<param>
<key>_rotation</key>
@@ -1179,7 +1042,7 @@
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0_0</value>
+ <value>wxgui_scopesink2_0_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1191,7 +1054,7 @@
</param>
<param>
<key>title</key>
- <value>Error</value>
+ <value>Scope Plot</value>
</param>
<param>
<key>samp_rate</key>
@@ -1199,7 +1062,7 @@
</param>
<param>
<key>v_scale</key>
- <value>3</value>
+ <value>9</value>
</param>
<param>
<key>v_offset</key>
@@ -1231,7 +1094,7 @@
</param>
<param>
<key>notebook</key>
- <value>notebook_0,0</value>
+ <value>notebook_0,1</value>
</param>
<param>
<key>trig_mode</key>
@@ -1243,7 +1106,7 @@
</param>
<param>
<key>_coordinate</key>
- <value>(1114, 615)</value>
+ <value>(754, 607)</value>
</param>
<param>
<key>_rotation</key>
@@ -1251,74 +1114,57 @@
</param>
</block>
<block>
- <key>wxgui_scopesink2</key>
+ <key>notebook</key>
<param>
<key>id</key>
- <value>wxgui_scopesink2_0_0_0_0</value>
+ <value>notebook_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>float</value>
+ <key>style</key>
+ <value>wx.NB_TOP</value>
</param>
<param>
- <key>title</key>
- <value>Scope Plot</value>
+ <key>labels</key>
+ <value>['error', 'phase', 'freq', 'Resampled Signal']</value>
</param>
<param>
- <key>samp_rate</key>
- <value>samp_rate</value>
+ <key>grid_pos</key>
+ <value></value>
</param>
<param>
- <key>v_scale</key>
- <value>1.25</value>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
- <key>v_offset</key>
- <value>0</value>
+ <key>_coordinate</key>
+ <value>(380, 511)</value>
</param>
<param>
- <key>t_scale</key>
+ <key>_rotation</key>
<value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>ac_couple</key>
- <value>False</value>
- </param>
- <param>
- <key>xy_mode</key>
- <value>False</value>
- </param>
- <param>
- <key>num_inputs</key>
- <value>1</value>
- </param>
- <param>
- <key>win_size</key>
- <value></value>
- </param>
- <param>
- <key>grid_pos</key>
- <value></value>
- </param>
- <param>
- <key>notebook</key>
- <value>notebook_0,2</value>
+ <key>id</key>
+ <value>spb</value>
</param>
<param>
- <key>trig_mode</key>
- <value>gr.gr_TRIG_MODE_AUTO</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>y_axis_label</key>
- <value>Counts</value>
+ <key>value</key>
+ <value>4.2563</value>
</param>
<param>
<key>_coordinate</key>
- <value>(1080, 751)</value>
+ <value>(300, 0)</value>
</param>
<param>
<key>_rotation</key>
@@ -1326,110 +1172,68 @@
</param>
</block>
<connection>
- <source_block_id>random_source_x_0</source_block_id>
- <sink_block_id>gr_uchar_to_float_0</sink_block_id>
+ <source_block_id>gr_channel_model_0</source_block_id>
+ <sink_block_id>gr_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_uchar_to_float_0</source_block_id>
- <sink_block_id>gr_add_xx_0</sink_block_id>
+ <source_block_id>gr_throttle_0</source_block_id>
+ <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>const_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx_0</sink_block_id>
- <source_key>0</source_key>
- <sink_key>1</sink_key>
- </connection>
- <connection>
- <source_block_id>gr_uchar_to_float_0_0</source_block_id>
- <sink_block_id>gr_add_xx_0_1</sink_block_id>
- <source_key>0</source_key>
+ <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
+ <sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id>
+ <source_key>2</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>const_source_x_0_0</source_block_id>
- <sink_block_id>gr_add_xx_0_1</sink_block_id>
- <source_key>0</source_key>
- <sink_key>1</sink_key>
- </connection>
- <connection>
- <source_block_id>random_source_x_0_0</source_block_id>
- <sink_block_id>gr_uchar_to_float_0_0</sink_block_id>
+ <source_block_id>gr_multiply_const_vxx_0</source_block_id>
+ <sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_channel_model_0</source_block_id>
- <sink_block_id>gr_throttle_0</sink_block_id>
+ <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id>
+ <sink_block_id>gr_multiply_const_vxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_0</source_block_id>
- <sink_block_id>gr_float_to_complex_0</sink_block_id>
+ <source_block_id>gr_multiply_const_vxx_0</source_block_id>
+ <sink_block_id>gr_channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_0_1</source_block_id>
- <sink_block_id>gr_float_to_complex_0</sink_block_id>
- <source_key>0</source_key>
- <sink_key>1</sink_key>
- </connection>
- <connection>
- <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
- <sink_block_id>wxgui_scopesink2_0</sink_block_id>
+ <source_block_id>gr_chunks_to_symbols_xx</source_block_id>
+ <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_throttle_0</source_block_id>
- <sink_block_id>gr_pfb_clock_sync_xxx_0</sink_block_id>
+ <source_block_id>random_source_x</source_block_id>
+ <sink_block_id>gr_chunks_to_symbols_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
- <sink_block_id>wxgui_scopesink2_0_0</sink_block_id>
- <source_key>1</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0_0_0</sink_block_id>
<source_key>3</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
- <sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id>
- <source_key>2</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
- <sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>gr_float_to_complex_0</source_block_id>
- <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id>
- <source_key>0</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_0</sink_block_id>
- <source_key>0</source_key>
+ <sink_block_id>wxgui_scopesink2_0_0</sink_block_id>
+ <source_key>1</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
- <sink_block_id>gr_channel_model_0</sink_block_id>
+ <source_block_id>gr_pfb_clock_sync_xxx_0</source_block_id>
+ <sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/grc/digital_block_tree.xml b/gr-digital/grc/digital_block_tree.xml
index 9efa0d3fb..36827028e 100644
--- a/gr-digital/grc/digital_block_tree.xml
+++ b/gr-digital/grc/digital_block_tree.xml
@@ -59,6 +59,7 @@
<block>digital_framer_sink_1</block>
<block>digital_packet_sink</block>
<block>digital_simple_framer</block>
+ <block>digital_simple_correlator</block>
</cat>
<cat>
<name>Digital Modulators</name>
diff --git a/gr-digital/grc/digital_simple_correlator.xml b/gr-digital/grc/digital_simple_correlator.xml
new file mode 100644
index 000000000..3b70e59b1
--- /dev/null
+++ b/gr-digital/grc/digital_simple_correlator.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Simple Correlator
+###################################################
+ -->
+<block>
+ <name>Simple Correlator</name>
+ <key>digital_simple_correlator</key>
+ <import>from gnuradio import digital</import>
+ <make>digital.simple_correlator($payload_bytesize)</make>
+ <param>
+ <name>Payload Byte Size</name>
+ <key>payload_bytesize</key>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>float</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>byte</type>
+ </source>
+</block>
diff --git a/gr-digital/include/CMakeLists.txt b/gr-digital/include/CMakeLists.txt
index f863b2875..ad5baec87 100644
--- a/gr-digital/include/CMakeLists.txt
+++ b/gr-digital/include/CMakeLists.txt
@@ -123,6 +123,7 @@ install(FILES
digital_scrambler_bb.h
digital_simple_framer.h
digital_simple_framer_sync.h
+ digital_simple_correlator.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio
COMPONENT "digital_devel"
)
diff --git a/gr-digital/include/digital_simple_correlator.h b/gr-digital/include/digital_simple_correlator.h
new file mode 100644
index 000000000..716c6995c
--- /dev/null
+++ b/gr-digital/include/digital_simple_correlator.h
@@ -0,0 +1,107 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_GR_SIMPLE_CORRELATOR_H
+#define INCLUDED_GR_SIMPLE_CORRELATOR_H
+
+#include <digital_api.h>
+#include <gr_block.h>
+
+class digital_simple_correlator;
+typedef boost::shared_ptr<digital_simple_correlator> digital_simple_correlator_sptr;
+
+DIGITAL_API digital_simple_correlator_sptr digital_make_simple_correlator(int payload_bytesize);
+
+/*!
+ * \brief inverse of simple_framer (more or less)
+ * \ingroup sync_blk
+ */
+class DIGITAL_API digital_simple_correlator : public gr_block
+{
+ private:
+ static const int OVERSAMPLE = 8;
+ enum state_t { ST_LOOKING, ST_UNDER_THRESHOLD, ST_LOCKED };
+
+ int d_payload_bytesize;
+ state_t d_state;
+ unsigned int d_osi; // over sample index [0,OVERSAMPLE-1]
+ unsigned int d_transition_osi; // first index where Hamming dist < thresh
+ unsigned int d_center_osi; // center of bit
+ unsigned long long int d_shift_reg[OVERSAMPLE];
+ int d_bblen; // length of bitbuf
+ unsigned char *d_bitbuf; // demodulated bits
+ unsigned char *d_pktbuf; // temp packet buf
+ int d_bbi; // bitbuf index
+
+ static const int AVG_PERIOD = 512; // must be power of 2 (for freq offset correction)
+ int d_avbi;
+ float d_avgbuf[AVG_PERIOD];
+ float d_avg;
+ float d_accum;
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ FILE *d_debug_fp; // binary log file
+#endif
+
+ friend GR_CORE_API digital_simple_correlator_sptr
+ digital_make_simple_correlator(int payload_bytesize);
+ digital_simple_correlator(int payload_bytesize);
+
+ inline int slice(float x)
+ {
+ return x >= d_avg ? 1 : 0;
+ }
+
+ void update_avg(float x);
+
+ void enter_locked();
+ void enter_under_threshold();
+ void enter_looking();
+
+ static int add_index(int a, int b)
+ {
+ int t = a + b;
+ if(t >= OVERSAMPLE)
+ t -= OVERSAMPLE;
+ assert(t >= 0 && t < OVERSAMPLE);
+ return t;
+ }
+
+ static int sub_index(int a, int b)
+ {
+ int t = a - b;
+ if(t < 0)
+ t += OVERSAMPLE;
+ assert(t >= 0 && t < OVERSAMPLE);
+ return t;
+ }
+
+ public:
+ ~digital_simple_correlator();
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_GR_SIMPLE_CORRELATOR_H */
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt
index 6f83ff036..7ac16602c 100644
--- a/gr-digital/lib/CMakeLists.txt
+++ b/gr-digital/lib/CMakeLists.txt
@@ -136,6 +136,7 @@ list(APPEND gr_digital_sources
digital_probe_mpsk_snr_est_c.cc
digital_scrambler_bb.cc
digital_simple_framer.cc
+ digital_simple_correlator.cc
)
list(APPEND digital_libs
diff --git a/gr-digital/lib/digital_simple_correlator.cc b/gr-digital/lib/digital_simple_correlator.cc
new file mode 100644
index 000000000..37ef2f1e5
--- /dev/null
+++ b/gr-digital/lib/digital_simple_correlator.cc
@@ -0,0 +1,231 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <digital_simple_correlator.h>
+#include <digital_simple_framer_sync.h>
+#include <gr_io_signature.h>
+#include <gr_count_bits.h>
+#include <assert.h>
+#include <stdexcept>
+#include <string.h>
+#include <cstdio>
+
+static const int THRESHOLD = 3;
+
+digital_simple_correlator_sptr
+digital_make_simple_correlator(int payload_bytesize)
+{
+ return gnuradio::get_initial_sptr
+ (new digital_simple_correlator(payload_bytesize));
+}
+
+digital_simple_correlator::digital_simple_correlator(int payload_bytesize)
+ : gr_block("simple_correlator",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(unsigned char))),
+ d_payload_bytesize(payload_bytesize),
+ d_state(ST_LOOKING), d_osi(0),
+ d_bblen((payload_bytesize + GRSF_PAYLOAD_OVERHEAD) * GRSF_BITS_PER_BYTE),
+ d_bitbuf(new unsigned char[d_bblen]),
+ d_pktbuf(new unsigned char[d_bblen/GRSF_BITS_PER_BYTE]),
+ d_bbi(0)
+{
+ d_avbi = 0;
+ d_accum = 0.0;
+ d_avg = 0.0;
+ for(int i = 0; i < AVG_PERIOD; i++)
+ d_avgbuf[i] = 0.0;
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ d_debug_fp = fopen("corr.log", "w");
+#endif
+ enter_looking();
+}
+
+digital_simple_correlator::~digital_simple_correlator()
+{
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ fclose(d_debug_fp);
+#endif
+ delete [] d_bitbuf;
+ delete [] d_pktbuf;
+}
+
+void
+digital_simple_correlator::enter_looking()
+{
+ fflush(stdout);
+ // fprintf(stderr, ">>> enter_looking\n");
+ d_state = ST_LOOKING;
+ for(int i = 0; i < OVERSAMPLE; i++)
+ d_shift_reg[i] = 0;
+ d_osi = 0;
+
+ d_avbi = 0;
+ d_avg = d_avg * 0.5;
+ d_accum = 0;
+ for(int i = 0; i < AVG_PERIOD; i++)
+ d_avgbuf[i] = 0.0;
+}
+
+void
+digital_simple_correlator::enter_under_threshold()
+{
+ fflush(stdout);
+ // fprintf(stderr, ">>> enter_under_threshold\n");
+ d_state = ST_UNDER_THRESHOLD;
+ d_transition_osi = d_osi;
+}
+
+void
+digital_simple_correlator::enter_locked()
+{
+ d_state = ST_LOCKED;
+ int delta = sub_index(d_osi, d_transition_osi);
+ d_center_osi = add_index(d_transition_osi, delta/2);
+ //d_center_osi = add_index(d_center_osi, 3); // FIXME
+ d_bbi = 0;
+ fflush(stdout);
+ // fprintf(stderr, ">>> enter_locked d_center_osi = %d\n", d_center_osi);
+
+ d_avg = std::max(-1.0, std::min(1.0, d_accum * (1.0/AVG_PERIOD)));
+ // fprintf(stderr, ">>> enter_locked d_avg = %g\n", d_avg);
+}
+
+static void
+packit(unsigned char *pktbuf, const unsigned char *bitbuf, int bitcount)
+{
+ for(int i = 0; i < bitcount; i += 8) {
+ int t = bitbuf[i+0] & 0x1;
+ t = (t << 1) | (bitbuf[i+1] & 0x1);
+ t = (t << 1) | (bitbuf[i+2] & 0x1);
+ t = (t << 1) | (bitbuf[i+3] & 0x1);
+ t = (t << 1) | (bitbuf[i+4] & 0x1);
+ t = (t << 1) | (bitbuf[i+5] & 0x1);
+ t = (t << 1) | (bitbuf[i+6] & 0x1);
+ t = (t << 1) | (bitbuf[i+7] & 0x1);
+ *pktbuf++ = t;
+ }
+}
+
+void
+digital_simple_correlator::update_avg(float x)
+{
+ d_accum -= d_avgbuf[d_avbi];
+ d_avgbuf[d_avbi] = x;
+ d_accum += x;
+ d_avbi = (d_avbi + 1) & (AVG_PERIOD-1);
+}
+
+int
+digital_simple_correlator::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float*)input_items[0];
+ unsigned char *out = (unsigned char*)output_items[0];
+
+ int n = 0;
+ int nin = ninput_items[0];
+ int decision;
+ int hamming_dist;
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ struct debug_data {
+ float raw_data;
+ float sampled;
+ float enter_locked;
+ } debug_data;
+#endif
+
+ while(n < nin) {
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ debug_data.raw_data = in[n];
+ debug_data.sampled = 0.0;
+ debug_data.enter_locked = 0.0;
+#endif
+
+ switch(d_state) {
+ case ST_LOCKED:
+ if(d_osi == d_center_osi) {
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ debug_data.sampled = 1.0;
+#endif
+ decision = slice(in[n]);
+
+ d_bitbuf[d_bbi] = decision;
+ d_bbi++;
+ if(d_bbi >= d_bblen) {
+ // printf("got whole packet\n");
+ packit(d_pktbuf, d_bitbuf, d_bbi);
+ //printf("seqno %3d\n", d_pktbuf[0]);
+ memcpy(out, &d_pktbuf[GRSF_PAYLOAD_OVERHEAD], d_payload_bytesize);
+ enter_looking();
+ consume_each(n + 1);
+ return d_payload_bytesize;
+ }
+ }
+ break;
+
+ case ST_LOOKING:
+ case ST_UNDER_THRESHOLD:
+ update_avg(in[n]);
+ decision = slice(in[n]);
+
+ d_shift_reg[d_osi] = (d_shift_reg[d_osi] << 1) | decision;
+ hamming_dist = gr_count_bits64(d_shift_reg[d_osi] ^ GRSF_SYNC);
+ //fprintf(stderr, "%2d %d\n", hamming_dist, d_osi);
+
+ if(d_state == ST_LOOKING && hamming_dist <= THRESHOLD) {
+ // We're seeing a good PN code, remember location
+ enter_under_threshold();
+ }
+ else if(d_state == ST_UNDER_THRESHOLD && hamming_dist > THRESHOLD) {
+ // no longer seeing good PN code, compute center of goodness
+ enter_locked();
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ debug_data.enter_locked = 1.0;
+#endif
+ }
+ break;
+ default:
+ assert(0);
+ }
+
+#ifdef DEBUG_SIMPLE_CORRELATOR
+ fwrite(&debug_data, sizeof(debug_data), 1, d_debug_fp);
+#endif
+
+ d_osi = add_index(d_osi, 1);
+ n++;
+ }
+
+ consume_each(n);
+ return 0;
+}
diff --git a/gr-digital/python/qa_simple_correlator.py b/gr-digital/python/qa_simple_correlator.py
new file mode 100755
index 000000000..124201a55
--- /dev/null
+++ b/gr-digital/python/qa_simple_correlator.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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 3, or (at your option)
+# any later version.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import digital_swig as digital
+
+class test_simple_correlator(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_00(self):
+ expected_result = (
+ 0x00, 0x11, 0x22, 0x33,
+ 0x44, 0x55, 0x66, 0x77,
+ 0x88, 0x99, 0xaa, 0xbb,
+ 0xcc, 0xdd, 0xee, 0xff)
+
+ # Filter taps to expand the data to oversample by 8
+ # Just using a RRC for some basic filter shape
+ taps = gr.firdes.root_raised_cosine(8, 8, 1.0, 0.5, 21)
+
+ src = gr.vector_source_b(expected_result)
+ frame = digital.simple_framer(4)
+ unpack = gr.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
+ expand = gr.interp_fir_filter_fff(8, taps)
+ b2f = gr.char_to_float()
+ mult2 = gr.multiply_const_ff(2)
+ sub1 = gr.add_const_ff(-1)
+ op = digital.simple_correlator(4)
+ dst = gr.vector_sink_b()
+ self.tb.connect(src, frame, unpack, b2f, mult2, sub1, expand)
+ self.tb.connect(expand, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+
+ self.assertEqual(expected_result, result_data)
+
+if __name__ == '__main__':
+ gr_unittest.run(test_simple_correlator, "test_simple_correlator.xml")
diff --git a/gr-digital/swig/CMakeLists.txt b/gr-digital/swig/CMakeLists.txt
index 746bc6111..4107116bc 100644
--- a/gr-digital/swig/CMakeLists.txt
+++ b/gr-digital/swig/CMakeLists.txt
@@ -176,6 +176,7 @@ install(
digital_probe_mpsk_snr_est_c.i
digital_scrambler_bb.i
digital_simple_framer.i
+ digital_simple_correlator.i
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
COMPONENT "digital_swig"
)
diff --git a/gr-digital/swig/digital_simple_correlator.i b/gr-digital/swig/digital_simple_correlator.i
new file mode 100644
index 000000000..5ad5ca26c
--- /dev/null
+++ b/gr-digital/swig/digital_simple_correlator.i
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2013 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+GR_SWIG_BLOCK_MAGIC(digital,simple_correlator);
+
+digital_simple_correlator_sptr digital_make_simple_correlator(int payload_bytesize);
+
+class digital_simple_correlator : public gr_block
+{
+ private:
+ digital_simple_correlator(int payload_bytesize);
+};
diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i
index 191076d75..a5f0251a4 100644
--- a/gr-digital/swig/digital_swig.i
+++ b/gr-digital/swig/digital_swig.i
@@ -81,6 +81,7 @@ enum snr_est_type_t {
#include "digital_probe_mpsk_snr_est_c.h"
#include "digital_scrambler_bb.h"
#include "digital_simple_framer.h"
+#include "digital_simple_correlator.h"
%}
%include "digital_additive_scrambler_bb.i"
@@ -125,3 +126,4 @@ enum snr_est_type_t {
%include "digital_probe_mpsk_snr_est_c.i"
%include "digital_scrambler_bb.i"
%include "digital_simple_framer.i"
+%include "digital_simple_correlator.i"