-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.v
50 lines (44 loc) · 1.13 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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2024/07/04 17:41:24
// Design Name:
// Module Name: controller
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module controller(
input [31:0]instr, //regwrite regsrc memread memwrite pc_rs1_sel branch alusrc alucontrol(4)immsel(3) 共14位
output [13:0]sigs
);
wire [1:0]aluop;
main_control main_control(
.opcode(instr[6:2]),
.f3(instr[14:12]),
.aluop(aluop),
.regwrite(sigs[0]),
.regsrc(sigs[1]),
.memread(sigs[2]),
.memwrite(sigs[3]),
.pc_rs1_sel(sigs[4]),
.branch(sigs[5]),
.alusrc(sigs[6]),
.immsel(sigs[13:11])
);
alu_control alu_control(
.aluop(aluop),
.f4({instr[30],instr[14:12]}),
.alucontrol(sigs[10:7])
);
endmodule