Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_arith.all;
  4.  
  5. entity dc_parity is
  6. port
  7. ( d : in std_logic_vector (3 downto 0);
  8. q : out std_logic_vector (3 downto 0);
  9. f : out std_logic );
  10. end dc_parity;
  11.  
  12.  
  13.  
  14.  
  15. ARCHITECTURE behv OF dc_parity IS
  16.  
  17. signal m0, m1 , m2, m3, m4, m5, m6, m7: STD_LOGIC;
  18.  
  19. BEGIN
  20.  
  21. m0 <= not d(3) and not d(2) and not d(1);
  22. m1 <= not d(3) and not d(2) and d(1);
  23. m2 <= not d(3) and d(2) and not d(1);
  24. m3 <= not d(3) and d(2) and d(1);
  25. m4 <= d(3) and not d(2) and not d(1);
  26. m5 <= d(3) and not d(2) and d(1);
  27. m6 <= d(3) and d(2) and not d(1);
  28. m7 <= d(3) and d(2) and d(1);
  29.  
  30. q(3) <= 0;
  31. q(2) <= d(3);
  32. q(1) <= d(2);
  33. q(0) <= d(1);
  34.  
  35. f <= (1 xor d0) when (m0 or m3 or m5 or m6) else
  36. (d0);
  37.  
  38. END behv;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement