-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol.v
84 lines (81 loc) · 1.38 KB
/
control.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
74
75
76
77
78
79
80
81
82
83
84
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:46:12 06/14/2022
// Design Name:
// Module Name: control
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module control(
input [1:0] opcode,
output reg Branch,
output reg MemtoReg,
output reg MemRead,
output reg MemWrite,
//output reg ALUOP,
output reg ALUSrc,
output reg RegWrite,
output reg RegDst
);
always @(opcode)
begin
case(opcode)
2'b00:
begin
Branch <= 0;
MemtoReg <= 0;
MemRead <= 0;
MemWrite <= 0;
//ALUOP<= 1;
ALUSrc <= 0;
RegWrite <= 1;
RegDst <= 1;
end
2'b01:
begin
Branch <= 0;
MemtoReg <= 1;
MemRead <= 1;
MemWrite <= 0;
//ALUOP <= 1;
ALUSrc <= 1;
RegWrite<= 1;
RegDst <= 0;
end
2'b10:
begin
Branch <= 0;
MemtoReg <= 1; // x
MemRead <= 0;
MemWrite<= 1;
//ALUOP <= 0;
ALUSrc <= 1;
RegWrite <= 0;
RegDst<= 1; // x
end
2'b11:
begin
Branch<= 1;
MemtoReg <= 1; // x
MemRead<= 0;
MemWrite <= 0;
//ALUOP <= 0;
ALUSrc<= 0;
RegWrite<= 0;
RegDst <= 1; // x
end
endcase
end
endmodule