You are on page 1of 1

EJERCICIO CLASE 3 SUMADOR:

--un sumador sin signo generico de N bits

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity adder is
generic(N : natural :=8);
port(
     x0 : in std_logic_vector(N-1 downto 0);
     x1 : in std_logic_vector(N-1 downto 0);
     y  : out std_logic_vector(N downto 0)
);
end adder;
architecture arq_sum of adder is
signal aux0 : unsigned(N downto 0);
signal aux1 : unsigned(N downto 0);
begin
aux0 <= '0' & unsigned(x0);
aux1 <= '0' & unsigned(x1);
y<= std_logic_vector(aux0 + aux1);
end arq_sum;

You might also like