Hamming Code Encoder
Implement a Hamming (7,4) encoder and a decoder that corrects any single-bit error and reports the corrected position.
Constraints
- 4 data bits in, 7 code bits out.
- Parity bits at positions 1, 2 and 4.
- Decoder returns the corrected data and the syndrome.
- A syndrome of zero means no error.
- Must correct exactly one bit error.
- Purely combinational.
1library ieee;2use ieee.std_logic_1164.all;3 4entity hamming74 is5 port (6 data_in : in std_logic_vector(3 downto 0);7 code_out : out std_logic_vector(6 downto 0)8 );9end hamming74;