-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmips.v
More file actions
90 lines (83 loc) · 2.1 KB
/
mips.v
File metadata and controls
90 lines (83 loc) · 2.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
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
85
86
87
88
89
90
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/04/2023 08:06:15 AM
// Design Name:
// Module Name: mips
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module mips(
input wire clk, n_reset, // clock and reset inputs
input wire [31:0] read_data, instr,
output wire mem_write,
output wire [31:0] write_data, alu_result, pc
);
wire [31:0] instr, imm_ext, result;
wire [2:0] alu_control;
wire [1:0] imm_src;
data_path dp (
// input ports
.clk(clk),
.n_reset(n_reset),
.r_addr_A(instr[19:15]),
.r_addr_B(instr[24:20]),
.w_addr(instr[11:7]),
.reg_write(reg_write),
.alu_src(alu_src),
.imm_ext(imm_ext),
.alu_control(alu_control),
.read_data(read_data),
.result_src(result_src),
// output ports
.zero(zero),
.sign(sign),
.write_data(write_data),
.alu_result(alu_result),
.result(result)
);
control_unit cu (
// input ports
.op(instr[6:0]),
.funct3(instr[14:12]),
.funct7(instr[30]),
.zero(zero),
.sign(sign),
// output ports
.pc_src(pc_src),
.result_src(result_src),
.mem_write(mem_write),
.alu_control(alu_control),
.alu_src(alu_src),
.imm_src(imm_src),
.reg_write(reg_write),
.load(load) // output load signal for PC
);
instruction_fetch_unit #(
.ADDRESS_WIDTH(32),
.INSTR_WIDTH(32),
.N(32)
) ifu (
// input ports
.clk(clk),
.n_reset(n_reset),
.load(load),
.pc_src(pc_src),
.imm_src(imm_src),
.instr(instr),
// output ports
.imm_ext(imm_ext),
.pc(pc)
);
endmodule