Guest User

Untitled

a guest
Jul 17th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. entity sumator is
  2. port (A,B,Ci : in bit;
  3. Co,S : out bit);
  4. end sumator;
  5.  
  6. architecture sum of sumator is
  7. begin
  8. S <= A xor B xor Ci;
  9.  
  10. process(A,B,Ci)
  11. begin
  12. if ((A xor B) = '0') then Co <= B;
  13. else Co <= Ci;
  14. end if;
  15. end process;
  16. end sum;
  17.  
  18.  
  19. entity sumator4bit is
  20. port (A,B : in bit_vector(3 downto 0);
  21. Ci : in bit;
  22. S : out bit_vector(3 downto 0);
  23. Co : out bit);
  24. end sumator4bit;
  25.  
  26. architecture sum4bit of sumator4bit is
  27.  
  28. component sumator
  29. port (A,B,Ci : in bit;
  30. Co,S : out bit);
  31. end component;
  32.  
  33. signal Internal: bit_vector(2 downto 0);
  34.  
  35. begin
  36. S1: sumator port map (A[0], B[0], Ci, Internal[0], S[0]);
  37. S2: sumator port map (A[1], B[1], Internal[0], Internal[1], S[1]);
  38. S3: sumator port map (A[2], B[2], Internal[1], Internal[2], S[2]);
  39. S4: sumator port map (A[3], B[3], Internal[2], Co, S[3]);
  40. end sum4bit
Add Comment
Please, Sign In to add comment