GNU Radio C++ API Reference 3.10.12.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
additive_scrambler.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2008,2010,2012 Free Software Foundation, Inc.
4 * Copyright 2024 Daniel Estevez <daniel@destevez.net>
5 *
6 * This file is part of GNU Radio
7 *
8 * SPDX-License-Identifier: GPL-3.0-or-later
9 *
10 */
11
12#ifndef INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_H
13#define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_H
14
16#include <gnuradio/sync_block.h>
17
18namespace gr {
19namespace digital {
20
21/*!
22 * \ingroup coding_blk
23 *
24 * \brief
25 * Scramble an input stream using an LFSR.
26 *
27 * \details
28 *
29 * The scrambler can work with soft symbols (gr_complex, float,
30 * int32_t, or int16_t) or with hard symbols (uint8_t). When working
31 * with soft symbols, the scrambler works by changing the sign of the
32 * input symbol whenever the output of the LFSR is one.
33 *
34 * When working with hard symbols, this block scrambles up to
35 * 8 bits per byte of the input data stream, starting at the LSB.
36 * In this case, the scrambler works by XORing the incoming bit stream
37 * by the output of the LFSR.
38 *
39 * In both cases, optionally, after \p count bits have been
40 * processed, the shift register is reset to the \p seed value.
41 * This allows processing fixed length vectors of samples.
42 *
43 * Alternatively, the LFSR can be reset using a reset tag to
44 * scramble variable length vectors. However, it cannot be reset
45 * between bytes in the hard symbol mode.
46 *
47 * For details on configuring the LFSR, see gr::digital::lfsr.
48 */
49template <class T>
51{
52public:
53 typedef std::shared_ptr<additive_scrambler<T>> sptr;
54
55 /*!
56 * \brief Create additive scrambler.
57 *
58 * \param mask Polynomial mask for LFSR
59 * \param seed Initial shift register contents
60 * \param len Shift register length
61 * \param count Number of bytes after which shift register is reset, 0=never
62 * \param bits_per_byte Number of bits per byte (must be 1 if T != uint8_t)
63 * \param reset_tag_key When a tag with this key is detected, the shift register is
64 * reset (when this is set, count is ignored!)
65 */
66 static sptr make(uint64_t mask,
67 uint64_t seed,
68 uint8_t len,
69 int64_t count = 0,
70 uint8_t bits_per_byte = 1,
71 const std::string& reset_tag_key = "");
72
73 virtual uint64_t mask() const = 0;
74 virtual uint64_t seed() const = 0;
75 virtual uint8_t len() const = 0;
76 virtual int64_t count() const = 0;
77 virtual uint8_t bits_per_byte() = 0;
78};
79
85
86} /* namespace digital */
87} /* namespace gr */
88
89#endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_H */
Scramble an input stream using an LFSR.
Definition additive_scrambler.h:51
virtual uint8_t len() const =0
virtual uint64_t mask() const =0
virtual int64_t count() const =0
virtual uint8_t bits_per_byte()=0
virtual uint64_t seed() const =0
std::shared_ptr< additive_scrambler< T > > sptr
Definition additive_scrambler.h:53
static sptr make(uint64_t mask, uint64_t seed, uint8_t len, int64_t count=0, uint8_t bits_per_byte=1, const std::string &reset_tag_key="")
Create additive scrambler.
synchronous 1:1 input to output with history
Definition sync_block.h:26
#define DIGITAL_API
Definition gr-digital/include/gnuradio/digital/api.h:18
additive_scrambler< int32_t > additive_scrambler_ii
Definition additive_scrambler.h:82
additive_scrambler< int16_t > additive_scrambler_ss
Definition additive_scrambler.h:83
additive_scrambler< uint8_t > additive_scrambler_bb
Definition additive_scrambler.h:84
additive_scrambler< float > additive_scrambler_ff
Definition additive_scrambler.h:81
additive_scrambler< gr_complex > additive_scrambler_cc
Definition additive_scrambler.h:80
GNU Radio logging wrapper.
Definition basic_block.h:29