-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathex_mem.v
40 lines (38 loc) · 956 Bytes
/
ex_mem.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
36
37
38
39
40
/* ex_mem.v */
module ex_mem(
input wire [1:0] ctlwb_out,
input wire [2:0] ctlm_out,
input wire [31:0] adder_out,
input wire aluzero,
input wire [31:0] aluout, readdat2,
input wire [4:0] muxout,
output reg [1:0] wb_ctlout,
output reg branch, memread, memwrite,
output reg [31:0] add_result,
output reg zero,
output reg [31:0] alu_result, rdata2out,
output reg [4:0] five_bit_muxout
);
initial begin
// Initialize outputs to 0
wb_ctlout <= 0;
branch <= 0; memread <= 0; memwrite <= 0;
add_result <= 0;
zero <= 0;
alu_result <= 0; rdata2out <= 0;
five_bit_muxout <= 0;
end
always@* begin
// Inputs wired to corresponding outputs
#1;
wb_ctlout <= ctlwb_out;
branch <= ctlm_out[2];
memread <= ctlm_out[1];
memwrite <= ctlm_out[0];
add_result <= adder_out;
zero <= aluzero;
alu_result <= aluout;
rdata2out <= readdat2;
five_bit_muxout <= muxout;
end
endmodule // ex_mem