-
Notifications
You must be signed in to change notification settings - Fork 0
/
reg_unit.vhd
74 lines (63 loc) · 2.71 KB
/
reg_unit.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---------------------------------------------------------------------------
-- reg_unit.vhd --
-- Raj Vinjamuri --
-- 3-13 --
-- --
-- Purpose/Description: --
-- combines the registers to be used as simply as we desire the I/O --
-- --
-- based on register unit given by UIUC --
-- Final Modifications by Raj Vinjamuri and Sai Koppula --
-- --
-- --
-- Updates: --
-- --
-- >3.10: Made components lower case --
-- >changed A and B to SR and PR respectively --
-- >fixed 7 downto 0 to 10 downto 0 --
---------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity reg_unit is
Port ( Clk : in std_logic;
ClrSR, ClrPR : in std_logic;
D_In : in std_logic_vector(10 downto 0);
SR_In : in std_logic;
Ld_SR : in std_logic;
Ld_PR : in std_logic;
Shift_En : in std_logic;
SR_out : out std_logic;
PR_out : out std_logic;
SR : out std_logic_vector(10 downto 0);
PR : out std_logic_vector(10 downto 0));
end reg_unit;
architecture Behavioral of reg_unit is
component reg_11 is
Port ( Clk, Reset, Shift_In, Load, Shift_En : in std_logic;
D : in std_logic_vector(10 downto 0);
Shift_Out : out std_logic;
Data_Out : out std_logic_vector(10 downto 0));
end component reg_11;
signal shift_line : std_logic;
begin --connecting both registers so one feeds the other
scan_reg: reg_11
port map( Clk => Clk,
Reset => ClrSR,
D => D_In,
Shift_In => SR_in,
Load => Ld_SR,
Shift_En => Shift_En,
Shift_Out => shift_line,
Data_Out => SR);
prev_reg: reg_11
port map( Clk => Clk,
Reset => ClrPR,
D => D_In,
Shift_In => shift_line,
Load => Ld_PR,
Shift_En => Shift_En,
Shift_Out => PR_out,
Data_Out => PR);
end Behavioral;