forked from zhanghai/archexp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExStage.v
32 lines (24 loc) · 842 Bytes
/
ExStage.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
`timescale 1ns / 1ps
module ExStage (
input [31:0] shiftAmount,
input [31:0] immediate,
input [3:0] aluOperation, // EALUC
input shouldAluUseShiftAmountElseRegisterRsOrPc_4, // ESHIFT
input shouldAluUseImmeidateElseRegisterRtOrZero, // EALUIMM
input [31:0] registerRsOrPc_4,
input [31:0] registerRtOrZero,
output [31:0] aluOutput,
output [31:0] debug_aluInputA,
output [31:0] debug_aluInputB
);
wire [31:0] aluInputA = shouldAluUseShiftAmountElseRegisterRsOrPc_4 ? shiftAmount : registerRsOrPc_4;
wire [31:0] aluInputB = shouldAluUseImmeidateElseRegisterRtOrZero ? immediate : registerRtOrZero;
Alu alu (
.inputA(aluInputA[31:0]),
.inputB(aluInputB[31:0]),
.operation(aluOperation[3:0]),
.output_(aluOutput[31:0])
);
assign debug_aluInputA = aluInputA;
assign debug_aluInputB = aluInputB;
endmodule