0% found this document useful (0 votes)
3 views4 pages

TP VHDL

Uploaded by

holtdelia0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

TP VHDL

Uploaded by

holtdelia0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

TP VHDL

. Conception des modules VHDL :


- Codeur/décodeur Hamming (74/84)

Library ieee;
Use ieee.std_logic_1164.all;
entity Hamming_84 is port (
d : in std_logic_vector (3 downto 0);
parité : out std_logic_vector (3 downto 0);
encodeur : out std_logic_vector (7 downto 0)
); end Hamming_Encodeur;

architecture Behavioral of Hamming_84 is


begin
- - - Codeur Hamming
process(d)
begin
encodeur(7 downto 4)<= d;
encodeur(3)<= d(0) xor d(1) xor d(3);
encodeur(5) <= d(0) xor d(2) xor d(3);
encodeur(6) <= d(1) xor d(2) xor d(3);
encodeur(4) <= encodeur(3) xor encodeur(5) xor encodeur(6);
end process ;

- - - Décodeur Hamming
process(encodeur)
begin
parité <= encodeur(3 downto 0);
end process;
end Behavioral;

Module de génération de bruit

entity Noise_Generator is port (


enable : in std_logic;
1
input: in std_logic_vector(7 downto 0);
noisy : out std_logic_vector (7 downto 0)
); end Noise_Generator;

architecture Behavioral of Noise_Generator is


begin
process(input, enable)
begin
if enable = '1' then
noisy <= input xor "0000000" & '1' & "000000";
else
noisy <= input;
end if;
end process;
end Behavioral;

-- Codeur de Priorité

entity Priorité_Encodeur is port (


syndrome : in std_logic_vector (3 downto 0);
error_position : out std_logic_vector(2 downto 0)
);
end Priorité_Encodeur;

architecture Behavioral of Priorité_Encodeur is


begin
process(syndrome)
begin
case syndrome is
when "0000" => error_position <= "000";
when "0001" => error_position <= "001";
when "0010" => error_position <= "010";
when "0011" => error_position <= "011";
when "0100" => error_position <= "100";
when "0101" => error_position <= "101";
when "0110" => error_position <= "110";
when "0111" => error_position <= "111";
when others => error_position <= "000";
end case;
end process;
end Behavioral;

-- Affichage à 7 Segments

entity 7Segment is port (


error_position : in std_logic_vector (2 downto 0);
S: out std_logic_vector (6 downto 0)
); end 7Segment;

architecture Behavioral of 7Segment is


begin
process(error_position)
begin
Case error_position is
when "000" => S <= "0000001";
when "001" => S <= "1001111";
when "010" => S <= "0010010";
when "011" => S <= "0000110";
when "100" => S <= "1001100";
when "101" => S <= "0100100";
when "110" => S <= "0100000";
when "111" => S <= "0001111";
when others => S <= "1111111";
end case;
end process;
end Behavioral;

entity Top_Module is port (


input : in std_logic_vector (3 downto 0);
enable_noise : in std_logic;
switch_error : in std_logic_vector (7 downto 0);
S : out std_logic_vector (6 downto 0)
); end Top_Module;

architecture Behavioral of Top_Module is


signal encodeur: std_logic_vector (7 downto 0);
signal encodeur: std_logic_vector (7 downto 0);
signal noisy: std_logic_vector (7 downto 0);
signal syndrome : std_logic_vector (3 downto 0);
signal error_position : std_logic_vector (2 downto 0);
begin
-- Instanciation du Codeur/Décodeur Hamming (8,4)

Hamming_Instance : entity work.Hamming_84


port map (d => input,
parité => syndrome,
encodeur => encodeur);

-- Instanciation du Module de Génération de Bruit

Noise_Instance : entity work.Noise_Generator


port map (enable => enable_noise,
input=> encodeur,
noisy => noisy);

-- Instanciation du Codeur de Priorité

Priorité_Instance : entity work.Priorité_Encodeur port map (


syndrome => syndrome,
error_position => error_position);

-- Instanciation de l'Affichage à 7 Segments

7Segment_Instance : entity work.7Segment port map (


error_position => error_position,
S => S);
end Behavioral;

You might also like