-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMEM_Reg.v
35 lines (31 loc) · 829 Bytes
/
MEM_Reg.v
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
`include "settings.h"
module MEM_Reg
(
input clk,
input rst,
input [`REG_FILE_DEPTH-1:0] dst,
input [`WORD_WIDTH-1:0] ALU_res,
input [`WORD_WIDTH-1:0] mem,
input mem_read, WB_en,
output reg [`REG_FILE_DEPTH-1:0] dst_out,
output reg [`WORD_WIDTH-1:0] ALU_res_out,
output reg [`WORD_WIDTH-1:0] mem_out,
output reg mem_read_out, WB_en_out
);
always @(posedge clk, posedge rst) begin
if(rst) begin
dst_out <= 0;
ALU_res_out <= 0;
mem_out <= 0;
mem_read_out <= 0;
WB_en_out <= 0;
end
else begin
dst_out <= dst;
ALU_res_out <= ALU_res;
mem_out <= mem;
mem_read_out <= mem_read;
WB_en_out <= WB_en;
end
end
endmodule