marcoshuck

Generador HAMMING

Dec 15th, 2016
6,081
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.69 KB | None | 0 0
  1. -- Declaramos librerías
  2. library IEEE;
  3. use IEEE.STD_LOGIC_1164.ALL;
  4. use IEEE.STD_LOGIC_ARITH.ALL;
  5. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  6.  
  7. -- Definimos la entidad del generador de codigo hamming
  8. entity hamming is
  9.     Port (
  10.         B0, B1, B2, B3: in std_logic; -- Entrada de 4 bits.
  11.        
  12.         D0, D1, D2, D3: out std_logic; -- Salida de 4 bits.
  13.         P0, P1, P2: out std_logic -- Salida de codigo de paridad.
  14.         );
  15. end hamming;
  16. -- Definimos la arquitectura del generador
  17. architecture behavioral of hamming is
  18. begin
  19.     -- Bits de datos
  20.     D0 <= B0;
  21.     D1 <= B1;
  22.     D2 <= B2;
  23.     D3 <= B3;
  24.     -- Bits de paridad (redundantes)
  25.     P0 <= B3 xor B2 xor B0;
  26.     P1 <= B3 xor B1 xor B0;
  27.     P2 <= B2 xor B1 xor B0;
  28. end behavioral;
Advertisement