
This design is a hardware implementation of the Bose-Chaudhuri-Hocquenghem Code (15, 7). This is an error correction code that takes a corrupted 7-bit message and an 8-bit checksum and outputs the original message of 7-bits. The BCH (15, 7) code is capable of correcting up to 2 bitflips.
The hardware uses pipelining of 3 stages: (1) Syndrome calculation (2) Error location (3) Chien search
Running at 50 MHz clock frequency, there a latency of 3 clock cycles (60 ns) for the first valid output. The throughput is 1 corrupted message (payload) per clock cycle (20 ns). In other words, data can be streamed every clock cycle and the valid output is delayed by 3 clock cycles.
The project has 2 modes: (1) find checksum from message and (2) restore original message from corrupted message and checksum.
When the MSB of the input pins (encode_enable) is high, the lower 7-bits of the input must be the message. The output pins will be driven low and the IO pins will output the associated 8-bit checksum.
The following illustrates a simple visualisation. Here, the capital letters represents the true message whereas the lower case letters represent the corrupted message. Moreover the letters 'A' through 'G' represent the message, while the letters 'S' through 'Z' represents the checksum.
Inputs:
UI = 1ABCDEFG
Outputs:
UIO = STUVWXYZ
UO = 00000000
On the other hand, when the encode_enable pin is low, the remaining 7 input pins must be driven by the 7-bit message and the IO pin by the associated 8-bit checksum. The output pins will be the 7-bit recovered message.
Inputs:
UI = 0abcdefg
UIO = stuvwxyz
Outputs:
UO = 0ABCDEFG
No external hardware is required. LEDs may be used to visualise the inputs and outputs.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | data_in_0 | data_out_0 | parity_in_0 |
| 1 | data_in_1 | data_out_1 | parity_in_1 |
| 2 | data_in_2 | data_out_2 | parity_in_2 |
| 3 | data_in_3 | data_out_3 | parity_in_3 |
| 4 | data_in_4 | data_out_4 | parity_in_4 |
| 5 | data_in_5 | data_out_5 | parity_in_5 |
| 6 | data_in_6 | data_out_6 | parity_in_6 |
| 7 | encode_enable | parity_in_7 |