-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunctionalUnit.vhd
More file actions
executable file
·69 lines (49 loc) · 1.54 KB
/
functionalUnit.vhd
File metadata and controls
executable file
·69 lines (49 loc) · 1.54 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
----------------------------------------------------------------------------------
--Funtional Unit
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity functionalUnit is
port(A,B: in std_logic_vector(15 downto 0);
FSIN: in std_logic_vector(4 downto 0);
Z: out std_logic_vector(15 downto 0);
nf:out std_logic;
zf:out std_logic;
ovf:out std_logic;
cout: out std_logic
);
end functionalUnit;
architecture Behavioral of functionalUnit is
component ALU
port(A,B: in std_logic_vector(15 downto 0);
s0,s1,cin,s2:in std_logic;
nf:out std_logic;
zf:out std_logic;
ovf:out std_logic;
cout: out std_logic;
Gout: out std_logic_vector(15 downto 0)
);
end component;
component shifterUnit
port( B: in std_logic_vector(15 downto 0);
Hselect: in std_logic_vector(1 downto 0);
H:out std_logic_vector(15 downto 0)
);
end component;
component mux_16bit
port ( in0 : in std_logic_vector(15 downto 0);
in1 : in std_logic_vector(15 downto 0);
s : in std_logic;
Z : out std_logic_vector(15 downto 0));
end component;
signal ALU_OUT, SHIFT_OUT: std_logic_vector(15 downto 0);
signal carry_out:std_logic;
begin
arithmetic:ALU
port map(A,B,FSIN(1),FSIN(2),FSIN(0),FSIN(3),nf,zf,ovf,cout,ALU_OUT );
shifter:shifterUnit
port map(B,FSIN(3 downto 2),SHIFT_OUT) ;
--output of ALU and the shifter unit is the input to the MUX F and its output is the input to MUX D.
MUX_F:mux_16bit
port map(ALU_OUT,SHIFT_OUT,FSIN(4),Z);
end Behavioral;