Advertisement
CoMoDoS

lab4sumator2biti

Mar 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.55 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 03/23/2018 02:20:45 PM
  6. -- Design Name:
  7. -- Module Name: sum2b - 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 sum2b is
  35. Port (    
  36.            x : in std_logic_vector(1 downto 0);
  37.            y: in std_logic_vector(1 downto 0);
  38.            tin: in std_logic;
  39.            sum : out std_logic_vector(1 downto 0);
  40.            P : out std_logic;
  41.            G : out std_logic);
  42. end sum2b;
  43.  
  44.  
  45. architecture Behavioral of sum2b is
  46.  
  47. signal pp : std_logic_vector(1 downto 0);
  48. signal qq : std_logic_vector(1 downto 0);
  49.  
  50. signal t0 : std_logic;
  51.  
  52.  
  53. begin
  54.  
  55. qq(0) <= x(0) and y(0);
  56. qq(1) <= x(1) and y(0);
  57.  
  58. pp(0) <= x(0) or y(0);
  59. pp(1) <= x(1) or y(1);
  60.  
  61.  
  62. sum(0) <= x(0) xor y(0) xor tin;
  63. sum(1) <= x(1) xor y(1) xor tin;
  64.  
  65. P <= pp(0) or pp(1);
  66. G <= qq(1) or (pp(1) and qq(0));
  67.  
  68. t0 <= qq(0) or (pp(0) and tin);
  69.  
  70. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement