|
22 | 22 | // the last packet encoder dumps all the data to the output stream.
|
23 | 23 | // The behavior of the encoder is presented on the waveform below:
|
24 | 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. |
| 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. |
34 | 47 | // 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. |
36 | 49 | // If the output is narrower than the input,
|
37 |
| -// this stage will serialize symbol counter pairs. |
| 50 | +// this step will serialize symbol counter pairs. |
38 | 51 |
|
39 | 52 |
|
40 | 53 | import std
|
|
0 commit comments