-
Notifications
You must be signed in to change notification settings - Fork 0
/
ALUControl.vhd
29 lines (27 loc) · 881 Bytes
/
ALUControl.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity ALUControl is
Port ( Instruction : in STD_LOGIC_VECTOR (5 downto 0);
ALUOp : in STD_LOGIC_VECTOR (1 downto 0);
Cntrl : out STD_LOGIC_VECTOR (2 downto 0));
end ALUControl;
architecture Behavioral of ALUControl is
begin
process(ALUOp, Instruction)
begin
case ALUOp is
when "00" => Cntrl <= "010"; --forza una suma
when "01" => Cntrl <= "110"; --forza una resta
when "10" => --checa la instruccion
case Instruction is
when "100000" => Cntrl <= "010"; --suma
when "100010" => Cntrl <= "110"; --resta
when "100100" => Cntrl <= "000"; --and
when "100101" => Cntrl <= "001"; --or
when "101010" => Cntrl <= "111"; --slt
when others => Cntrl <= "XXX";
end case;
when others => Cntrl <="XXX";
end case;
end process;
end Behavioral;