Skip to content

Commit c9daa7d

Browse files
committed
[RLE]: Improve high level overview on Multisymbol encoder
Signed-off-by: Maciej Dudek <[email protected]>
1 parent c229011 commit c9daa7d

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

xls/modules/rle/rle_enc_adv.x

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,30 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// This file implements a parametric RLE encoder
15+
// This file implements a parametric multisymbol RLE encoder
1616
//
1717
// The encoder uses Run Length Encoding (RLE) to compress the input stream of
1818
// repeating symbols to the output stream that contains the symbols and
19-
// the number of its consequect occurrences in the input stream.
19+
// the number of its consecutive occurrences in the input stream.
2020
// Both the input and the output channels use additional `last` flag
2121
// that indicates whether the packet ends the transmission. After sending
2222
// the last packet encoder dumps all the data to the output stream.
2323
// The behavior of the encoder is presented on the waveform below:
24-
// ──────╥─────╥─────╥─────╥─────╥─────╥─────╥─────╥────
25-
// next evaluation XXXXXX║ 0 ║ 1 ║ 2 ║ 3 ║ 4 ║ 5 ║ 6 ║ ...
26-
// ──────╨─────╨─────╨─────╨─────╨─────╨─────╨─────╨────
27-
// ──────╥───────────╥─────╥─────╥─────╥─────╥──────────
28-
// symbol XXXXXX║ A ║ B ║XXXXX║ B ║ C ║XXXXXXXXXX
29-
// (input channel) ──────╨───────────╨─────╨─────╨─────╨─────╨──────────
30-
// last ┌─────┐ ┌─────┐
31-
// (input channel) ──────────────────┘ └───────────┘ └──────────
32-
// ╥─────╥─────╥─────╥─────╥─────╥─────╥─────╥──────────
33-
// state.prev_symbol ║ 0 ║ A ║ A ║ B ║ 0 ║ B ║ C ║ 0
34-
// (set state value) ╨─────╨─────╨─────╨─────╨─────╨─────╨─────╨──────────
35-
// ╥─────╥─────╥─────╥─────╥─────╥─────╥─────╥──────────
36-
// state.prev_count ║ 0 ║ 1 ║ 2 ║ 1 ║ 0 ║ 1 ║ 1 ║ 0
37-
// (set state value) ╨─────╨─────╨─────╨─────╨─────╨─────╨─────╨──────────
38-
//
39-
// do_send ┌───────────┐ ┌───────────┐
40-
// ──────────────────┘ └─────┘ └────
41-
// ──────────────────╥─────╥─────╥─────╥─────╥─────╥────
42-
// symbol, count XXXXXXXXXXXXXXXXXX║ A,2 ║ B,1 ║XXXXX║ B,1 ║ C,1 ║XXXX
43-
// (output channel) ──────────────────╨─────╨─────╨─────╨─────╨─────╨────
44-
// last ┌─────┐ ┌─────┐
45-
// (output channel) ────────────────────────┘ └───────────┘ └────
24+
25+
// This encoder is implemented as a net of 4 processes.
26+
// 1. Reduce stage - this process takes incoming symbols and symbol_valid
27+
// and reduces them into symbol count pairs. This stage is stateless.
28+
// 2. Realign stage - this process moves pairs emitted from previous stage
29+
// so that they are align to the left, it also calculates propagation distance
30+
// for the first pair.
31+
// 3. Core stage - this stage is stateful. It takes align pairs,
32+
// and combines them with its state.It outputs multiple symbol/count pairs.
33+
// 4 - Adjust Width stage - this stage takes output from the core stage.
34+
// If output can handle more or equal number of pairs as
35+
// input number of symbols. This stage does nothing.
36+
// If the output is narrower than the input,
37+
// this stage will serialize symbol counter pairs.
38+
4639

4740
import std
4841
import xls.modules.rle.rle_common as rle_common

0 commit comments

Comments
 (0)