olo_base_rs_encode¶
Status Information¶
VHDL Source: olo_base_rs_encode
Description¶
This entity is a systematic Reed-Solomon encoder over GF(2^m) for a stream of symbols. It supports any primitive field polynomial, any code length n up to 2^m-1 and any number of check symbols, the generator roots alpha^(b0 + i*gamma), symbol interleaving of I codewords, shortened blocks (virtual fill) and the dual basis representation of the symbols at its ports.
The data symbols pass the entity unchanged; after the last data symbol of a block the entity outputs the check symbols of all codewords of the block. The matching decoder is olo_base_rs_decode, the field arithmetic is in olo_base_pkg_gf.
The reference configuration is the Reed-Solomon code of CCSDS 131.0-B-5 (TM Synchronization and Channel Coding, section 4):
| Generic | E = 16, RS(255,223) | E = 8, RS(255,239) | Clause |
|---|---|---|---|
| FieldPolynomial_g | x"87" | x"87" | 4.3.3: x^8 + x^7 + x^2 + x + 1 |
| CodewordSymbols_g | 255 | 255 | 4.3.2 |
| DataSymbols_g | 223 | 239 | 4.3.2 |
| FirstRoot_g | 212 | 45 | 4.3.4: roots alpha^(11 j), j = 128-E ... 127+E, 11 (128-E) mod 255 |
| RootStep_g | 11 | 11 | 4.3.4 |
| InterleaveDepth_g | 1, 2, 3, 4, 5 or 8 | 1, 2, 3, 4, 5 or 8 | 4.3.5 |
| DualBasis_g | 117 | 117 | 4.3.9 |
A shortened codeblock (4.3.7) is a block with fewer data symbols ending with In_Last. The attached sync marker (4.3.8.1) and the pseudo-randomizer are not part of this entity.
A Python model of the encoder is in src/base/python/olo_base_rs; the testbench compares the entity with it.
Generics¶
| Name | Type | Default | Description |
|---|---|---|---|
| FieldPolynomial_g | std_logic_vector | - | Field polynomial without its x^m term (as in olo_base_pkg_gf), e.g. x"87" for x^8 + x^7 + x^2 + x + 1. Its length is the symbol width m (3 ... 12). Must be primitive. |
| CodewordSymbols_g | positive | - | Codeword length n in symbols, at most 2^m-1 |
| DataSymbols_g | positive | - | Data symbols per codeword k (k < n). The codeword has n-k check symbols. |
| FirstRoot_g | natural | 0 | b0: the generator polynomial is g(x) = (x + alpha^b0) (x + alpha^(b0+gamma)) ... (x + alpha^(b0+(n-k-1) gamma)) |
| RootStep_g | positive | 1 | gamma, the step between the exponents of consecutive roots. Must be coprime to 2^m-1 for the decoder. |
| InterleaveDepth_g | positive | 1 | Interleaving depth I: number of codewords interleaved symbol by symbol in one block |
| DualBasis_g | natural | 0 | Representation of the symbols at the ports: 0: polynomial basis s > 0: dual basis of (1, alpha^s, ..., alpha^(s(m-1))) (CCSDS 131.0-B-5: 117) |
Interfaces¶
Control¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| Clk | in | 1 | - | Clock |
| Rst | in | 1 | - | Reset input (high-active, synchronous to Clk) |
Input Data¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| In_Valid | in | 1 | '1' | AXI4-Stream handshaking signal for In_Data |
| In_Ready | out | 1 | N/A | AXI4-Stream handshaking signal for In_Data |
| In_Data | in | m | - | Data symbol |
| In_Last | in | 1 | '0' | Last data symbol of a shortened block. Not required for a block of I*k symbols. |
Output Data¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| Out_Valid | out | 1 | N/A | AXI4-Stream handshaking signal for Out_Data |
| Out_Ready | in | 1 | '1' | AXI4-Stream handshaking signal for Out_Data |
| Out_Data | out | m | N/A | Data symbol or check symbol |
| Out_Parity | out | 1 | N/A | '1' for check symbols |
| Out_Last | out | 1 | N/A | Last check symbol of the codeblock |
Architecture¶
Blocks¶
A block consists of I*k data symbols, or fewer when In_Last ends it earlier (shortened block). The symbols are dealt to the I codewords in rotation: symbol i of the block belongs to codeword i mod I. After the last data symbol the entity outputs the I*(n-k) check symbols: the first check symbol of codewords 1 ... I, then the second check symbol of codewords 1 ... I and so on (CCSDS 131.0-B-5 4.4.1). Out_Last marks the last check symbol.
Each codeword of a shortened block is shortened by the same number of symbols, so the length of a shortened block must be a multiple of I (CCSDS 131.0-B-5 4.3.7.3). A block that ends with In_Last at another length is still ended in a defined way: every codeword gets the check symbols of the data symbols it received, in the order above. Such a block is not a valid codeblock and olo_base_rs_decode reports it as uncorrectable. The next block starts normally.
Data path¶
Every codeword has a remainder register of n-k symbols, the remainder of the division of its data polynomial by g(x). The I registers form a rotating chain: the register of the codeword of the current symbol is updated (one constant multiplier per check symbol, which synthesis reduces to XOR networks) and moved to the end of the chain. During the check symbol phase the registers are shifted out in the same rotation and are empty at the end of the block, so consecutive blocks need no clearing. After a reset the chain is cleared in I clock cycles, during which In_Ready is low.
With DualBasis_g > 0 the input symbols are converted to the polynomial basis for the division and the check symbols back to the dual basis (two constant GF(2) matrices). The data symbols pass unchanged.
Timing and Throughput¶
- The output is registered: a symbol appears on Out_Data one clock cycle after it was accepted.
- The entity processes one symbol per clock cycle. The output has no gaps: the check symbols follow the last data symbol directly, and the next block can follow the last check symbol directly.
- In_Ready is low while the I*(n-k) check symbols are output, so the data rate at the input is k/n of the clock for full blocks. With 8-bit symbols at 200 MHz the output carries 1.6 Gbit/s.
- The entity handles one symbol per beat. Wider streams are converted with olo_base_wconv_n2xn and olo_base_wconv_xn2n around it.
Resources¶
Synthesis result for CCSDS E = 16 with I = 5 (Libero SoC 2025.2, PolarFire SoC MPFS250T, speed grade STD; the maximum frequency with registered ports after place and route): 799 LUTs, 1318 registers, no RAM, 331 MHz. The registers are mainly the I*(n-k) symbols of the remainder registers.