blob: ab1056f45909225537894787c902dea9948545f9 (
plain)
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
|
library ieee;
entity register_file is
port (
CLK: in std_logic;
WRITE: in std_logic;
R1, R2, W: in std_logic_vector(4 downto 0);
WD: in std_logic_vector(31 downto 0);
RD1, RD2: out std_logic_vector(31 downto 0);
)
end entity;
architecture Behavioral of register_file is
type reg_file_type is array (0 to 31) of std_logic_vector(31 downto 0);
signal reg_file: reg_file_type := (others => '0');
begin
process (CLK)
begin
if rising_edge(CLK) then
begin
if WRITE then
reg_file(W) <= WD;
end;
RD1 <= reg_file(R1);
RD2 <= reg_file(R2);
end;
end;
end architecture;
|