-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.v
72 lines (72 loc) · 1.19 KB
/
controller.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
module controller (
clk,
reset,
Instr,
ALUFlags,
PCWrite,
MemWrite,
RegWrite,
IRWrite,
AdrSrc,
RegSrc,
ALUSrcA,
ALUSrcB,
ResultSrc,
ImmSrc,
ALUControl
);
input wire clk;
input wire reset;
input wire [31:12] Instr;
input wire [3:0] ALUFlags;
output wire PCWrite;
output wire MemWrite;
output wire RegWrite;
output wire IRWrite;
output wire AdrSrc;
output wire [1:0] RegSrc;
output wire [1:0] ALUSrcA;
output wire [1:0] ALUSrcB;
output wire [1:0] ResultSrc;
output wire [1:0] ImmSrc;
output wire [1:0] ALUControl;
wire [1:0] FlagW;
wire PCS;
wire NextPC;
wire RegW;
wire MemW;
decode dec(
.clk(clk),
.reset(reset),
.Op(Instr[27:26]),
.Funct(Instr[25:20]),
.Rd(Instr[15:12]),
.FlagW(FlagW),
.PCS(PCS),
.NextPC(NextPC),
.RegW(RegW),
.MemW(MemW),
.IRWrite(IRWrite),
.AdrSrc(AdrSrc),
.ResultSrc(ResultSrc),
.ALUSrcA(ALUSrcA),
.ALUSrcB(ALUSrcB),
.ImmSrc(ImmSrc),
.RegSrc(RegSrc),
.ALUControl(ALUControl)
);
condlogic cl(
.clk(clk),
.reset(reset),
.Cond(Instr[31:28]),
.ALUFlags(ALUFlags),
.FlagW(FlagW),
.PCS(PCS),
.NextPC(NextPC),
.RegW(RegW),
.MemW(MemW),
.PCWrite(PCWrite),
.RegWrite(RegWrite),
.MemWrite(MemWrite)
);
endmodule