-
Notifications
You must be signed in to change notification settings - Fork 0
/
ID_EX.v
73 lines (60 loc) · 1.32 KB
/
ID_EX.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
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
73
`timescale 1ns / 1ps
module ID_EX
(
input clk,
input hit,
input [31:0]ReadData1,
input [31:0]ReadData2,
input [31:0]SignExtendImmediate,
input RegDst,
input ALUSrc,
input MemtoReg,
input RegWrite,
input MemRead,
input MemWrite,
input Branch,
input [2:0]ALUOp,
input[4:0] rd,
input[4:0] rt,
input [5:0]funct,
input [31:0]nextPC,
output reg hitOut,
output reg[31:0]ReadData1Out,
output reg [31:0]ReadData2Out,
output reg [31:0]SignExtendImmediateOut,
output reg RegDstOut,
output reg ALUSrcOut,
output reg MemtoRegOut,
output reg RegWriteOut,
output reg MemReadOut,
output reg MemWriteOut,
output reg BranchOut,
output reg [2:0]ALUOpOut,
output reg[4:0]rdOut,
output reg[4:0]rtOut,
output reg[5:0]functOut,
output reg[31:0]nextPCOut
);
always@(hit) begin
hitOut = hit;
end
always@(negedge clk) begin
if(hit) begin
ReadData1Out <= ReadData1;
ReadData2Out <= ReadData2;
SignExtendImmediateOut <= SignExtendImmediate;
functOut <= funct;
ALUSrcOut <= ALUSrc;
RegDstOut <= RegDst;
MemtoRegOut <= MemtoReg;
RegWriteOut <= RegWrite;
MemReadOut <= MemRead;
MemWriteOut <= MemWrite;
nextPCOut <= nextPC;
BranchOut <= Branch;
ALUOpOut <= ALUOp;
rdOut <= rd;
rtOut <= rt;
end
end
endmodule