Skip to content

Commit 5a7ead3

Browse files
committed
xls:modules:rle: Review: update comments
Signed-off-by: Maciej Dudek <[email protected]>
1 parent fe7dfe3 commit 5a7ead3

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

xls/modules/rle/rle_enc_adv.x

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,32 @@
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:
2424

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.
25+
// This encoder is implemented as a net of 4 proc.
26+
// 1. Reduce step - this process takes incoming symbols and symbol_valid
27+
// and reduces them into symbol count pairs. This step is stateless.
28+
// 2. Realign step - this process moves pairs emitted from the reduce step
29+
// so that they are aligned to the left, it also calculates propagation
30+
// distance for the first pair.
31+
// Example behaviours:
32+
// 1)
33+
// input: [.., (A, 2), .., (B, 2)]
34+
// output: [(A, 2), (B, 2), .., ..]
35+
// propagation distance: 0
36+
// 2)
37+
// input: [.., .., (A, 3), (A, 1)]
38+
// output: [(A, 3), (A, 1), .., ..]
39+
// propagation distance: 1
40+
// 3. Core step - this step is stateful. It takes align pairs from
41+
// the realign step, and combines them with its state to create multiple
42+
// symbol/count pairs output. State is represented by following tuple
43+
// `<symbol, count, last>`. It contains symbol and count from last pair
44+
// received from realign step, or current sum of repeating symbol spanning
45+
// multiple input widths.
46+
// 4. - Adjust Width step - this step takes output from the core step.
3447
// If output can handle more or equal number of pairs as
35-
// input number of symbols. This stage does nothing.
48+
// input number of symbols. This step does nothing.
3649
// If the output is narrower than the input,
37-
// this stage will serialize symbol counter pairs.
50+
// this step will serialize symbol counter pairs.
3851

3952

4053
import std

xls/modules/rle/rle_enc_adv_core.x

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub proc RunLengthEncoderAdvancedCoreStage<SYMBOL_WIDTH: u32, COUNT_WIDTH: u32,
126126
),
127127
};
128128

129-
let (symobls_to_send, counts_to_send, last_to_send, pair_count_to_send) =
129+
let (symbols_to_send, counts_to_send, last_to_send, pair_count_to_send) =
130130
match (combine_last, state.prev_last) {
131131
(false, false) => {
132132
let idx = total_pair_count - u32:1;
@@ -152,7 +152,7 @@ pub proc RunLengthEncoderAdvancedCoreStage<SYMBOL_WIDTH: u32, COUNT_WIDTH: u32,
152152

153153
let output = (
154154
EncOutData<SYMBOL_WIDTH, COUNT_WIDTH, INPUT_WIDTH> {
155-
symbols: symobls_to_send,
155+
symbols: symbols_to_send,
156156
counts: counts_to_send,
157157
last: last_to_send,
158158
},

0 commit comments

Comments
 (0)