Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.48 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 03/21/2018 12:27:21 PM
  6. -- Design Name:
  7. -- Module Name: sum_2biti - 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 sum_2biti is
  35.     Port ( x : in STD_LOGIC_VECTOR (1 downto 0);
  36.            y : in STD_LOGIC_VECTOR (1 downto 0);
  37.            S : out STD_LOGIC_VECTOR (1 downto 0);
  38.            Tin : in STD_LOGIC;
  39.            Pout : out STD_LOGIC;
  40.            Gout : out STD_LOGIC);
  41. end sum_2biti;
  42.  
  43. architecture Behavioral of sum_2biti is
  44. signal g, p : STD_LOGIC_VECTOR(1 downto 0);
  45. begin
  46.     gp_process: process(x, y, Tin)
  47.     begin
  48.         for i in 1 downto 0 loop
  49.            g(i) <= x(i) AND y(i);
  50.            p(i) <= x(i) OR y(i);
  51.         end loop;
  52.     end gp_process;
  53.    
  54.     Gout <= g(1) OR p(1) AND g(0);
  55.     Pout <= p(1) AND p(0);
  56.    
  57.    
  58.  
  59. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement