-
Notifications
You must be signed in to change notification settings - Fork 0
/
control_unit.v
63 lines (63 loc) · 1.02 KB
/
control_unit.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
`include "decode.v"
`include "condlogic.v"
module controller (
clk,
reset,
Instr,
ALUFlags,
RegSrc,
RegWrite,
ImmSrc,
ALUSrc,
ALUControl,
MemWrite,
MemtoReg,
PCSrc,
RegByte
);
input wire clk;
input wire reset;
input wire [31:12] Instr;
input wire [3:0] ALUFlags;
output wire [1:0] RegSrc;
output wire RegWrite;
output wire [1:0] ImmSrc;
output wire ALUSrc;
output wire [2:0] ALUControl;
output wire MemWrite;
output wire MemtoReg;
output wire PCSrc;
output wire RegByte;
wire [1:0] FlagW;
wire PCS;
wire RegW;
wire MemW;
decode dec(
.Op(Instr[27:26]),
.Funct(Instr[25:20]),
.Rd(Instr[15:12]),
.FlagW(FlagW),
.PCS(PCS),
.RegW(RegW),
.MemW(MemW),
.MemtoReg(MemtoReg),
.ALUSrc(ALUSrc),
.ImmSrc(ImmSrc),
.RegSrc(RegSrc),
.ALUControl(ALUControl),
.RegByte(RegByte)
);
condlogic cl(
.clk(clk),
.reset(reset),
.Cond(Instr[31:28]),
.ALUFlags(ALUFlags),
.FlagW(FlagW),
.PCS(PCS),
.RegW(RegW),
.MemW(MemW),
.PCSrc(PCSrc),
.RegWrite(RegWrite),
.MemWrite(MemWrite)
);
endmodule