Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3.  
  4. entity ripple_adder is
  5. port( input_1 : in STD_LOGIC_VECTOR(3 downto 0);
  6. input_2 : in STD_LOGIC_VECTOR(3 downto 0);
  7. o_sum : out STD_LOGIC_VECTOR(3 downto 0);
  8. o_carry : out STD_LOGIC);
  9. end ripple_adder;
  10. architecture STRUCTURAL of ripple_adder is
  11. component full_adder is
  12. port( i_carry: in STD_LOGIC;
  13. i_1 : in STD_LOGIC;
  14. i_2 : in STD_LOGIC;
  15. o_sum : out STD_LOGIC;
  16. o_carry : out STD_LOGIC);
  17. end component;
  18. signal c0,c1,c2,c3 :std_logic ;
  19. begin
  20.  
  21. FA1 : full_adder port map (i_carry => '0' ,
  22. i_1=> input_1(0) ,
  23. i_2 => input_2(0),
  24. o_sum=> o_sum(0) ,
  25. o_carry => c0 ) ;
  26. FA2 : full_adder port map (
  27. i_carry =>c0 ,
  28. i_1=> input_1(1) ,
  29. i_2 => input_2(1) ,
  30. o_sum=> o_sum(1),
  31. o_carry => c1 ) ;
  32.  
  33. FA3 : full_adder port map (i_carry =>c1 ,
  34. i_1=> input_1(2) ,
  35. i_2 => input_2(2) ,
  36. o_sum=> o_sum(2) ,
  37. o_carry => c2 ) ;
  38.  
  39. FA4 : full_adder port map (i_carry =>c2 ,
  40. i_1=> input_1(3) ,
  41. i_2 => input_2(3) ,
  42. o_sum=> o_sum(3) ,
  43. o_carry =>o_carry ) ;
  44.  
  45.  
  46. end STRUCTURAL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement