Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3.  
  4. entity CLA_module is
  5. Port ( a : in STD_LOGIC_VECTOR (2 downto 0);
  6. b : in STD_LOGIC_VECTOR (2 downto 0);
  7. Cin : in STD_LOGIC;
  8. Sum : out STD_LOGIC_VECTOR (2 downto 0);
  9. Cout : out STD_LOGIC
  10. );
  11. end CLA_module;
  12.  
  13. architecture Behavioral of CLA_module is
  14. signal P, G, Cint: std_logic_vector(2 downto 0);
  15. begin
  16. P <= a xor b;
  17. G <= a and b;
  18. Cint(0) <= Cin;
  19. Cint(1) <= (Cin and P(0)) or G(0);
  20. Cint(2) <= (Cin and P(0) and P(1)) or (G(0) and P(1)) or G(1);
  21.  
  22. Cout <= G(2) or (P(2) and G(1)) or (P(1) and P(2) and G(0)) or (P(2) and P(1) and Cin);
  23. Sum <= P xor Cint;
  24. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement