
An 8-bit LFSR (polynomial x^8 + x^6 + x^5 + x^4 + 1, taps on bits 7, 5, 4 and 3) generates a pseudo-random sequence. The lower 4 bits of the LFSR state pass through a 4-bit S-box (a permutation of the 16 values), and the result is shown on uo[3:0].
0xAC.LOAD_SEED (ui[0]) is high on a clock edge, the LFSR loads the value on uio[7:0]. A seed of 0x00 is replaced by 0xAC, because zero would lock the LFSR.NEXT_CODE (ui[1]) is high on a clock edge, the LFSR advances one step.This is an educational design and is not cryptographically secure.
rst_n low), then release it. uo[3:0] shows 0x4.NEXT_CODE for one clock cycle. uo[3:0] changes to 0xE.uio[7:0], pulse LOAD_SEED, and check the new code.None. LEDs on uo[3:0] are optional.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | LOAD_SEED | CODE0 | SEED0 |
| 1 | NEXT_CODE | CODE1 | SEED1 |
| 2 | CODE2 | SEED2 | |
| 3 | CODE3 | SEED3 | |
| 4 | SEED4 | ||
| 5 | SEED5 | ||
| 6 | SEED6 | ||
| 7 | SEED7 |