diff --git a/gr-hamnet70/grc/CMakeLists.txt b/gr-hamnet70/grc/CMakeLists.txt
index aedba5e..f69d088 100644
--- a/gr-hamnet70/grc/CMakeLists.txt
+++ b/gr-hamnet70/grc/CMakeLists.txt
@@ -26,5 +26,6 @@ install(FILES
hamnet70_scrambler.xml
hamnet70_async_scrambler.xml
hamnet70_insert_pilot_symbols.xml
- hamnet70_correct_frequency_from_pilot_syms.xml DESTINATION share/gnuradio/grc/blocks
+ hamnet70_correct_frequency_from_pilot_syms.xml
+ hamnet70_symbol_interleaver.xml DESTINATION share/gnuradio/grc/blocks
)
diff --git a/gr-hamnet70/grc/hamnet70_symbol_interleaver.xml b/gr-hamnet70/grc/hamnet70_symbol_interleaver.xml
new file mode 100644
index 0000000..59b4045
--- /dev/null
+++ b/gr-hamnet70/grc/hamnet70_symbol_interleaver.xml
@@ -0,0 +1,44 @@
+
+
+ Symbol (De-)Interleaver
+ hamnet70_symbol_interleaver
+ [hamnet70]
+ import hamnet70
+ hamnet70.symbol_interleaver($interleaver_width, $operation.deinterleave, $length_tag)
+
+ Memory width
+ interleaver_width
+ int
+
+
+
+ Operation
+ operation
+ enum
+
+
+
+
+ Length Tag Key
+ length_tag
+ string
+
+
+
+
+ in
+ complex
+
+
+
diff --git a/gr-hamnet70/include/hamnet70/CMakeLists.txt b/gr-hamnet70/include/hamnet70/CMakeLists.txt
index cdd8f5d..9adbe52 100644
--- a/gr-hamnet70/include/hamnet70/CMakeLists.txt
+++ b/gr-hamnet70/include/hamnet70/CMakeLists.txt
@@ -31,5 +31,6 @@ install(FILES
scrambler.h
async_scrambler.h
insert_pilot_symbols.h
- correct_frequency_from_pilot_syms.h DESTINATION include/hamnet70
+ correct_frequency_from_pilot_syms.h
+ symbol_interleaver.h DESTINATION include/hamnet70
)
diff --git a/gr-hamnet70/include/hamnet70/symbol_interleaver.h b/gr-hamnet70/include/hamnet70/symbol_interleaver.h
new file mode 100644
index 0000000..b5669d5
--- /dev/null
+++ b/gr-hamnet70/include/hamnet70/symbol_interleaver.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2019 Thomas Kolb.
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef INCLUDED_HAMNET70_SYMBOL_INTERLEAVER_H
+#define INCLUDED_HAMNET70_SYMBOL_INTERLEAVER_H
+
+#include
+#include
+
+namespace gr {
+ namespace hamnet70 {
+
+ /*!
+ * \brief <+description of block+>
+ * \ingroup hamnet70
+ *
+ */
+ class HAMNET70_API symbol_interleaver : virtual public gr::tagged_stream_block
+ {
+ public:
+ typedef boost::shared_ptr sptr;
+
+ /*!
+ * \brief Return a shared_ptr to a new instance of hamnet70::symbol_interleaver.
+ *
+ * To avoid accidental use of raw pointers, hamnet70::symbol_interleaver's
+ * constructor is in a private implementation
+ * class. hamnet70::symbol_interleaver::make is the public interface for
+ * creating new instances.
+ */
+ static sptr make(size_t interleaver_width = 64, bool deinterleave = false, const std::string &length_tag = "packet_len");
+ };
+
+ } // namespace hamnet70
+} // namespace gr
+
+#endif /* INCLUDED_HAMNET70_SYMBOL_INTERLEAVER_H */
+
diff --git a/gr-hamnet70/lib/CMakeLists.txt b/gr-hamnet70/lib/CMakeLists.txt
index 7d8617f..041f520 100644
--- a/gr-hamnet70/lib/CMakeLists.txt
+++ b/gr-hamnet70/lib/CMakeLists.txt
@@ -35,6 +35,7 @@ list(APPEND hamnet70_sources
async_scrambler_impl.cc
insert_pilot_symbols_impl.cc
correct_frequency_from_pilot_syms_impl.cc
+ symbol_interleaver_impl.cc
)
set(hamnet70_sources "${hamnet70_sources}" PARENT_SCOPE)
diff --git a/gr-hamnet70/lib/symbol_interleaver_impl.cc b/gr-hamnet70/lib/symbol_interleaver_impl.cc
new file mode 100644
index 0000000..b10e8d6
--- /dev/null
+++ b/gr-hamnet70/lib/symbol_interleaver_impl.cc
@@ -0,0 +1,110 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2019 Thomas Kolb.
+ *
+ * This 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.
+ *
+ * This software 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 software; 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
+#include "symbol_interleaver_impl.h"
+
+namespace gr {
+ namespace hamnet70 {
+
+ symbol_interleaver::sptr
+ symbol_interleaver::make(size_t interleaver_width, bool deinterleave, const std::string &length_tag)
+ {
+ return gnuradio::get_initial_sptr
+ (new symbol_interleaver_impl(interleaver_width, deinterleave, length_tag));
+ }
+
+ /*
+ * The private constructor
+ */
+ symbol_interleaver_impl::symbol_interleaver_impl(size_t interleaver_width, bool deinterleave, const std::string &length_tag)
+ : gr::tagged_stream_block("symbol_interleaver",
+ gr::io_signature::make(1, 1, sizeof(gr_complex)),
+ gr::io_signature::make(1, 1, sizeof(gr_complex)), length_tag),
+ d_width(interleaver_width),
+ d_deinterleave(deinterleave)
+ {}
+
+ /*
+ * Our virtual destructor.
+ */
+ symbol_interleaver_impl::~symbol_interleaver_impl()
+ {
+ }
+
+ int
+ symbol_interleaver_impl::calculate_output_stream_length(const gr_vector_int &ninput_items)
+ {
+ int noutput_items = ninput_items[0];
+ return noutput_items ;
+ }
+
+ int
+ symbol_interleaver_impl::work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const gr_complex *in = (const gr_complex *) input_items[0];
+ gr_complex *out = (gr_complex *) output_items[0];
+
+ size_t nitems = ninput_items[0];
+
+ size_t ncols = d_width;
+ size_t nfullcols = nitems % d_width;
+
+ size_t nrows = nitems / d_width;
+ if(nitems % nrows != 0) {
+ nrows++;
+ }
+
+ size_t row = 0;
+ size_t col = 0;
+
+ for(size_t i = 0; i < nitems; i++) {
+ size_t swapped_i = ncols * row + col;
+
+ row++;
+ if ((col >= nfullcols && row == (nrows-1))
+ || row == nrows) {
+ col++;
+ row = 0;
+ }
+
+ if(d_deinterleave) {
+ out[i] = in[swapped_i];
+ } else { /* interleave */
+ out[swapped_i] = in[i];
+ }
+ }
+
+ noutput_items = nitems;
+
+ // Tell runtime system how many output items we produced.
+ return noutput_items;
+ }
+
+ } /* namespace hamnet70 */
+} /* namespace gr */
+
diff --git a/gr-hamnet70/lib/symbol_interleaver_impl.h b/gr-hamnet70/lib/symbol_interleaver_impl.h
new file mode 100644
index 0000000..845c506
--- /dev/null
+++ b/gr-hamnet70/lib/symbol_interleaver_impl.h
@@ -0,0 +1,53 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2019 Thomas Kolb.
+ *
+ * This 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.
+ *
+ * This software 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 software; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_HAMNET70_SYMBOL_INTERLEAVER_IMPL_H
+#define INCLUDED_HAMNET70_SYMBOL_INTERLEAVER_IMPL_H
+
+#include
+
+namespace gr {
+ namespace hamnet70 {
+
+ class symbol_interleaver_impl : public symbol_interleaver
+ {
+ private:
+ size_t d_width;
+ bool d_deinterleave;
+
+ protected:
+ int calculate_output_stream_length(const gr_vector_int &ninput_items);
+
+ public:
+ symbol_interleaver_impl(size_t interleaver_width, bool deinterleave, const std::string &length_tag);
+ ~symbol_interleaver_impl();
+
+ // Where all the action really happens
+ int work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } // namespace hamnet70
+} // namespace gr
+
+#endif /* INCLUDED_HAMNET70_SYMBOL_INTERLEAVER_IMPL_H */
+
diff --git a/gr-hamnet70/python/CMakeLists.txt b/gr-hamnet70/python/CMakeLists.txt
index 9ef778e..4e8c047 100644
--- a/gr-hamnet70/python/CMakeLists.txt
+++ b/gr-hamnet70/python/CMakeLists.txt
@@ -51,3 +51,4 @@ set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
#GR_ADD_TEST(qa_async_scrambler ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_async_scrambler.py)
#GR_ADD_TEST(qa_insert_pilot_symbols ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_insert_pilot_symbols.py)
#GR_ADD_TEST(qa_correct_frequency_from_pilot_syms ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_correct_frequency_from_pilot_syms.py)
+#GR_ADD_TEST(qa_symbol_interleaver ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_symbol_interleaver.py)
diff --git a/gr-hamnet70/python/qa_symbol_interleaver.py b/gr-hamnet70/python/qa_symbol_interleaver.py
new file mode 100755
index 0000000..1046d68
--- /dev/null
+++ b/gr-hamnet70/python/qa_symbol_interleaver.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright 2019 Thomas Kolb.
+#
+# This 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.
+#
+# This software 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 software; 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
+from gnuradio import blocks
+import hamnet70_swig as hamnet70
+
+class qa_symbol_interleaver (gr_unittest.TestCase):
+
+ def setUp (self):
+ self.tb = gr.top_block ()
+
+ def tearDown (self):
+ self.tb = None
+
+ def test_001_t (self):
+ # set up fg
+ self.tb.run ()
+ # check data
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_symbol_interleaver, "qa_symbol_interleaver.xml")
diff --git a/gr-hamnet70/swig/hamnet70_swig.i b/gr-hamnet70/swig/hamnet70_swig.i
index 88ca6d0..2785bea 100644
--- a/gr-hamnet70/swig/hamnet70_swig.i
+++ b/gr-hamnet70/swig/hamnet70_swig.i
@@ -17,6 +17,7 @@
#include "hamnet70/async_scrambler.h"
#include "hamnet70/insert_pilot_symbols.h"
#include "hamnet70/correct_frequency_from_pilot_syms.h"
+#include "hamnet70/symbol_interleaver.h"
%}
@@ -39,3 +40,5 @@ GR_SWIG_BLOCK_MAGIC2(hamnet70, async_scrambler);
GR_SWIG_BLOCK_MAGIC2(hamnet70, insert_pilot_symbols);
%include "hamnet70/correct_frequency_from_pilot_syms.h"
GR_SWIG_BLOCK_MAGIC2(hamnet70, correct_frequency_from_pilot_syms);
+%include "hamnet70/symbol_interleaver.h"
+GR_SWIG_BLOCK_MAGIC2(hamnet70, symbol_interleaver);
diff --git a/grc/hamnet70_demod_sc16qam.grc b/grc/hamnet70_demod_sc16qam.grc
index 800f7e8..fad5d65 100644
--- a/grc/hamnet70_demod_sc16qam.grc
+++ b/grc/hamnet70_demod_sc16qam.grc
@@ -1327,7 +1327,7 @@
_coordinate
- (1156, 1121)
+ (1262, 1122)
_rotation
@@ -1386,7 +1386,7 @@
_coordinate
- (918, 922)
+ (998, 922)
_rotation
@@ -1472,7 +1472,7 @@
_coordinate
- (918, 1002)
+ (998, 1002)
_rotation
@@ -1609,7 +1609,7 @@
_coordinate
- (567, 842)
+ (479, 842)
_rotation
@@ -2065,7 +2065,7 @@
_coordinate
- (263, 858)
+ (231, 858)
_rotation
@@ -2151,6 +2151,57 @@
1500
+
+ hamnet70_symbol_interleaver
+
+ alias
+
+
+
+ comment
+
+
+
+ affinity
+
+
+
+ _enabled
+ 1
+
+
+ _coordinate
+ (670, 1074)
+
+
+ _rotation
+ 0
+
+
+ id
+ hamnet70_symbol_interleaver_0
+
+
+ length_tag
+ packet_len
+
+
+ maxoutbuf
+ 0
+
+
+ interleaver_width
+ 64
+
+
+ minoutbuf
+ 0
+
+
+ operation
+ deinterleave
+
+
import
@@ -2687,25 +2738,7 @@
digital_header_payload_demux_0
- blocks_rms_xx_0
- 1
- 0
-
-
- digital_header_payload_demux_0
- blocks_sub_xx_0
- 1
- 0
-
-
- digital_header_payload_demux_0
- digital_constellation_decoder_cb_0
- 1
- 0
-
-
- digital_header_payload_demux_0
- digital_constellation_soft_decoder_cf_0
+ hamnet70_symbol_interleaver_0
1
0
@@ -2775,6 +2808,30 @@
control_value
freq
+
+ hamnet70_symbol_interleaver_0
+ blocks_rms_xx_0
+ 0
+ 0
+
+
+ hamnet70_symbol_interleaver_0
+ blocks_sub_xx_0
+ 0
+ 0
+
+
+ hamnet70_symbol_interleaver_0
+ digital_constellation_decoder_cb_0
+ 0
+ 0
+
+
+ hamnet70_symbol_interleaver_0
+ digital_constellation_soft_decoder_cf_0
+ 0
+ 0
+
pad_source_0
blocks_multiply_xx_0
diff --git a/grc/hamnet70_mod_sc16qam.grc b/grc/hamnet70_mod_sc16qam.grc
index 83ccfdc..c399346 100644
--- a/grc/hamnet70_mod_sc16qam.grc
+++ b/grc/hamnet70_mod_sc16qam.grc
@@ -618,7 +618,7 @@
_coordinate
- (1765, 423)
+ (1980, 391)
_rotation
@@ -677,7 +677,7 @@
_coordinate
- (1525, 283)
+ (1709, 251)
_rotation
@@ -1136,7 +1136,7 @@
_coordinate
- (1980, 435)
+ (2196, 403)
_rotation
@@ -1160,13 +1160,64 @@
minoutbuf
- 0
+ base_buffer_size
pilot_sequence
[1+1j, -1-1j, 1-1j, -1+1j]
+
+ hamnet70_symbol_interleaver
+
+ alias
+
+
+
+ comment
+
+
+
+ affinity
+
+
+
+ _enabled
+ 1
+
+
+ _coordinate
+ (1733, 483)
+
+
+ _rotation
+ 0
+
+
+ id
+ hamnet70_symbol_interleaver_0
+
+
+ length_tag
+ packet_len
+
+
+ maxoutbuf
+ 0
+
+
+ interleaver_width
+ 64
+
+
+ minoutbuf
+ 0
+
+
+ operation
+ interleave
+
+
import
@@ -1398,7 +1449,7 @@
_coordinate
- (2188, 451)
+ (2404, 419)
_rotation
@@ -1478,9 +1529,9 @@
digital_chunks_to_symbols_xx_0
- blocks_tagged_stream_mux_0
+ hamnet70_symbol_interleaver_0
0
- 2
+ 0
digital_chunks_to_symbols_xx_0_0
@@ -1530,6 +1581,12 @@
0
0
+
+ hamnet70_symbol_interleaver_0
+ blocks_tagged_stream_mux_0
+ 0
+ 2
+
interp_fir_filter_xxx_0
pad_sink_0
diff --git a/tmp/test_sc16qam.grc b/tmp/test_sc16qam.grc
index 4ce553c..236b168 100644
--- a/tmp/test_sc16qam.grc
+++ b/tmp/test_sc16qam.grc
@@ -533,7 +533,7 @@
tags
- tagged_streams.make_lengthtags((256,), (0,), "packet_len")
+ tagged_streams.make_lengthtags((1000,), (0,), "packet_len")
vlen
@@ -541,7 +541,7 @@
vector
- list(range(256))
+ [x%256 for x in range(1000)]
@@ -1383,11 +1383,11 @@
_enabled
- 0
+ 1
fftsize
- 8192
+ 1024
_coordinate
@@ -1447,7 +1447,7 @@
rate
- 1
+ 10
wintype
@@ -1486,7 +1486,7 @@
_enabled
- True
+ 0
_coordinate