CoMoDoS

ssc5ADDN

Apr 13th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.47 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date: 03/30/2018 03:05:32 PM
  6. -- Design Name:
  7. -- Module Name: ADDN - 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.  
  35. entity ADDN is
  36. generic (N:integer);
  37. Port (X :in std_logic_vector(N-1 downto 0);
  38.       Y:in std_logic_vector(N-1 downto 0);
  39.       Tin:in std_logic;
  40.       S:out std_logic_vector(N-1 downto 0);
  41.       OVF:out std_logic;
  42.       Tout:out std_logic);
  43. end ADDN;
  44.  
  45. architecture Behavioral of ADDN is
  46. signal T :std_logic_vector(N downto 0);
  47. begin
  48.     T(0)<=Tin;
  49.    
  50.     process(X,Y,Tin)
  51.         begin
  52.             for i in 0 to N-1 loop
  53.                 S(i)<=X(i) xor Y(i) xor T(i);
  54.                 T(i+1)<=(X(i) and Y(i)) or ((X(i) or Y(i)) and T(i));
  55.             end loop;
  56.             Tout<=T(N);
  57.             OVF<=T(N) xor T(N-1);
  58.     end process;
  59. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment