You are on page 1of 2

Alu 8-bit

entity allu is
Port ( a : in STD_LOGIC_VECTOR (7 downto 0);
b : in STD_LOGIC_VECTOR (7 downto 0);
s : in STD_LOGIC_VECTOR (3 downto 0);
f : out STD_LOGIC_VECTOR (15 downto 0));
end allu;
architecture Behavioral of allu is
begin
process(s,a,b)
begin
if(s="0000")then
f<="0000000000000000";
else if(s<="0001")then
f<=a*b;
else if(s<="0010")then
f<=a-b;
else if(s<="0011")then
f<=a+b;
else if(s<="0100")then
f<=a or b;
else if(s<="0101")then
f<=a and b;

else if(s<="0111")then
f<=a+1;
else if(s<="1000")then
f<="1111111111111111";
end if;
end if;
end if;
end if;
end if;
end if;
end if;
end if;
end process;
end Behavioral;

You might also like