-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlUnit.v
More file actions
58 lines (53 loc) · 1.1 KB
/
ControlUnit.v
File metadata and controls
58 lines (53 loc) · 1.1 KB
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
module Control(
input [6:0] opcode,
output wire [1:0] ALUOp,
output reg Branch,MemRead,MemtoReg,MemWrite,ALUSrc,RegWrite
);
reg [1:0] opp;
always @(*)
begin
case(opcode)
7'b0000011:
begin
ALUSrc = 1'b1;
MemtoReg = 1'b1;
RegWrite = 1'b1;
MemRead = 1'b1;
MemWrite = 1'b0;
Branch = 1'b0;
opp = 2'b00;
end
7'b0100011:
begin
ALUSrc = 1'b1;
MemtoReg = 1'bx;
RegWrite = 1'b0;
MemRead = 1'b0;
MemWrite = 1'b1;
Branch = 1'b0;
opp = 2'b00;
end
7'b1100011:
begin
ALUSrc = 1'b0;
MemtoReg = 1'bx;
RegWrite = 1'b0;
MemRead = 1'b0;
MemWrite = 1'b0;
Branch = 1'b1;
opp = 2'b01;
end
7'b0110011:
begin
ALUSrc = 1'b0;
MemtoReg = 1'b0;
RegWrite = 1'b1;
MemRead = 1'b0;
MemWrite = 1'b0;
Branch = 1'b0;
opp = 2'b10;
end
endcase
end
assign ALUOp=opp;
endmodule