summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau2011-08-29 17:58:25 -0400
committerTom Rondeau2011-08-29 17:58:25 -0400
commit5784b0c53c6d19b7a74f82e57c816beecd8b5edb (patch)
tree79567afdc96134ab564b64ca32b6d6a0765cd088
parentf94ceff1f608bd5d1c67e3ff662fb2c659e61aa8 (diff)
downloadgnuradio-5784b0c53c6d19b7a74f82e57c816beecd8b5edb.tar.gz
gnuradio-5784b0c53c6d19b7a74f82e57c816beecd8b5edb.tar.bz2
gnuradio-5784b0c53c6d19b7a74f82e57c816beecd8b5edb.zip
digital: fixing qa code to test new dqpsk; a few minor formatting changes.
-rw-r--r--gr-digital/lib/digital_constellation.cc8
-rw-r--r--gr-digital/lib/digital_constellation.h1
-rwxr-xr-xgr-digital/python/qa_constellation.py11
3 files changed, 13 insertions, 7 deletions
diff --git a/gr-digital/lib/digital_constellation.cc b/gr-digital/lib/digital_constellation.cc
index ed6d32bcb..3dfc70273 100644
--- a/gr-digital/lib/digital_constellation.cc
+++ b/gr-digital/lib/digital_constellation.cc
@@ -463,12 +463,16 @@ digital_make_constellation_dqpsk()
digital_constellation_dqpsk::digital_constellation_dqpsk ()
{
+ // This constellation is not gray coded, which allows
+ // us to use differential encodings (through gr_diff_encode and
+ // gr_diff_decode) on the symbols.
d_constellation.resize(4);
d_constellation[0] = gr_complex(+SQRT_TWO, +SQRT_TWO);
d_constellation[1] = gr_complex(-SQRT_TWO, +SQRT_TWO);
d_constellation[2] = gr_complex(-SQRT_TWO, -SQRT_TWO);
d_constellation[3] = gr_complex(+SQRT_TWO, -SQRT_TWO);
+ // Use this mapping to convert to gray code before diff enc.
d_pre_diff_code.resize(4);
d_pre_diff_code[0] = 0x0;
d_pre_diff_code[1] = 0x1;
@@ -481,10 +485,12 @@ digital_constellation_dqpsk::digital_constellation_dqpsk ()
calc_arity();
}
-#include <cstdio>
unsigned int
digital_constellation_dqpsk::decision_maker(const gr_complex *sample)
{
+ // Slower deicison maker as we can't slice along one axis.
+ // Maybe there's a better way to do this, still.
+
bool a = real(*sample) > 0;
bool b = imag(*sample) > 0;
if(a) {
diff --git a/gr-digital/lib/digital_constellation.h b/gr-digital/lib/digital_constellation.h
index fd773a907..3e54e7d96 100644
--- a/gr-digital/lib/digital_constellation.h
+++ b/gr-digital/lib/digital_constellation.h
@@ -344,6 +344,7 @@ class digital_constellation_qpsk : public digital_constellation
/* */
/************************************************************/
+//! \brief DQPSK-specific constellation and decision maker
class digital_constellation_dqpsk;
typedef boost::shared_ptr<digital_constellation_dqpsk> digital_constellation_dqpsk_sptr;
diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py
index 02afb8d2d..264ff7de6 100755
--- a/gr-digital/python/qa_constellation.py
+++ b/gr-digital/python/qa_constellation.py
@@ -70,10 +70,8 @@ tested_constellation_info = (
'mod_code': tested_mod_codes, },
True, None),
(digital_swig.constellation_bpsk, {}, True, None),
- # No differential testing for qpsk because it is gray-coded.
- # This is because soft decision making is simpler if we can assume
- # gray coding.
(digital_swig.constellation_qpsk, {}, False, None),
+ (digital_swig.constellation_dqpsk, {}, True, None),
(digital_swig.constellation_8psk, {}, False, None),
(twod_constell, {}, True, None),
(threed_constell, {}, True, None),
@@ -143,8 +141,8 @@ class test_constellation (gr_unittest.TestCase):
class mod_demod(gr.hier_block2):
def __init__(self, constellation, differential, rotation):
if constellation.arity() > 256:
- # If this becomes limiting some of the blocks should be generalised so that they can work
- # with shorts and ints as well as chars.
+ # If this becomes limiting some of the blocks should be generalised so
+ # that they can work with shorts and ints as well as chars.
raise ValueError("Constellation cannot contain more than 256 points.")
gr.hier_block2.__init__(self, "mod_demod",
@@ -174,7 +172,8 @@ class mod_demod(gr.hier_block2):
if self.differential:
self.blocks.append(gr.diff_encoder_bb(arity))
# Convert to constellation symbols.
- self.blocks.append(gr.chunks_to_symbols_bc(self.constellation.points(), self.constellation.dimensionality()))
+ self.blocks.append(gr.chunks_to_symbols_bc(self.constellation.points(),
+ self.constellation.dimensionality()))
# CHANNEL
# Channel just consists of a rotation to check differential coding.
if rotation is not None: