Advertisement
CoMoDoS

lab4sumatorvhdl

Mar 23rd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.33 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 03/23/2018 02:35:36 PM
  6. -- Design Name:
  7. -- Module Name: sum8b - 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 sum8b is
  35.  Port (
  36.         x: in std_logic_vector(7 downto 0);
  37.         y:in std_logic_vector(7 downto 0);
  38.         tin: in std_logic;
  39.         tout : out std_logic;
  40.         sum: out std_logic_vector(7 downto 0)  );
  41. end sum8b;
  42.  
  43. architecture Behavioral of sum8b is
  44. signal G01,G23,G45,G67: std_logic;
  45. signal P01,P23,P45,P67: std_logic;
  46. signal S0, S1, S2, S3: STD_LOGIC_VECTOR(1 downto 0);
  47. signal T0,T2,T4,T6,T8:std_logic;
  48. begin
  49. sum_S0: entity WORK.sum2b port map(
  50.                 x => x(1 downto 0),
  51.                 y => y(1 downto 0),
  52.                 tin => tin,
  53.                 sum=> S0,
  54.                 P => P01,
  55.                 G => G01);
  56.  
  57. sum_S1: entity WORK.sum2b port map(
  58.                 x => x(3 downto 2),
  59.                 y => y(3 downto 2),
  60.                 tin => T2,
  61.                 sum=> S1,
  62.                 P => P23,
  63.                 G => G23);
  64.                  
  65. sum_S2: entity WORK.sum2b port map(
  66.                 x => x(5 downto 4),
  67.                 y => y(5 downto 4),
  68.                 tin => T4,
  69.                 sum=> S2,
  70.                 P => P45,
  71.                 G => G45);
  72.                
  73. sum_S3: entity WORK.sum2b port map(
  74.                x => x(7 downto 6),
  75.                y => y(7 downto 6),
  76.                tin => T6,
  77.                sum=> S3,
  78.                P => P67,
  79.                G => G67);
  80.  
  81. T2 <= G01 or (P01 and tin);      
  82. T4 <= G23 or ( P23 and T2  );
  83. T6 <= G45 or ( P45 and T4  );
  84. T8 <= G67 or ( P67 and T6  );
  85.  
  86. sum<=S3 & S2 & S1 & S0;
  87.  
  88. Tout <= T8;
  89.  
  90. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement