[138] | 1 | #ifdef SYSTEMC |
---|
| 2 | #include "systemc.h" |
---|
| 3 | #endif |
---|
[81] | 4 | #include "../include/Cache.h" |
---|
[78] | 5 | #include <iostream> |
---|
| 6 | |
---|
| 7 | using namespace std; |
---|
[80] | 8 | using namespace environment; |
---|
| 9 | using namespace environment::cache; |
---|
[78] | 10 | |
---|
[81] | 11 | #define TEST(x,y) \ |
---|
| 12 | { \ |
---|
| 13 | if (x==y) \ |
---|
| 14 | { \ |
---|
| 15 | cout << "Line " << __LINE__ << " : " << "Test OK" << endl; \ |
---|
| 16 | } \ |
---|
| 17 | else \ |
---|
| 18 | { \ |
---|
| 19 | cout << "Line " << __LINE__ << " : " << "Test KO" << endl; \ |
---|
| 20 | exit (EXIT_FAILURE); \ |
---|
| 21 | } \ |
---|
[78] | 22 | } while (0) |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | |
---|
[81] | 26 | #ifdef SYSTEMC |
---|
| 27 | int sc_main (int argc, char * argv[]) |
---|
| 28 | #else |
---|
| 29 | int main (int argc, char * argv[]) |
---|
| 30 | #endif |
---|
[78] | 31 | { |
---|
| 32 | cout << "<main> Begin" << endl; |
---|
| 33 | |
---|
| 34 | { |
---|
| 35 | cache_onelevel::Parameters * param = new cache_onelevel::Parameters |
---|
| 36 | ( |
---|
| 37 | 4, // nb_port |
---|
| 38 | 32, // nb_line |
---|
| 39 | 8, // size_line |
---|
| 40 | 4,// size_word |
---|
| 41 | 4, // associativity |
---|
| 42 | 2, // hit_latence |
---|
| 43 | 3 // miss_penality |
---|
| 44 | ); |
---|
| 45 | |
---|
[81] | 46 | // cout << *param << endl; |
---|
[78] | 47 | |
---|
| 48 | cache_onelevel::Cache_OneLevel * cache = new cache_onelevel::Cache_OneLevel ("my_cache",param); |
---|
| 49 | cache->reset(); |
---|
| 50 | |
---|
[81] | 51 | // cout << *cache << endl; |
---|
[78] | 52 | |
---|
| 53 | cache->transition(); |
---|
| 54 | cache->transition(); |
---|
| 55 | |
---|
[81] | 56 | // cout << *cache << endl; |
---|
[78] | 57 | |
---|
| 58 | TEST(cache->access(0, 0x100, 0, CACHED, WRITE), MISS); |
---|
| 59 | TEST(cache->latence(0), 5); |
---|
| 60 | cache->transition(); // miss cycle 1 |
---|
| 61 | |
---|
| 62 | TEST(cache->access(0, 0x100, 0, CACHED, WRITE), HIT_WRITE_BUFFER); |
---|
| 63 | TEST(cache->latence(0), 4); |
---|
| 64 | cache->transition(); // miss cycle 2 |
---|
| 65 | |
---|
| 66 | TEST(cache->access(0, 0x100, 0, CACHED, WRITE), HIT_WRITE_BUFFER); |
---|
| 67 | TEST(cache->latence(0), 3); |
---|
| 68 | cache->transition(); // miss cycle 3 |
---|
| 69 | |
---|
| 70 | TEST(cache->access(0, 0x100, 0, CACHED, WRITE), HIT_CACHE); //word 0 |
---|
| 71 | TEST(cache->latence(0), 2); |
---|
| 72 | |
---|
| 73 | TEST(cache->access(0, 0x104, 0, CACHED, WRITE), HIT_CACHE); //word 1 |
---|
| 74 | TEST(cache->access(0, 0x108, 0, CACHED, WRITE), HIT_CACHE); //word 2 |
---|
| 75 | TEST(cache->access(0, 0x10c, 0, CACHED, WRITE), HIT_CACHE); //word 3 |
---|
| 76 | TEST(cache->access(0, 0x110, 0, CACHED, WRITE), HIT_CACHE); //word 4 |
---|
| 77 | TEST(cache->access(0, 0x114, 0, CACHED, WRITE), HIT_CACHE); //word 5 |
---|
| 78 | TEST(cache->access(0, 0x118, 0, CACHED, WRITE), HIT_CACHE); //word 6 |
---|
| 79 | TEST(cache->access(0, 0x11c, 0, CACHED, WRITE), HIT_CACHE); //word 7 |
---|
| 80 | TEST(cache->access(0, 0x120, 0, CACHED, WRITE), MISS ); |
---|
| 81 | TEST(cache->access(1, 0x140, 0, CACHED, WRITE), MISS ); |
---|
| 82 | TEST(cache->access(2, 0x160, 0, CACHED, WRITE), MISS ); |
---|
| 83 | TEST(cache->access(3, 0x144, 0, CACHED, WRITE), HIT_BYPASS); |
---|
| 84 | |
---|
| 85 | TEST(cache->latence(0), 5); |
---|
| 86 | TEST(cache->latence(1), 5); |
---|
| 87 | TEST(cache->latence(2), 5); |
---|
| 88 | TEST(cache->latence(3), 5); |
---|
| 89 | |
---|
| 90 | cache->transition(); // miss access |
---|
| 91 | TEST(cache->access(0, 0x180, 0, CACHED, WRITE), MISS ); |
---|
| 92 | TEST(cache->access(1, 0x1a0, 0, CACHED, WRITE), MISS ); |
---|
| 93 | TEST(cache->access(2, 0x1c0, 0, CACHED, WRITE), MISS ); |
---|
| 94 | TEST(cache->access(3, 0x1e0, 0, CACHED, WRITE), MISS ); |
---|
| 95 | |
---|
| 96 | cache->transition(); // miss cycle 1 |
---|
[81] | 97 | // cout << *cache << endl; |
---|
[78] | 98 | |
---|
| 99 | TEST(cache->access(0, 0x200, 0, CACHED, WRITE), MISS ); |
---|
| 100 | TEST(cache->access(1, 0x300, 0, CACHED, WRITE), MISS ); |
---|
| 101 | TEST(cache->access(2, 0x400, 0, CACHED, WRITE), MISS ); |
---|
| 102 | |
---|
| 103 | cache->transition(); // miss cycle 0 |
---|
| 104 | cache->transition(); // miss cycle 1 |
---|
| 105 | cache->transition(); // miss cycle 2 |
---|
| 106 | cache->transition(); // miss cycle 3 |
---|
[81] | 107 | // cout << *cache << endl; |
---|
[78] | 108 | |
---|
| 109 | // line 0 : all way is use |
---|
| 110 | TEST(cache->access(0, 0x118, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 111 | TEST(cache->access(1, 0x204, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 112 | TEST(cache->access(2, 0x100, 0,UNCACHED, WRITE), MISS ); |
---|
| 113 | TEST(cache->access(3, 0x118, 0, CACHED, WRITE), HIT_BYPASS); |
---|
| 114 | |
---|
| 115 | TEST(cache->latence(0), 2); |
---|
| 116 | TEST(cache->latence(1), 2); |
---|
| 117 | TEST(cache->latence(2), 5); |
---|
| 118 | TEST(cache->latence(3), 2); |
---|
| 119 | |
---|
| 120 | cache->transition(); |
---|
[81] | 121 | // cout << *cache << endl; |
---|
[78] | 122 | |
---|
| 123 | TEST(cache->access(0, 0x500, 0, CACHED, WRITE), MISS ); |
---|
| 124 | |
---|
| 125 | cache->transition(); // miss cycle 1 |
---|
| 126 | TEST(cache->access(0, 0x100, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 127 | TEST(cache->access(1, 0x200, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 128 | TEST(cache->access(2, 0x300, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 129 | TEST(cache->access(3, 0x400, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 130 | |
---|
| 131 | cache->transition(); // miss cycle 2 |
---|
| 132 | |
---|
| 133 | TEST(cache->access(0, 0x100, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 134 | TEST(cache->access(1, 0x200, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 135 | TEST(cache->access(2, 0x300, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 136 | TEST(cache->access(3, 0x400, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 137 | |
---|
| 138 | cache->transition(); // miss cycle 3 |
---|
| 139 | TEST(cache->access(0, 0x100, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 140 | TEST(cache->access(1, 0x200, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 141 | TEST(cache->access(2, 0x300, 0, CACHED, WRITE), HIT_CACHE ); |
---|
| 142 | TEST(cache->access(3, 0x400, 0, CACHED, WRITE), MISS ); |
---|
| 143 | |
---|
| 144 | TEST(cache->latence(0), 2); |
---|
| 145 | TEST(cache->latence(1), 2); |
---|
| 146 | TEST(cache->latence(2), 2); |
---|
| 147 | TEST(cache->latence(3), 5); |
---|
| 148 | |
---|
[81] | 149 | // cout << *cache << endl; |
---|
[78] | 150 | |
---|
| 151 | delete cache; |
---|
| 152 | delete param; |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | { |
---|
| 156 | uint32_t * nb_line = new uint32_t [3]; |
---|
| 157 | uint32_t * size_line = new uint32_t [3]; |
---|
| 158 | uint32_t * size_word = new uint32_t [3]; |
---|
| 159 | uint32_t * associativity = new uint32_t [3]; |
---|
| 160 | uint32_t * hit_latence = new uint32_t [3]; |
---|
| 161 | uint32_t * miss_penality = new uint32_t [3]; |
---|
| 162 | |
---|
| 163 | nb_line [0] = 4 ; nb_line [1] = 4 ; nb_line [2] = 4 ; |
---|
| 164 | size_line [0] = 8 ; size_line [1] = 8 ; size_line [2] = 8 ; |
---|
| 165 | size_word [0] = 4 ; size_word [1] = 4 ; size_word [2] = 4 ; |
---|
| 166 | associativity [0] = 1 ; associativity [1] = 2 ; associativity [2] = 4 ; |
---|
| 167 | hit_latence [0] = 1 ; hit_latence [1] = 2 ; hit_latence [2] = 2 ; |
---|
| 168 | miss_penality [0] = 3 ; miss_penality [1] = 5 ; miss_penality [2] = 7 ; |
---|
| 169 | |
---|
| 170 | cache_multilevel::Parameters * param = new cache_multilevel::Parameters |
---|
| 171 | ( |
---|
| 172 | 3, // nb_level |
---|
| 173 | 4, // nb_port |
---|
| 174 | nb_line , |
---|
| 175 | size_line , |
---|
| 176 | size_word , |
---|
| 177 | associativity, |
---|
| 178 | hit_latence , |
---|
| 179 | miss_penality |
---|
| 180 | ); |
---|
| 181 | |
---|
[81] | 182 | // cout << *param << endl; |
---|
[78] | 183 | |
---|
| 184 | cache_multilevel::Cache_MultiLevel * cache = new cache_multilevel::Cache_MultiLevel ("my_cache",param); |
---|
| 185 | |
---|
| 186 | cache->reset(); |
---|
[81] | 187 | // cout << *cache << endl; |
---|
[78] | 188 | |
---|
| 189 | cache_multilevel::Access access; |
---|
| 190 | |
---|
| 191 | access = cache->access (0, 0x100, 0, CACHED, WRITE); |
---|
| 192 | cache->update_access(access); |
---|
| 193 | |
---|
| 194 | TEST(access.num_port , 0); |
---|
| 195 | TEST(access.hit , MISS); |
---|
| 196 | TEST(access.latence , 20); |
---|
| 197 | TEST(access.last_nb_level, 2); |
---|
| 198 | |
---|
| 199 | cache->transition(); //19 |
---|
| 200 | cache->transition(); //18 |
---|
| 201 | cache->transition(); //17 |
---|
| 202 | cache->transition(); //16 |
---|
| 203 | cache->transition(); //15 |
---|
| 204 | cache->transition(); //14 |
---|
| 205 | cache->transition(); //13 |
---|
| 206 | cache->transition(); //12 |
---|
| 207 | cache->transition(); //11 |
---|
| 208 | cache->transition(); //10 |
---|
[81] | 209 | // cout << *cache << endl; |
---|
[78] | 210 | |
---|
| 211 | access = cache->access (0, 0x100, 0, CACHED, WRITE); |
---|
| 212 | cache->update_access(access); |
---|
| 213 | |
---|
| 214 | TEST(access.num_port , 0); |
---|
| 215 | TEST(access.hit , HIT_WRITE_BUFFER); |
---|
| 216 | TEST(access.latence , 10); |
---|
| 217 | TEST(access.last_nb_level, 0); |
---|
| 218 | |
---|
| 219 | cache->transition(); // 9 |
---|
| 220 | cache->transition(); // 8 |
---|
| 221 | cache->transition(); // 7 |
---|
| 222 | cache->transition(); // 6 |
---|
| 223 | cache->transition(); // 5 |
---|
| 224 | cache->transition(); // 4 |
---|
| 225 | cache->transition(); // 3 |
---|
| 226 | cache->transition(); // 2 |
---|
| 227 | |
---|
| 228 | access = cache->access (0, 0x100, 0, CACHED, WRITE); |
---|
| 229 | cache->update_access(access); |
---|
| 230 | |
---|
| 231 | TEST(access.num_port , 0); |
---|
| 232 | TEST(access.hit , HIT_WRITE_BUFFER); |
---|
| 233 | TEST(access.latence , 2); |
---|
| 234 | TEST(access.last_nb_level, 0); |
---|
| 235 | |
---|
| 236 | cache->transition(); // 1 |
---|
| 237 | |
---|
| 238 | access = cache->access (0, 0x100, 0, CACHED, WRITE); |
---|
| 239 | cache->update_access(access); |
---|
| 240 | |
---|
| 241 | TEST(access.num_port , 0); |
---|
| 242 | TEST(access.hit , HIT_CACHE); |
---|
| 243 | TEST(access.latence , 1); |
---|
| 244 | TEST(access.last_nb_level, 0); |
---|
[81] | 245 | // cout << *cache << endl; |
---|
[78] | 246 | |
---|
| 247 | cache->transition(); |
---|
| 248 | |
---|
| 249 | access = cache->access (0, 0x100, 0, CACHED, WRITE); |
---|
| 250 | cache->update_access(access); |
---|
| 251 | |
---|
| 252 | TEST(access.num_port , 0); |
---|
| 253 | TEST(access.hit , HIT_CACHE); |
---|
| 254 | TEST(access.latence , 1); |
---|
| 255 | TEST(access.last_nb_level, 0); |
---|
| 256 | |
---|
| 257 | |
---|
| 258 | access = cache->access (0, 0x100, 0, CACHED, WRITE); |
---|
| 259 | cache->update_access(access); |
---|
| 260 | |
---|
| 261 | TEST(access.num_port , 0); |
---|
| 262 | TEST(access.hit , HIT_CACHE); |
---|
| 263 | TEST(access.latence , 1); |
---|
| 264 | TEST(access.last_nb_level, 0); |
---|
| 265 | |
---|
| 266 | access = cache->access (1, 0x200, 0, CACHED, WRITE); |
---|
| 267 | cache->update_access(access); |
---|
| 268 | |
---|
| 269 | TEST(access.num_port , 1); |
---|
| 270 | TEST(access.hit , MISS); |
---|
| 271 | TEST(access.latence , 20); |
---|
| 272 | TEST(access.last_nb_level, 2); |
---|
| 273 | |
---|
| 274 | access = cache->access (2, 0x100, 0, CACHED, WRITE); |
---|
| 275 | cache->update_access(access); |
---|
| 276 | |
---|
| 277 | TEST(access.num_port , 2); |
---|
| 278 | TEST(access.hit , HIT_BYPASS); |
---|
| 279 | TEST(access.latence , 1); |
---|
| 280 | TEST(access.last_nb_level, 0); |
---|
| 281 | |
---|
| 282 | access = cache->access (3, 0x200, 0, CACHED, WRITE); |
---|
| 283 | cache->update_access(access); |
---|
| 284 | |
---|
| 285 | TEST(access.num_port , 3); |
---|
| 286 | TEST(access.hit , HIT_BYPASS); |
---|
| 287 | TEST(access.latence , 20); |
---|
| 288 | TEST(access.last_nb_level, 0); |
---|
| 289 | |
---|
| 290 | cache->transition(); //19 |
---|
| 291 | cache->transition(); //18 |
---|
| 292 | cache->transition(); //17 |
---|
| 293 | cache->transition(); //16 |
---|
| 294 | cache->transition(); //15 |
---|
| 295 | |
---|
| 296 | |
---|
| 297 | // access = cache->access (1, 0x300, 0, CACHED, WRITE); |
---|
| 298 | // cache->update_access(access); |
---|
| 299 | |
---|
| 300 | // TEST(access.num_port , 1); |
---|
| 301 | // TEST(access.hit , MISS); |
---|
| 302 | // TEST(access.latence , 20); |
---|
| 303 | // TEST(access.last_nb_level, 2); |
---|
| 304 | |
---|
| 305 | cache->transition(); //14 |
---|
| 306 | cache->transition(); //13 |
---|
| 307 | cache->transition(); //12 |
---|
| 308 | cache->transition(); //11 |
---|
| 309 | cache->transition(); //10 |
---|
[81] | 310 | // cout << *cache << endl; |
---|
[78] | 311 | |
---|
| 312 | access = cache->access (0, 0x100, 0, CACHED, WRITE); |
---|
| 313 | cache->update_access(access); |
---|
| 314 | |
---|
| 315 | TEST(access.num_port , 0); |
---|
| 316 | TEST(access.hit , HIT_CACHE); |
---|
| 317 | TEST(access.latence , 1); |
---|
| 318 | TEST(access.last_nb_level, 0); |
---|
| 319 | |
---|
| 320 | access = cache->access (1, 0x200, 0, CACHED, WRITE); |
---|
| 321 | cache->update_access(access); |
---|
| 322 | |
---|
| 323 | TEST(access.num_port , 1); |
---|
| 324 | TEST(access.hit , HIT_WRITE_BUFFER); |
---|
| 325 | TEST(access.latence , 10); |
---|
| 326 | TEST(access.last_nb_level, 0); |
---|
| 327 | |
---|
| 328 | access = cache->access (2, 0x100, 0, CACHED, WRITE); |
---|
| 329 | cache->update_access(access); |
---|
| 330 | |
---|
| 331 | TEST(access.num_port , 2); |
---|
| 332 | TEST(access.hit , HIT_BYPASS); |
---|
| 333 | TEST(access.latence , 1); |
---|
| 334 | TEST(access.last_nb_level, 0); |
---|
| 335 | |
---|
| 336 | access = cache->access (3, 0x200, 0, CACHED, WRITE); |
---|
| 337 | cache->update_access(access); |
---|
| 338 | |
---|
| 339 | TEST(access.num_port , 3); |
---|
| 340 | TEST(access.hit , HIT_WRITE_BUFFER); |
---|
| 341 | TEST(access.latence , 10); |
---|
| 342 | TEST(access.last_nb_level, 0); |
---|
| 343 | |
---|
| 344 | cache->transition(); //9 |
---|
| 345 | |
---|
| 346 | access = cache->access (1, 0x400, 0, CACHED, WRITE); |
---|
| 347 | cache->update_access(access); |
---|
| 348 | |
---|
| 349 | TEST(access.num_port , 1); |
---|
| 350 | TEST(access.hit , MISS); |
---|
| 351 | TEST(access.latence , 20); |
---|
| 352 | TEST(access.last_nb_level, 2); |
---|
| 353 | |
---|
| 354 | cache->transition(); //8 |
---|
| 355 | cache->transition(); //7 |
---|
| 356 | cache->transition(); //6 |
---|
| 357 | cache->transition(); //5 |
---|
| 358 | cache->transition(); //4 |
---|
| 359 | cache->transition(); //3 |
---|
| 360 | cache->transition(); //2 |
---|
| 361 | cache->transition(); //1 |
---|
| 362 | cache->transition(); //0 |
---|
| 363 | |
---|
| 364 | access = cache->access (1, 0x100, 0, CACHED, WRITE); |
---|
[81] | 365 | // cout << access<< endl; |
---|
[78] | 366 | |
---|
| 367 | cache->update_access(access); |
---|
| 368 | |
---|
| 369 | TEST(access.num_port , 1); |
---|
| 370 | TEST(access.hit , HIT_CACHE); |
---|
| 371 | TEST(access.latence , 6 ); |
---|
| 372 | TEST(access.last_nb_level, 1); |
---|
| 373 | |
---|
[81] | 374 | // cout << *cache << endl; |
---|
[78] | 375 | delete cache; |
---|
| 376 | delete param; |
---|
| 377 | delete [] nb_line ; |
---|
| 378 | delete [] size_line ; |
---|
| 379 | delete [] size_word ; |
---|
| 380 | delete [] associativity; |
---|
| 381 | delete [] hit_latence ; |
---|
| 382 | delete [] miss_penality; |
---|
| 383 | } |
---|
| 384 | |
---|
| 385 | { |
---|
| 386 | uint32_t * cache_shared_nb_line = new uint32_t [1]; |
---|
| 387 | uint32_t * cache_shared_size_line = new uint32_t [1]; |
---|
| 388 | uint32_t * cache_shared_size_word = new uint32_t [1]; |
---|
| 389 | uint32_t * cache_shared_associativity = new uint32_t [1]; |
---|
| 390 | uint32_t * cache_shared_hit_latence = new uint32_t [1]; |
---|
| 391 | uint32_t * cache_shared_miss_penality = new uint32_t [1]; |
---|
| 392 | |
---|
| 393 | cache_shared_nb_line [0] = 8 ; |
---|
| 394 | cache_shared_size_line [0] = 8 ; |
---|
| 395 | cache_shared_size_word [0] = 4 ; |
---|
[81] | 396 | cache_shared_associativity [0] = 8 ; |
---|
[78] | 397 | cache_shared_hit_latence [0] = 2 ; |
---|
| 398 | cache_shared_miss_penality [0] = 5 ; |
---|
| 399 | |
---|
| 400 | uint32_t * icache_nb_level = new uint32_t [2]; |
---|
| 401 | uint32_t * icache_nb_port = new uint32_t [2]; |
---|
| 402 | uint32_t ** icache_nb_line = new uint32_t * [2]; |
---|
| 403 | uint32_t ** icache_size_line = new uint32_t * [2]; |
---|
| 404 | uint32_t ** icache_size_word = new uint32_t * [2]; |
---|
| 405 | uint32_t ** icache_associativity = new uint32_t * [2]; |
---|
| 406 | uint32_t ** icache_hit_latence = new uint32_t * [2]; |
---|
| 407 | uint32_t ** icache_miss_penality = new uint32_t * [2]; |
---|
| 408 | |
---|
| 409 | icache_nb_level [0] = 1; |
---|
| 410 | icache_nb_port [0] = 2; |
---|
| 411 | icache_nb_line [0] = new uint32_t [1]; |
---|
| 412 | icache_size_line [0] = new uint32_t [1]; |
---|
| 413 | icache_size_word [0] = new uint32_t [1]; |
---|
| 414 | icache_associativity [0] = new uint32_t [1]; |
---|
| 415 | icache_hit_latence [0] = new uint32_t [1]; |
---|
| 416 | icache_miss_penality [0] = new uint32_t [1]; |
---|
| 417 | |
---|
| 418 | icache_nb_line [0][0] = 8; |
---|
| 419 | icache_size_line [0][0] = 8; |
---|
| 420 | icache_size_word [0][0] = 4; |
---|
| 421 | icache_associativity [0][0] = 1; |
---|
| 422 | icache_hit_latence [0][0] = 1; |
---|
| 423 | icache_miss_penality [0][0] = 3; |
---|
| 424 | |
---|
| 425 | icache_nb_level [1] = 2; |
---|
| 426 | icache_nb_port [1] = 2; |
---|
| 427 | icache_nb_line [1] = new uint32_t [2]; |
---|
| 428 | icache_size_line [1] = new uint32_t [2]; |
---|
| 429 | icache_size_word [1] = new uint32_t [2]; |
---|
| 430 | icache_associativity [1] = new uint32_t [2]; |
---|
| 431 | icache_hit_latence [1] = new uint32_t [2]; |
---|
| 432 | icache_miss_penality [1] = new uint32_t [2]; |
---|
| 433 | |
---|
| 434 | icache_nb_line [1][0] = 4; |
---|
| 435 | icache_size_line [1][0] = 8; |
---|
| 436 | icache_size_word [1][0] = 4; |
---|
| 437 | icache_associativity [1][0] = 1; |
---|
| 438 | icache_hit_latence [1][0] = 1; |
---|
| 439 | icache_miss_penality [1][0] = 3; |
---|
| 440 | |
---|
| 441 | icache_nb_line [1][1] = 4; |
---|
| 442 | icache_size_line [1][1] = 8; |
---|
| 443 | icache_size_word [1][1] = 4; |
---|
| 444 | icache_associativity [1][1] = 4; |
---|
| 445 | icache_hit_latence [1][1] = 1; |
---|
| 446 | icache_miss_penality [1][1] = 4; |
---|
| 447 | |
---|
| 448 | uint32_t * dcache_nb_level = new uint32_t [2]; |
---|
| 449 | uint32_t * dcache_nb_port = new uint32_t [2]; |
---|
| 450 | uint32_t ** dcache_nb_line = new uint32_t * [2]; |
---|
| 451 | uint32_t ** dcache_size_line = new uint32_t * [2]; |
---|
| 452 | uint32_t ** dcache_size_word = new uint32_t * [2]; |
---|
| 453 | uint32_t ** dcache_associativity = new uint32_t * [2]; |
---|
| 454 | uint32_t ** dcache_hit_latence = new uint32_t * [2]; |
---|
| 455 | uint32_t ** dcache_miss_penality = new uint32_t * [2]; |
---|
| 456 | |
---|
| 457 | dcache_nb_level [0] = 1; |
---|
| 458 | dcache_nb_port [0] = 2; |
---|
| 459 | dcache_nb_line [0] = new uint32_t [1]; |
---|
| 460 | dcache_size_line [0] = new uint32_t [1]; |
---|
| 461 | dcache_size_word [0] = new uint32_t [1]; |
---|
| 462 | dcache_associativity [0] = new uint32_t [1]; |
---|
| 463 | dcache_hit_latence [0] = new uint32_t [1]; |
---|
| 464 | dcache_miss_penality [0] = new uint32_t [1]; |
---|
| 465 | |
---|
| 466 | dcache_nb_line [0][0] = 8; |
---|
| 467 | dcache_size_line [0][0] = 8; |
---|
| 468 | dcache_size_word [0][0] = 4; |
---|
| 469 | dcache_associativity [0][0] = 1; |
---|
| 470 | dcache_hit_latence [0][0] = 1; |
---|
| 471 | dcache_miss_penality [0][0] = 3; |
---|
| 472 | |
---|
| 473 | dcache_nb_level [1] = 2; |
---|
[81] | 474 | dcache_nb_port [1] = 8; // to test |
---|
[78] | 475 | dcache_nb_line [1] = new uint32_t [2]; |
---|
| 476 | dcache_size_line [1] = new uint32_t [2]; |
---|
| 477 | dcache_size_word [1] = new uint32_t [2]; |
---|
| 478 | dcache_associativity [1] = new uint32_t [2]; |
---|
| 479 | dcache_hit_latence [1] = new uint32_t [2]; |
---|
| 480 | dcache_miss_penality [1] = new uint32_t [2]; |
---|
| 481 | |
---|
| 482 | dcache_nb_line [1][0] = 4; |
---|
| 483 | dcache_size_line [1][0] = 8; |
---|
| 484 | dcache_size_word [1][0] = 4; |
---|
| 485 | dcache_associativity [1][0] = 1; |
---|
| 486 | dcache_hit_latence [1][0] = 1; |
---|
| 487 | dcache_miss_penality [1][0] = 3; |
---|
| 488 | |
---|
| 489 | dcache_nb_line [1][1] = 4; |
---|
| 490 | dcache_size_line [1][1] = 8; |
---|
| 491 | dcache_size_word [1][1] = 4; |
---|
| 492 | dcache_associativity [1][1] = 4; |
---|
| 493 | dcache_hit_latence [1][1] = 1; |
---|
| 494 | dcache_miss_penality [1][1] = 4; |
---|
| 495 | |
---|
| 496 | Parameters * param = new Parameters |
---|
| 497 | (2,//nb_cache_dedicated |
---|
| 498 | |
---|
| 499 | icache_nb_level , |
---|
| 500 | icache_nb_port , |
---|
| 501 | icache_nb_line , |
---|
| 502 | icache_size_line , |
---|
| 503 | icache_size_word , |
---|
| 504 | icache_associativity , |
---|
| 505 | icache_hit_latence , |
---|
| 506 | icache_miss_penality , |
---|
| 507 | |
---|
| 508 | dcache_nb_level , |
---|
| 509 | dcache_nb_port , |
---|
| 510 | dcache_nb_line , |
---|
| 511 | dcache_size_line , |
---|
| 512 | dcache_size_word , |
---|
| 513 | dcache_associativity , |
---|
| 514 | dcache_hit_latence , |
---|
| 515 | dcache_miss_penality , |
---|
| 516 | |
---|
| 517 | 1, // nb_level |
---|
| 518 | cache_shared_nb_line , |
---|
| 519 | cache_shared_size_line , |
---|
| 520 | cache_shared_size_word , |
---|
| 521 | cache_shared_associativity, |
---|
| 522 | cache_shared_hit_latence , |
---|
| 523 | cache_shared_miss_penality |
---|
| 524 | ); |
---|
| 525 | |
---|
[81] | 526 | // cout << *param << endl; |
---|
[78] | 527 | |
---|
| 528 | cache::Cache * cache = new cache::Cache ("my_cache",param); |
---|
| 529 | |
---|
| 530 | cache->reset(); |
---|
[81] | 531 | // cout << *cache << endl; |
---|
[78] | 532 | |
---|
| 533 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 16); |
---|
| 534 | cache->transition(); |
---|
| 535 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 15); |
---|
| 536 | cache->transition(); |
---|
[81] | 537 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 14); |
---|
| 538 | cache->transition(); |
---|
| 539 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 13); |
---|
| 540 | cache->transition(); |
---|
| 541 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 12); |
---|
| 542 | cache->transition(); |
---|
| 543 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 11); |
---|
| 544 | cache->transition(); |
---|
| 545 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 10); |
---|
| 546 | cache->transition(); |
---|
| 547 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 9); |
---|
| 548 | cache->transition(); |
---|
| 549 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 8); |
---|
| 550 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 16); // miss thread != |
---|
| 551 | TEST(cache->latence (DATA_CACHE, 0, 0, 0x100, 0, CACHED, WRITE), 6); // miss L1, hit L2 |
---|
| 552 | cache->transition(); |
---|
| 553 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 7); |
---|
| 554 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 15); |
---|
| 555 | cache->transition(); |
---|
| 556 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 6); |
---|
| 557 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 14); |
---|
| 558 | cache->transition(); |
---|
| 559 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 5); |
---|
| 560 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 13); |
---|
| 561 | cache->transition(); |
---|
| 562 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 4); |
---|
| 563 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 12); |
---|
| 564 | cache->transition(); |
---|
| 565 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 3); |
---|
| 566 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 11); |
---|
| 567 | cache->transition(); |
---|
| 568 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 2); |
---|
| 569 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 10); |
---|
| 570 | cache->transition(); |
---|
| 571 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 572 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 9); |
---|
| 573 | cache->transition(); |
---|
| 574 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 575 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 8); |
---|
| 576 | cache->transition(); |
---|
| 577 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 578 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 7); |
---|
| 579 | cache->transition(); |
---|
| 580 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 581 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 6); |
---|
| 582 | cache->transition(); |
---|
| 583 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 584 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 5); |
---|
| 585 | cache->transition(); |
---|
| 586 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 587 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 4); |
---|
| 588 | cache->transition(); |
---|
| 589 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 590 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 3); |
---|
| 591 | cache->transition(); |
---|
| 592 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 593 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 2); |
---|
| 594 | cache->transition(); |
---|
[78] | 595 | |
---|
[81] | 596 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 5); // L1 is direct map, hit L2 |
---|
| 597 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 1); // write in L1 |
---|
| 598 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 16); |
---|
| 599 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 16); |
---|
| 600 | cache->transition(); |
---|
| 601 | |
---|
| 602 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 4); |
---|
| 603 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 1); |
---|
| 604 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 15); |
---|
| 605 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 15); |
---|
| 606 | cache->transition(); |
---|
| 607 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 3); |
---|
| 608 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 1); |
---|
| 609 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 14); |
---|
| 610 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 14); |
---|
| 611 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 16); |
---|
| 612 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 16); |
---|
| 613 | cache->transition(); |
---|
| 614 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 2); |
---|
| 615 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 1); |
---|
| 616 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 13); |
---|
| 617 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 13); |
---|
| 618 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 15); |
---|
| 619 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 15); |
---|
| 620 | |
---|
| 621 | |
---|
| 622 | cache->transition(); |
---|
| 623 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 624 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 5); |
---|
| 625 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 12); |
---|
| 626 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 12); |
---|
| 627 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 14); |
---|
| 628 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 14); |
---|
| 629 | |
---|
| 630 | |
---|
| 631 | cache->transition(); |
---|
| 632 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 633 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 4); |
---|
| 634 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 11); |
---|
| 635 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 11); |
---|
| 636 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 13); |
---|
| 637 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 13); |
---|
| 638 | |
---|
| 639 | // in cache L2 : context 0,1,2,3 |
---|
| 640 | |
---|
| 641 | cache->transition(); |
---|
| 642 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 643 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 3); |
---|
| 644 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 10); |
---|
| 645 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 10); |
---|
| 646 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 12); |
---|
| 647 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 12); |
---|
| 648 | |
---|
| 649 | cache->transition(); |
---|
| 650 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 651 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 2); |
---|
| 652 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 9); |
---|
| 653 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 9); |
---|
| 654 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 11); |
---|
| 655 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 11); |
---|
| 656 | |
---|
| 657 | cache->transition(); |
---|
| 658 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 5); |
---|
| 659 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 1); |
---|
| 660 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 8); |
---|
| 661 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 8); |
---|
| 662 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 10); // write in L2 |
---|
| 663 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 10); // write in L2 |
---|
| 664 | |
---|
| 665 | cache->transition(); |
---|
| 666 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 4); |
---|
| 667 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 1); |
---|
| 668 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 7); |
---|
| 669 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 7); |
---|
| 670 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 9); |
---|
| 671 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 9); |
---|
| 672 | |
---|
| 673 | cache->transition(); |
---|
| 674 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 3); |
---|
| 675 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 1); |
---|
| 676 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 6); |
---|
| 677 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 6); |
---|
| 678 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 8); |
---|
| 679 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 8); |
---|
| 680 | |
---|
| 681 | cache->transition(); |
---|
| 682 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 2); |
---|
| 683 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 1); |
---|
| 684 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 5); |
---|
| 685 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 5); |
---|
| 686 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 7); |
---|
| 687 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 7); |
---|
| 688 | |
---|
| 689 | cache->transition(); |
---|
| 690 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 691 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 5); |
---|
| 692 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 4); |
---|
| 693 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 4); |
---|
| 694 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 6); |
---|
| 695 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 6); |
---|
| 696 | |
---|
| 697 | cache->transition(); |
---|
| 698 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 699 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 4); |
---|
| 700 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 3); |
---|
| 701 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 3); |
---|
| 702 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 5); |
---|
| 703 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 5); |
---|
| 704 | |
---|
| 705 | cache->transition(); |
---|
| 706 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 1); |
---|
| 707 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 3); |
---|
| 708 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 2); |
---|
| 709 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 2); |
---|
| 710 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 4); |
---|
| 711 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 4); |
---|
| 712 | |
---|
[78] | 713 | cout << *cache << endl; |
---|
| 714 | |
---|
[81] | 715 | cache->transition(); |
---|
| 716 | // In L2 : context 1,2,4,5 : also context 0 and 3 miss L1 and L2, hit L3 |
---|
| 717 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 11); |
---|
| 718 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 2); |
---|
| 719 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 1); |
---|
| 720 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 11); |
---|
| 721 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 3); |
---|
| 722 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 3); |
---|
[78] | 723 | |
---|
[81] | 724 | cache->transition(); |
---|
| 725 | TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 10); |
---|
| 726 | TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 1); |
---|
| 727 | TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 5); |
---|
| 728 | TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 10); |
---|
| 729 | TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 2); |
---|
| 730 | TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 2); |
---|
| 731 | |
---|
| 732 | // // cout << *cache << endl; |
---|
| 733 | |
---|
[78] | 734 | delete cache; |
---|
[81] | 735 | |
---|
[78] | 736 | delete param; |
---|
| 737 | delete [] cache_shared_nb_line ; |
---|
| 738 | delete [] cache_shared_size_line ; |
---|
| 739 | delete [] cache_shared_size_word ; |
---|
| 740 | delete [] cache_shared_associativity; |
---|
| 741 | delete [] cache_shared_hit_latence ; |
---|
| 742 | delete [] cache_shared_miss_penality; |
---|
| 743 | delete [] icache_nb_level ; |
---|
| 744 | delete [] icache_nb_port ; |
---|
| 745 | delete [] icache_nb_line [0]; |
---|
| 746 | delete [] icache_size_line [0]; |
---|
| 747 | delete [] icache_size_word [0]; |
---|
| 748 | delete [] icache_associativity [0]; |
---|
| 749 | delete [] icache_hit_latence [0]; |
---|
| 750 | delete [] icache_miss_penality [0]; |
---|
| 751 | delete [] icache_nb_line [1]; |
---|
| 752 | delete [] icache_size_line [1]; |
---|
| 753 | delete [] icache_size_word [1]; |
---|
| 754 | delete [] icache_associativity [1]; |
---|
| 755 | delete [] icache_hit_latence [1]; |
---|
| 756 | delete [] icache_miss_penality [1]; |
---|
| 757 | delete [] icache_nb_line ; |
---|
| 758 | delete [] icache_size_line ; |
---|
| 759 | delete [] icache_size_word ; |
---|
| 760 | delete [] icache_associativity ; |
---|
| 761 | delete [] icache_hit_latence ; |
---|
| 762 | delete [] icache_miss_penality ; |
---|
| 763 | delete [] dcache_nb_level ; |
---|
| 764 | delete [] dcache_nb_port ; |
---|
| 765 | delete [] dcache_nb_line [0]; |
---|
| 766 | delete [] dcache_size_line [0]; |
---|
| 767 | delete [] dcache_size_word [0]; |
---|
| 768 | delete [] dcache_associativity [0]; |
---|
| 769 | delete [] dcache_hit_latence [0]; |
---|
| 770 | delete [] dcache_miss_penality [0]; |
---|
| 771 | delete [] dcache_nb_line [1]; |
---|
| 772 | delete [] dcache_size_line [1]; |
---|
| 773 | delete [] dcache_size_word [1]; |
---|
| 774 | delete [] dcache_associativity [1]; |
---|
| 775 | delete [] dcache_hit_latence [1]; |
---|
| 776 | delete [] dcache_miss_penality [1]; |
---|
| 777 | delete [] dcache_nb_line ; |
---|
| 778 | delete [] dcache_size_line ; |
---|
| 779 | delete [] dcache_size_word ; |
---|
| 780 | delete [] dcache_associativity ; |
---|
| 781 | delete [] dcache_hit_latence ; |
---|
| 782 | delete [] dcache_miss_penality ; |
---|
| 783 | } |
---|
| 784 | |
---|
| 785 | cout << "<main> End" << endl; |
---|
| 786 | |
---|
| 787 | return EXIT_SUCCESS; |
---|
| 788 | } |
---|