Repository navigation
Expand file tree
/
Copy pathcache.cc.patch.keep
More file actions
214 lines (205 loc) · 5.55 KB
/
Copy pathcache.cc.patch.keep
File metadata and controls
214 lines (205 loc) · 5.55 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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
*** cache.cc 2013-02-15 01:51:44.000000000 +0800
--- /home/hero/bypassrelated/macsim/src/cache.cc 2013-08-01 17:26:22.423532835 +0800
***************
*** 61,66 ****
--- 61,70 ----
{
}
+ //rht_entry_c::rht_entry_c()
+ // :m_valid(false), m_last_access_time(0)
+ //{
+ //}
cache_set_c::cache_set_c(int assoc)
{
***************
*** 68,78 ****
--- 72,92 ----
m_assoc = assoc;
}
+ //rht_entry_c::rht_set_c(int assoc)
+ //{
+ // m_entry = new rht_entry_c[assoc];
+ // m_assoc = assoc;
+ //}
+
cache_set_c::~cache_set_c()
{
delete m_entry;
}
+ //rht_set_c::~rht_set_c()
+ //{
+ // delete m_entry;
+ //}
///////////////////////////////////////////////////////////////////////////////////////////////
***************
*** 153,158 ****
--- 149,213 ----
m_enable_partition = enable_partition;
}
+ //rht constructor
+ //rht_c::rht_c(string name, int num_set, int assoc, int line_size,
+ // int bank_num, bool rht_turned_off, int core_id, Cache_Type cache_type_info,
+ // bool enable_partition, macsim_c* simBase)
+ //{
+ // m_simBase = simBase;
+ //
+ // DEBUG("Initializing cache called '%s'.\n", name.c_str());
+ //
+ // // Setting Basic Parameters sent via caller
+ // m_name = name;
+ // m_data_size = data_size;
+ // m_assoc = assoc;
+ // m_num_sets = num_set;
+ // m_line_size = line_size;
+ // m_cache_type = cache_type_info;
+ //
+ // // Setting some fields to make indexing quick
+ // m_set_bits = log2_int(num_set);
+ // m_shift_bits = log2_int(line_size); /* use for shift amt. */
+ // m_set_mask = N_BIT_MASK(log2_int(num_set)); /* use after shifting */
+ // m_tag_mask = ~m_set_mask; /* use after shifting */
+ // m_offset_mask = N_BIT_MASK(m_shift_bits); /* use before shifting */
+ // m_bank_num = bank_num;
+ //
+ // // Allocating memory for all the sets (pointers to line arrays)
+ // m_core_id = core_id;
+ //
+ // // Allocating memory for all of the lines in each set
+ // m_set = new rht_set_c* [m_num_sets];
+ //
+ // for (int ii = 0; ii < m_num_sets; ++ii) {
+ // m_set[ii] = new rht_set_c(m_assoc);
+ //
+ // // Allocating memory for all of the data elements in each line
+ // for (int jj = 0; jj < assoc; ++jj) {
+ // m_set[ii]->m_entry[jj].m_valid = false;
+ // // m_set[ii]->m_entry[jj].m_access_counter = false;
+ // if (data_size > 0) {
+ // m_set[ii]->m_entry[jj].m_data = (void *)malloc(data_size);
+ // memset(m_set[ii]->m_entry[jj].m_data, 0, data_size);
+ // }
+ // else {
+ // m_set[ii]->m_entry[jj].m_data = INIT_CACHE_DATA_VALUE;
+ // }
+ // //m_set[ii]-> m_entry[jj].m_ib_tag = 0;
+ // //m_set[ii]-> m_entry[jj].m_vb_tag = 0;
+ // }
+ // }
+ //
+ // // Initializing Last update count
+ // m_rht_turned_off = rht_turned_off;
+ //
+ // m_num_cpu_line = 0;
+ // m_num_gpu_line = 0;
+ // m_insert_count = 0;
+ //
+ // m_enable_partition = enable_partition;
+ //}
cache_c::~cache_c()
{
***************
*** 238,243 ****
--- 295,398 ----
return NULL;
}
+
+ //check if there is an invalid entry to record the incoming block.
+ //bool rht_c::has_invalid_entry()
+ //{
+ // rht_entry_c *line ;
+ // for(int ii = 0; ii < m_num_sets; ++ii )
+ // {
+ // for(int jj = 0; jj < m_assoc; ++jj)
+ // {
+ // line = &(m_set[ii]-> m_entry[jj]);
+ // if (line -> m_valid )
+ // continue;
+ // else
+ // return true;
+ // }
+ // }
+ //
+ // return false;
+ //}
+
+
+ //check if the given address need to be recorded
+ //bool rht_c::record(Addr addr)
+ //{
+ // //there is at least one invalid entry
+ // if (has_invalid_entry())
+ // {
+ // return true;
+ // }
+ // //no invalid entry, so we give a low probability to record the incoming miss
+ // else
+ // {
+ // //here, give the implementation of low probability
+ // }
+ //}
+
+
+
+ //void* rht_c::access_rht(Addr addr, Addr *line_addr, bool update_repl, int appl_id)
+ //{
+ // // Check if cache by pass is set. If so return NULL.
+ // if (m_rht_turned_off)
+ // return NULL;
+ //
+ // Addr tag;
+ // int set;
+ //
+ // // Get Tag and set to check if the addr exists in cache
+ // find_tag_and_set(addr, &tag, &set);
+ // *line_addr = base_cache_line (addr);
+ //
+ // if (update_repl)
+ // update_cache_on_access(*line_addr, set, appl_id);
+ //
+ // // Walk through the set
+ // for (int ii = 0; ii < m_assoc; ++ii) {
+ // // For each line in based on associativity
+ // cache_entry_c * line = &(m_set[set]->m_entry[ii]);
+ //
+ // // Check for matching tag and validity
+ // if (line->m_valid && line->m_tag == tag) {
+ // // If hit, then return
+ // assert(line->m_data);
+ //
+ // if (update_repl) {
+ // // If prefetch is set mark it as used
+ // if (line->m_pref) {
+ // line->m_pref = false;
+ // }
+ // update_line_on_hit(line, set, appl_id);
+ // }
+ //
+ // return line->m_data;
+ // }
+ // }
+ //
+ // if (update_repl)
+ // update_cache_on_miss(set, appl_id);
+ //
+ // return NULL;
+ //}
+
+ //void rht_c::update_cache_on_access(Addr line_addr, int set, int appl_id)
+ //{
+ //}
+ //
+ //
+ //void rht_c::update_line_on_hit(cache_entry_c* line, int set, int appl_id)
+ //{
+ // line->m_last_access_time = CYCLE;
+ //}
+ //
+ //
+ //void rht_c::update_cache_on_miss(int set_id, int appl_id)
+ //{
+ // // do nothing
+ //}
+
void cache_c::update_cache_on_access(Addr line_addr, int set, int appl_id)
{
}