Professional Documents
Culture Documents
ALU Project
ALU Project
library ieee;
use ieee.std_logic_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
entity parta is
Port (
CIN : in STD_LOGIC;
);
end parta;
begin
process(A, B, S, CIN)
begin
case S is
F <= A;
else
F <= A+1;
end if;
F <= A+B;
else
F <= A+B+1;
end if;
F <= A-B-1;
else
F <= A-B;
end if;
F<= A-1;
else
F <= "0000000000000000";
end if;
F<= "0000000000000000";
end case;
end process;
end Behavioral;
wave Form for Part A:
operation F=A:
Operation F=A+b:
Operation F=A-B-1:
Operation F=A-1:
Operation F=A+1:
Operation F=A+B+1:
Operation F=A-B:
Operation F=0:
All parts code:
library ieee;
use ieee.std_logic_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
entity ALU is
Port (
CIN : in STD_LOGIC;
);
end ALU;
COMPONENT partc
PORT(
);
END COMPONENT;
COMPONENT partd
PORT(
CIN : in STD_LOGIC;
);
END COMPONENT;
COMPONENT partb
PORT(
);
END COMPONENT;
COMPONENT parta
PORT(
CIN : IN STD_LOGIC;
F : OUT std_logic_vector(15 downto 0)
);
END COMPONENT;
begin
A => A,
F => F_D
);
A => A,
B => B,
F => F_A
);
A => A,
B => B,
F => F_B
);
uut_C: partc PORT MAP (
A => A,
F => F_C
);
begin
F<= F_A;
F<= F_B;
F<= F_C;
F<= F_D ;
F<= "0000000000000000";
end case;
end process ;
end Behavioral;