-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmips.v
More file actions
67 lines (59 loc) · 1.29 KB
/
mips.v
File metadata and controls
67 lines (59 loc) · 1.29 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
`include "define.vh"
/**
* MIPS CPU wrapper.
* Author: Zhao, Hongyu <power_zhy@foxmail.com>
*/
module mips (
`ifdef DEBUG
input wire debug_en, // debug enable
input wire debug_step, // debug step clock
input wire [6:0] debug_addr, // debug address
output wire [31:0] debug_data, // debug data
`endif
input wire clk, // main clock
input wire rst, // synchronous reset
input wire interrupter // interrupt source, for future use
);
// instruction signals
wire inst_ren;
wire [31:0] inst_addr;
wire [31:0] inst_data;
// memory signals
wire mem_ren, mem_wen;
wire [31:0] mem_addr;
wire [31:0] mem_data_r;
wire [31:0] mem_data_w;
// mips core
mips_core MIPS_CORE (
.clk(clk),
.rst(rst),
`ifdef DEBUG
.debug_en(debug_en),
.debug_step(debug_step),
.debug_addr(debug_addr),
.debug_data(debug_data),
`endif
.inst_ren(inst_ren),
.inst_addr(inst_addr),
.inst_data(inst_data),
.mem_ren(mem_ren),
.mem_wen(mem_wen),
.mem_addr(mem_addr),
.mem_dout(mem_data_w),
.mem_din(mem_data_r)
);
inst_rom INST_ROM (
.clk(clk),
.addr({2'b0, inst_addr[31:2]}),
//.addr(inst_addr),
.dout(inst_data)
);
data_ram DATA_RAM (
.clk(clk),
.we(mem_wen),
.addr({2'b0, mem_addr[31:2]}),
//.addr(mem_addr),
.din(mem_data_w),
.dout(mem_data_r)
);
endmodule