-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsign_extend.vhd
More file actions
executable file
·40 lines (30 loc) · 912 Bytes
/
sign_extend.vhd
File metadata and controls
executable file
·40 lines (30 loc) · 912 Bytes
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
----------------------------------------------------------------------------------
-- sign extend 6 bits from IR-->SE DRS_B
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
entity sign_extend is
port(AD:in std_logic_vector(5 downto 0);
se_bits:out std_logic_vector(15 downto 0)
);
end sign_extend;
architecture Behavioral of sign_extend is
signal msb:std_logic;
begin
msb<=AD(5);
se_bits(2 downto 0)<=AD(2 downto 0);
se_bits(5 downto 3)<=AD(5 downto 3);
se_bits(15)<=msb;
se_bits(14)<=msb;
se_bits(13)<=msb;
se_bits(12)<=msb;
se_bits(11)<=msb;
se_bits(10)<=msb;
se_bits(9)<=msb;
se_bits(8)<=msb;
se_bits(7)<=msb;
se_bits(6)<=msb;
end Behavioral;