forked from joaopmarinho/Risc-v-Pipeline
-
Notifications
You must be signed in to change notification settings - Fork 1
/
RISC_V.sv
79 lines (71 loc) · 1.29 KB
/
RISC_V.sv
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
`timescale 1ns / 1ps
module riscv #(
parameter DATA_W = 32
) (
input logic clk,
reset, // clock and reset signals
output logic [31:0] WB_Data, // The ALU_Result
output logic [4:0] reg_num,
output logic [31:0] reg_data,
output logic reg_write_sig,
output logic wr,
output logic rd,
output logic [8:0] addr,
output logic [DATA_W-1:0] wr_data,
output logic [DATA_W-1:0] rd_data
);
logic [6:0] opcode;
logic ALUSrc, MemtoReg, RegWrite, MemRead, MemWrite, Branch;
logic [2:0] ALUop;
logic [1:0] JalType;
logic [2:0] ALUop_Reg;
logic [6:0] Funct7;
logic [2:0] Funct3;
logic [3:0] Operation;
logic halt;
Controller c (
opcode,
ALUSrc,
MemtoReg,
RegWrite,
MemRead,
MemWrite,
ALUop,
Branch,
JalType,
halt
);
ALUController ac (
ALUop_Reg,
Funct7,
Funct3,
Operation
);
Datapath dp (
clk,
reset,
RegWrite,
MemtoReg,
ALUSrc,
MemWrite,
MemRead,
Branch,
JalType,
halt,
ALUop,
Operation,
opcode,
Funct7,
Funct3,
ALUop_Reg,
WB_Data,
reg_num,
reg_data,
reg_write_sig,
wr,
rd,
addr,
wr_data,
rd_data
);
endmodule