-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex_me_reg.vhd
72 lines (61 loc) · 1.71 KB
/
ex_me_reg.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
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
entity ex_me_reg is
port (
i_clk : in std_logic;
--data
i_alu_res : in std_logic_vector(15 downto 0);
i_mem_data : in std_logic_vector(15 downto 0);
--control
i_mem_to_reg : in std_logic;
i_read_mem : in std_logic;
i_write_mem : in std_logic;
i_write_reg : in std_logic;
i_rd : in std_logic_vector(3 downto 0);
--data
q_alu_res : out std_logic_vector(15 downto 0);
q_mem_data : out std_logic_vector(15 downto 0);
--control
q_mem_to_reg : out std_logic;
q_read_mem : out std_logic;
q_write_mem : out std_logic;
q_write_reg : out std_logic;
q_rd : out std_logic_vector(3 downto 0)
);
end ex_me_reg; -- ex_me_reg
architecture arch of ex_me_reg is
--data
signal reg_alu_res : std_logic_vector(15 downto 0):=(others => '0');
signal reg_mem_data : std_logic_vector(15 downto 0):=(others => '0');
--control
signal reg_mem_to_reg : std_logic:='0';
signal reg_read_mem : std_logic:='0';
signal reg_write_mem : std_logic:='0';
signal reg_write_reg : std_logic:='0';
signal reg_rd : std_logic_vector(3 downto 0):=(others => '0');
begin
process(i_clk)
begin
if (i_clk'event and i_clk = '1') then
--data
reg_alu_res <= i_alu_res;
reg_mem_data <= i_mem_data;
--control
reg_mem_to_reg <= i_mem_to_reg;
reg_read_mem <= i_read_mem;
reg_write_mem <= i_write_mem;
reg_write_reg <= i_write_reg;
reg_rd <= i_rd;
end if;
end process;
--data
q_alu_res <= reg_alu_res;
q_mem_data <= reg_mem_data;
--control
q_mem_to_reg <= reg_mem_to_reg;
q_read_mem <= reg_read_mem;
q_write_mem <= reg_write_mem;
q_write_reg <= reg_write_reg;
q_rd <= reg_rd;
end arch;