Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3.  
  4. entity xor_gate is
  5. port(
  6. a : in std_logic;
  7. b : in std_logic;
  8. pari : in std_logic;
  9. paro : out std_logic);
  10.  
  11. end xor_gate;
  12.  
  13. architecture behavior of xor_gate is
  14. begin
  15.  
  16. paro <= (a xor b) or pari;
  17.  
  18. end behavior;
  19.  
  20. library ieee;
  21. use ieee.std_logic_1164.all;
  22. entity parity_2 is
  23.  
  24. port(a: in std_logic_vector (0 to 15);
  25. b: in std_logic_vector (0 to 15);
  26. paro: out std_logic);
  27.  
  28. end parity_2;
  29.  
  30. architecture behavior of parity_2 is
  31. signal parry: std_logic_vector (0 to 15);
  32.  
  33. component xor_gate
  34. port (a,b: in std_logic;
  35. pari: in std_logic;
  36. paro: out std_logic);
  37.  
  38. end component;
  39.  
  40. begin
  41.  
  42. c1: xor_gate port map (a(0), b(0), '0', parry(0));
  43. c: for i in 1 to 15 generate
  44. c2: xor_gate port map (parry(i-1), a(i), b(i), parry(i));
  45.  
  46. end generate;
  47.  
  48. paro <= parry(15);
  49.  
  50. end behavior;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement