-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessor.v
More file actions
52 lines (46 loc) · 974 Bytes
/
processor.v
File metadata and controls
52 lines (46 loc) · 974 Bytes
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
`timescale 1ns / 1ps
module processor (
input clk,
input reset,
output [31:0] Result
);
// interconnecting sub-modules
wire [6:0] opcode;
wire [6:0] funct7;
wire [2:0] funct3;
wire [1:0] ALUOp;
wire [3:0] ALUcc;
wire ALUSrc, MemtoReg, RegWrite, MemRead, MemWrite;
// Instantiate Datapath
data_path datapath_inst (
.clk(clk),
.reset(reset),
.reg_write(RegWrite),
.mem2reg(MemtoReg),
.alu_src(ALUSrc),
.mem_write(MemWrite),
.mem_read(MemRead),
.alu_cc(ALUcc),
.opcode(opcode),
.funct7(funct7),
.funct3(funct3),
.alu_result(Result)
);
// Instantiate Controller
Controller controller_inst (
.Opcode(opcode),
.ALUSrc(ALUSrc),
.MemtoReg(MemtoReg),
.RegWrite(RegWrite),
.MemRead(MemRead),
.MemWrite(MemWrite),
.ALUOp(ALUOp)
);
// Instantiate ALUController
ALUController alucontroller_inst (
.ALUOp(ALUOp),
.Funct7(funct7),
.Funct3(funct3),
.Operation(ALUcc)
);
endmodule