-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFINAL_EXP_CALCULATOR.vhd
More file actions
50 lines (42 loc) · 1.15 KB
/
Copy pathFINAL_EXP_CALCULATOR.vhd
File metadata and controls
50 lines (42 loc) · 1.15 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
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity FINAL_EXP_CALCULATOR is
port (
EXP : in STD_LOGIC_VECTOR(9 downto 0);
OFFSET : in STD_LOGIC_VECTOR(4 downto 0);
SUB : in STD_LOGIC;
S : out STD_LOGIC_VECTOR(9 downto 0)
);
end entity;
architecture RTL of FINAL_EXP_CALCULATOR is
component CLA_10 is
port (
X, Y : in std_logic_vector(9 downto 0);
Cin : in std_logic;
S : out std_logic_vector(9 downto 0);
Cout : out std_logic
);
end component;
signal OFFSET_10 : std_logic_vector(9 downto 0);
signal OFFSET_TO_ADD : std_logic_vector(9 downto 0);
signal EXTENDED_SUB : std_logic_vector(9 downto 0);
signal SUB_SIG : std_logic;
signal S_SIG : std_logic_vector(9 downto 0);
begin
OFFSET_10 <= "00000" & OFFSET; -- pad with 0s
EXTENDED_SUB <= (others => SUB);
OFFSET_TO_ADD <= EXTENDED_SUB xor OFFSET_10;
SUB_SIG <= SUB;
compute: process (S_SIG)
begin
S <= S_SIG;
end process;
adder: CLA_10
port map (
X => EXP,
Y => OFFSET_TO_ADD,
S => S_SIG,
Cin => SUB_SIG,
Cout => open
);
end architecture;