Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 10/23/2019 04:15:52 PM
  6. -- Design Name:
  7. -- Module Name: rippleCarryAdder - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool Versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20.  
  21.  
  22. library IEEE;
  23. use IEEE.STD_LOGIC_1164.ALL;
  24.  
  25. -- Uncomment the following library declaration if using
  26. -- arithmetic functions with Signed or Unsigned values
  27. --use IEEE.NUMERIC_STD.ALL;
  28.  
  29. -- Uncomment the following library declaration if instantiating
  30. -- any Xilinx leaf cells in this code.
  31. --library UNISIM;
  32. --use UNISIM.VComponents.all;
  33.  
  34. entity rippleCarryAdder is
  35. GENERIC (N : INTEGER:=4);
  36. Port ( A : in STD_LOGIC_VECTOR(N-1 downto 0);
  37. B : in STD_LOGIC_VECTOR(N-1 downto 0);
  38. Cin : in STD_LOGIC;
  39. S : out STD_LOGIC_VECTOR(N-1 downto 0);
  40. Cout : out STD_LOGIC);
  41. end rippleCarryAdder;
  42.  
  43. architecture Behavioral of rippleCarryAdder is
  44.  
  45. signal carry_out: std_logic_vector(N downto 0);
  46.  
  47. component fullAdder1 iS
  48. GENERIC(N : INTEGER);
  49. Port ( A : in STD_LOGIC;
  50. B : in STD_LOGIC;
  51. Cin : in STD_LOGIC;
  52. S : out STD_LOGIC;
  53. Cout : out STD_LOGIC);
  54. end component;
  55.  
  56. begin
  57. fullA: FOR k IN N-1 downto 0 GENERATE
  58. ca: fullAdder1
  59. GENERIC MAP( N => 4)
  60. port map ( A(K), B(K),carry_out(k), s(k), carry_out(k+1));
  61. end GENERATE fullA;
  62.  
  63. carry_out(0) <= cin;
  64. cout <= carry_out(N);
  65.  
  66. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement