Skip to content

Commit

Permalink
review: Update adv rle enc documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Dudek <mdudek@antmicro.com>
  • Loading branch information
mtdudek committed Oct 6, 2023
1 parent 66ff962 commit d28d81b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 34 deletions.
1 change: 0 additions & 1 deletion xls/modules/rle/rle_dec.x
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ proc RunLengthDecoderZeroCountTest {
(tok)
}(tok);
send(tok, terminator, true);
()
}
}

Expand Down
29 changes: 23 additions & 6 deletions xls/modules/rle/rle_enc_adv.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ the last packet the encoder dumps all the data to the output stream.
- symbol counter is 2 bits wide.

### Process
1. Reduce step - this process takes incoming symbols and symbol_valid
and reduces them into symbol count pairs. This step is stateless.
1. Reduce step - this process takes incoming symbols, symbol_valid,
last signal and reduces them into symbol count pairs. Last value is
passed through, so it's omitted from the example IO. This step is stateless.

Example:

Expand All @@ -38,7 +39,8 @@ Example:

2. Realign step - this process moves pairs emitted from the reduce step
so that they are aligned to the left, it also calculates propagation
distance for the first pair.
distance for the first pair. This stage doesn't modify last signal value,
so it's omitted in the example.

Example:

Expand All @@ -54,9 +56,13 @@ the realign step, and combines them with its state to create multiple
symbol/count pairs output. State is represented by following tuple
`<symbol, count, last>`. It contains symbol and count from last pair
received from the realign step, or current sum of repeating symbol spanning
multiple input widths.
multiple input widths.

Example:
First set of examples assumes that state doesn't have last set nor
was last received. Second set of examples will indicate value of last
signal in the proc state or input data and how it's emitted to output.

Example set 1:

|||||
|------|-----|-------|----------|
Expand All @@ -67,6 +73,17 @@ Example:
|state |input|output |next state|
|(A, 1)| [(A, 1), .., .., ..]|[.., .., .., ..]| (A, 2)|

Example set 2:

|||||
|------|-----|-------|----------|
|state: pair, last |input|output |next state|
|(A, 2), false| [(A, 2), (B, 2), .., ..], true |[(A, 3), (A, 1), (B, 2), ..], true| (), false|
|state: pair, last |input|output |next state|
|(A, 1), false| [(B, 1), (C, 1), (D, 1), (A, 1)], true|[(A, 1), (B, 1), (C, 1), (D, 1)]| (A, 1), true|
|state |input|output |next state|
|(A, 1), true| no data taken from input |[(A, 1), .., .. , ..], true| (), false|

4. Adjust Width step - this step takes output from the core step.
If output can handle more or equal number of pairs as
input number of symbols. This step does nothing.
Expand All @@ -82,4 +99,4 @@ Example:
|state|input|output | next state|
|[]|[(A, 1), (B, 1), (C, 1), (D, 1)]|[(A, 1), (B, 1)]|[(C, 1), (D, 1)]|
|state|input|output | next state|
|[(C, 1), (D, 1)]|ignored|[(C, 1), (D, 1)]|[]|
|[(C, 1), (D, 1)]|ignored|[(C, 1), (D, 1)]|[]|
5 changes: 0 additions & 5 deletions xls/modules/rle/rle_enc_adv.x
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ proc ConsumeMultipleSymbolRepetitionsAtOnce {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -273,7 +272,6 @@ proc ConsumeMultipleSymbolsAtOnce {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -344,7 +342,6 @@ proc ConsumePacketWithInvalidSymbols {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -411,7 +408,6 @@ proc ConsumePacketWithAllDiffSymbols {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -480,6 +476,5 @@ proc ConsumePacketsWhereLastSymbolRepeats {
}(tok);

send(tok, terminator, true);
()
}
}
6 changes: 0 additions & 6 deletions xls/modules/rle/rle_enc_adv_adjust_width_stage.x
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ proc PacketContainsOnlyLast {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -275,7 +274,6 @@ proc InputPairCountLessOrEqualOutputWidth {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -342,7 +340,6 @@ proc InputFullyFilled {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -412,7 +409,6 @@ proc CombineStateWithNextInputPairs {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -486,7 +482,6 @@ proc PairStateCombineWithStateUpdate {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -558,6 +553,5 @@ proc NoStateSipllAfterLast {
}(tok);

send(tok, terminator, true);
()
}
}
6 changes: 0 additions & 6 deletions xls/modules/rle/rle_enc_adv_core.x
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ proc PacketOnlyWithLastSet {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -358,7 +357,6 @@ proc CombineWithoutOverflow {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -437,7 +435,6 @@ proc CombineWithOverflow {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -518,7 +515,6 @@ proc CombineAfterStateChange {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -593,7 +589,6 @@ proc CombineStateWithLastPacket {
}(tok);

send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -664,6 +659,5 @@ proc NoStateSipllAfterLast {
}(tok);

send(tok, terminator, true);
()
}
}
5 changes: 0 additions & 5 deletions xls/modules/rle/rle_enc_adv_realign_stage.x
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ pub proc RunLengthEncoderAdvancedRealignStage<
}
} ((u32:0, symbols[u32:0], counts[u32:0] != bits[COUNT_WIDTH]:0));
send(tok, output_s, (output, prop_count, end));
()
}
}

Expand Down Expand Up @@ -175,7 +174,6 @@ proc RunLengthEncoderAdvancedRealignStageNoPairs {
(tok)
}(tok);
send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -250,7 +248,6 @@ proc RunLengthEncoderAdvancedRealignStageAllPairsFilled {
(tok)
}(tok);
send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -325,7 +322,6 @@ proc RunLengthEncoderAdvancedRealignStageFarAwayPair {
(tok)
}(tok);
send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -400,6 +396,5 @@ proc RunLengthEncoderAdvancedRealignStagePropagataion {
(tok)
}(tok);
send(tok, terminator, true);
()
}
}
5 changes: 0 additions & 5 deletions xls/modules/rle/rle_enc_adv_reduce_stage.x
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ pub proc RunLengthEncoderAdvancedReduceStage<
let not_empty = input.last ||
or_reduce(std::convert_to_bits_msb0(input.symbol_valids));
send_if(tok, output_s, not_empty, output);
()
}
}

Expand Down Expand Up @@ -172,7 +171,6 @@ proc RunLengthEncoderAdvancedReduceStageNoSymbols {
(tok)
}(tok);
send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -239,7 +237,6 @@ proc RunLengthEncoderAdvancedReduceStageNonRepeatingSymbols {
(tok)
}(tok);
send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -306,7 +303,6 @@ proc RunLengthEncoderAdvancedReduceStageRepeatingSymbolsNoOverflow {
(tok)
}(tok);
send(tok, terminator, true);
()
}
}

Expand Down Expand Up @@ -373,6 +369,5 @@ proc RunLengthEncoderAdvancedReduceStageRepeatingSymbolsOverflow {
(tok)
}(tok);
send(tok, terminator, true);
()
}
}

0 comments on commit d28d81b

Please sign in to comment.