Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 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_comp2 is
  6. port
  7. ( d : in std_logic_vector (3 downto 0);
  8. q : out std_logic_vector (3 downto 0);
  9. sign : out std_logic );
  10. end dc_comp2;
  11.  
  12.  
  13.  
  14.  
  15. ARCHITECTURE behv OF dc_comp2 IS
  16. signal m0,m1,m2,m3,m4,m5,m6, m7, m8,m9,m10,m11,m12,m13,m14,m15: std_logic;
  17.  
  18.  
  19. BEGIN
  20.  
  21. m0 <= (not d(0) and not d(1) and not d(2) and not d(3));
  22. m1 <= (not d(0) and not d(1) and not d(2) and d(3));
  23. m2 <= (not d(0) and not d(1) and d(2) and not d(3));
  24. m3 <= (not d(0) and not d(1) and d(2) and d(3));
  25. m4 <= (not d(0) and d(1) and not d(2) and not d(3));
  26. m5 <= (not d(0) and d(1) and not d(2) and d(3));
  27. m6 <= (not d(0) and d(1) and d(2) and not d(3));
  28. m7 <= (not d(0) and d(1) and d(2) and d(3));
  29. m8 <= (d(0) and not d(1) and not d(2) and not d(3));
  30. m9 <= (d(0) and not d(1) and not d(2) and d(3));
  31. m10 <= (d(0) and not d(1) and d(2) and not d(3));
  32. m11 <= (d(0) and not d(1) and d(2) and d(3));
  33. m12 <= (d(0) and d(1) and not d(2) and not d(3));
  34. m13 <= (d(0) and d(1) and not d(2) and d(3));
  35. m14 <= (d(0) and d(1) and d(2) and not d(3));
  36. m15 <= (d(0) and d(1) and d(2) and d(3));
  37.  
  38.  
  39. sign <= '1' when ( m8 or m9 or m10 or m11 or m12 or m13 or m14 or m15)
  40. else '0';
  41. q(3) <= ( m8);
  42.  
  43. q(2) <= ( m4 or m5 or m6 or m7 or m12 or m9 or m10 or m11) ;
  44.  
  45. q(1) <= (m2 or m3 or m6 or m7 or m10 or m14 or m13 or m9);
  46.  
  47. q(0) <= (m1 or m3 or m5 or m7 or m9 or m11 or m13 or m15);
  48.  
  49.  
  50.  
  51. END behv;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement