1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! Coding blocks: channel codes, mapping of the coded bits and soft demapping
//! (bit-interleaved coded modulation).
//!
//! | Block | Does |
//! |---|---|
//! | `fec_encode` | draws the information bits of `blocks` codewords and encodes them, optionally through a random bit interleaver |
//! | `map` | maps the coded bits on a constellation (the last symbol padded with random bits) |
//! | `demap` | the bit LLRs of the received symbols with their noise variances (exact or max-log) |
//! | `fec_decode` | deinterleaves and decodes the LLRs |
//!
//! A code is a mapping with a `type`:
//!
//! | `type` | Parameters | Code |
//! |---|---|---|
//! | `conv` | `k`, `hard`, `puncture` | the $(133, 171)_{8}$ code of constraint length 7, terminated, Viterbi decoding; `puncture` names a pattern of `comnum_fec::puncture::Puncturer::from_name` (`ieee80211_2_3`, `ieee80211_3_4`, `ieee80211_5_6`, `dvbs_2_3`, `dvbs_3_4`, `dvbs_5_6`, `dvbs_7_8`) |
//! | `rs` | `m`, `t`, `n`, `first_root`, `root_step`, `poly` | a Reed–Solomon code over $\mathrm{GF}(2^{m})$ correcting $t$ symbols, shortened to $n$ symbols, hard decisions (`n = 2^m - 1`, $b = 1$, $c = 1$ and the conventional field by default; the CCSDS code in the conventional basis: `m: 8, t: 16, first_root: 112, root_step: 11, poly: 391`; its dual basis and interleaving are `comnum_fec::ccsds::CcsdsRs`) |
//! | `turbo` | `k`, `iterations`, `max_log` | the turbo code of LTE (log-MAP or max-log-MAP) |
//! | `ldpc` | `n`, `k`, `var_degree`, `seed`, `rule`, `alpha`, `layered`, `iterations` | a regular LDPC code built by progressive edge growth; the defaults are those of `comnum_fec::ldpc` (degree 3, seed 1, layered sum-product, 50 iterations, $\alpha = 0.8$) |
//! | `polar` | `n`, `k`, `design_ebn0_db`, `crc`, `list` | a polar code of the Gaussian approximation, SC or CRC-aided SCL decoding |
//!
//! The parameters of every code are declared as those of the blocks: `comnum blocks
//! fec_encode` lists them with their defaults, units and accepted values, and the JSON
//! Schema of `comnum schema` describes them.
//!
//! The encoder and the decoder are built from the same mapping (the decoder settings
//! are ignored by the encoder), so that a specification writes the code once with a
//! YAML anchor:
//!
//! ```yaml
//! link:
//! - {type: fec_encode, code: &code {type: ldpc, n: 1024, k: 512}, blocks: 4, interleave: true}
//! - {type: map, constellation: 16-QAM}
//! - {type: rayleigh, coherence_samples: 1}
//! - {type: awgn_ebn0, ebn0_db: $ebn0_db}
//! - mimo_rx
//! - demap
//! - {type: fec_decode, code: *code, interleave: true}
//! metrics: {report: [ber, coded_ber, bler]}
//! ```
//!
//! `awgn_ebn0` after `fec_encode` counts the energy per information bit: $E_{s}/N_{0} =
//! R \log_{2} M \cdot E_{b}/N_{0}$ with the code rate $R$.
//!
//! # References
//!
//! 1. G. Caire, G. Taricco and E. Biglieri, "Bit-interleaved coded modulation," *IEEE
//! Trans. Inf. Theory*, 44(3), 927–946, 1998.
use Extension;
pub use build_code;
use ;
use ;
use ;
/// The blocks of this module: their documentation and their builders.
pub