This project involves the implementation of Hamming Code in Verilog. The project includes three main components: a Hamming Code Generator/Encoder, a Hamming Code Decoder, and a Hamming Code Correction module. Each component is tested using corresponding testbenches. The Parity is either or Odd/Even is defined by the input we gave (i.e., parity_type = 1 for Odd, parity_type = 0 for Even) .
- Hamming Code Representation
- Files in the Project
- Hamming Code Generator/Encoder
- Hamming Code Decoder
- Hamming Code Correction
- Testbenches
- How to Run
- Contributors
The Hamming Code uses a specific bit pattern for error detection and correction. The 7-bit Hamming Code is represented as follows:
Code | H7 | H6 | H5 | H4 | H3 | H2 | H1 |
---|---|---|---|---|---|---|---|
Position | D4 | D3 | D2 | P3 | D1 | P2 | P1 |
Bit | 1 | 1 | 0 | 0 | 1 | 0 | 0 |
Where:
- D represents data bits.
- P represents parity bits.
The project consists of the following files:
hamming_code_encoder.v
- Hamming Code Generator/Encoderhamming_code_decoder.v
- Hamming Code Decoderhamming_error_correction.v
- Hamming Code Correction
hamming_encode_tb.v
- Testbench for the Encoderhamming_decode_tb.v
- Testbench for the Decoderhamming_error_correction_tb.v
- Testbench for the Correction module
The Hamming Code Generator/Encoder takes 4 message bits and outputs a 7-bit Hamming Code. It adds parity bits to the original message bits to form the Hamming Code.
message_bits
: 4-bit input message
hamming_code
: 7-bit Hamming Code
The Hamming Code Decoder takes a 7-bit Hamming Code as input and produces the corrected 4-bit message bits as output. An error falg raises when there is error, if there is no error it is in LOW state.
hamming_code
: 7-bit Hamming Code
corrected_message
: 4-bit corrected message
The Hamming Code Correction module takes a 7-bit Hamming Code with an error and rectifies the error to produce the correct 7-bit Hamming Code. It raises an error falg when there is an error in code, if not it is in LOW.
error_hamming_code
: 7-bit Hamming Code with an error
corrected_hamming_code
: 7-bit corrected Hamming Code
To run the testbenches and verify the design, use a Verilog simulator such as ModelSim or any other preferred Verilog simulation tool. Follow these steps:
- Compile the design files and testbench files.
- Run the simulation for each testbench.
- Verify the outputs against the expected results.
© 2024 Sai Naresh Padakanti