-
Notifications
You must be signed in to change notification settings - Fork 2
/
d_cache.sv
119 lines (112 loc) · 2.59 KB
/
d_cache.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import lc3b_types::*;
module d_cache
(
input clk,
input ld_from_vic,
input dirty_in,
output logic dirty_out,
output logic no_evict,
input mem_read,
input mem_write,
input pmem_resp,
input lc3b_mem_wmask mem_byte_enable,
input lc3b_word mem_wdata,
input lc3b_word mem_address,
input lc3b_mem_data pmem_rdata,
output logic mem_resp,
output logic pmem_read,
output logic pmem_write,
output logic pmem_swap,
output lc3b_word mem_rdata,
output lc3b_word pmem_address,
output lc3b_mem_data pmem_wdata,
output lc3b_word l1_miss_counter
);
logic ld_cache;
logic ld_dirty0;
logic ld_dirty1;
logic ld_lru;
logic writecachemux_sel;
logic data0mux_sel;
logic data1mux_sel;
logic hit;
logic curr_way;
logic lru_out;
logic valid0_out;
logic valid1_out;
logic dirty0_in;
logic dirty1_in;
logic dirty0_out;
logic dirty1_out;
lc3b_c_tag pmem_tag;
initial
begin
l1_miss_counter = 0;
end
always_ff @ (posedge clk)
begin
if (pmem_resp)
l1_miss_counter++;
end
d_cache_datapath cache_datapath_module
(
.clk(clk),
.ld_cache(ld_cache),
.ld_dirty0(ld_dirty0),
.ld_dirty1(ld_dirty1),
.ld_lru(ld_lru),
.writecachemux_sel(writecachemux_sel),
.data0mux_sel(data0mux_sel),
.data1mux_sel(data1mux_sel),
.ld_from_vic(ld_from_vic),
.dirty0_in(dirty0_in),
.dirty1_in(dirty1_in),
.dirty_in(dirty_in),
.hit(hit),
.curr_way(curr_way),
.lru_out(lru_out),
.valid0_out(valid0_out),
.valid1_out(valid1_out),
.dirty_out(dirty_out),
.dirty0_out(dirty0_out),
.dirty1_out(dirty1_out),
.pmem_tag(pmem_tag),
.mem_address(mem_address),
.mem_wdata(mem_wdata),
.pmem_rdata(pmem_rdata),
.mem_byte_enable(mem_byte_enable),
.mem_rdata(mem_rdata),
.pmem_wdata(pmem_wdata)
);
d_cache_control cache_control_module
(
.clk(clk),
.hit(hit),
.curr_way(curr_way),
.lru_out(lru_out),
.valid0_out(valid0_out),
.valid1_out(valid1_out),
.dirty0_out(dirty0_out),
.dirty1_out(dirty1_out),
.pmem_tag(pmem_tag),
.ld_cache(ld_cache),
.ld_dirty0(ld_dirty0),
.ld_dirty1(ld_dirty1),
.dirty0_in(dirty0_in),
.dirty1_in(dirty1_in),
.ld_lru(ld_lru),
.writecachemux_sel(writecachemux_sel),
.data0mux_sel(data0mux_sel),
.data1mux_sel(data1mux_sel),
.no_evict(no_evict),
.mem_address(mem_address),
.pmem_resp(pmem_resp),
.mem_read(mem_read),
.mem_write(mem_write),
.pmem_address(pmem_address),
.mem_resp(mem_resp),
.pmem_read(pmem_read),
.pmem_write(pmem_write),
.pmem_swap(pmem_swap)
);
endmodule : d_cache