-
Notifications
You must be signed in to change notification settings - Fork 0
/
ALUDecoder.vhd
49 lines (44 loc) · 1 KB
/
ALUDecoder.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
-- The ALU Decoder
entity ALUDecoder is
port(
opcode_5 : in std_logic;
funct3: in std_logic_vector(2 downto 0);
funct7_5 : in std_logic;
ALUOp : in std_logic_vector(1 downto 0);
ALUControl: out std_logic_vector(2 downto 0));
end;
architecture Behavioural of ALUDecoder is
signal temp: std_logic_vector(1 downto 0);
begin
process(opcode_5, funct3, funct7_5, ALUOp) is
begin
case ALUOp is
when "00" =>
ALUControl <= "000";
when "01" =>
ALUControl <= "001";
when "10" =>
case funct3 is
when "000" =>
temp <= opcode_5 & funct7_5;
case temp is
when "11" =>
ALUControl <= "001";
when others =>
ALUControl <= "000";
end case;
when "010" =>
ALUControl <= "101";
when "110" =>
ALUControl <= "011";
when "111" =>
ALUControl <= "010";
when others =>
end case;
when others =>
end case;
end process;
end;