ALU
ALU
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
USE ieee.std_logic_unsigned.all;
entity adder is
Port ( a : in STD_LOGIC_VECTOR (1 downto 0);
b : in STD_LOGIC_VECTOR (1 downto 0);
c : out STD_LOGIC_VECTOR (2 downto 0));
end adder;
entity mul is
Port ( a : in STD_LOGIC_VECTOR (1 downto 0);
b : in STD_LOGIC_VECTOR (1 downto 0);
c : out STD_LOGIC_VECTOR (3 downto 0));
end mul;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity min is
Port ( a : in STD_LOGIC_VECTOR (1 downto 0);
b : in STD_LOGIC_VECTOR (1 downto 0);
c : out STD_LOGIC_VECTOR (1 downto 0));
end min;
entity ALU is
Port ( a : in STD_LOGIC_VECTOR (1 downto 0);
b : in STD_LOGIC_VECTOR (1 downto 0);
s : in STD_LOGIC_VECTOR (1 downto 0);
cout : out STD_LOGIC_VECTOR (3 downto 0));
end ALU;
Begin
with s select
cout <= ('0' & outadd) when "00",
outmul when "01",
("00" & outmin) when "10",
"0000" when others;
end multiplexer;