fa_lru.cc (3349:fec4a86fa212) | fa_lru.cc (3862:ec47e4243107) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 139 unchanged lines hidden (view full) --- 148FALRU::probe(Addr addr) const 149{ 150 Addr blkAddr = blkAlign(addr); 151 FALRUBlk* blk = hashLookup(blkAddr); 152 return blk && blk->tag == blkAddr && blk->isValid(); 153} 154 155void | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 139 unchanged lines hidden (view full) --- 148FALRU::probe(Addr addr) const 149{ 150 Addr blkAddr = blkAlign(addr); 151 FALRUBlk* blk = hashLookup(blkAddr); 152 return blk && blk->tag == blkAddr && blk->isValid(); 153} 154 155void |
156FALRU::invalidateBlk(Addr addr) | 156FALRU::invalidateBlk(FALRU::BlkType *blk) |
157{ | 157{ |
158 Addr blkAddr = blkAlign(addr); 159 FALRUBlk* blk = (*tagHash.find(blkAddr)).second; | |
160 if (blk) { | 158 if (blk) { |
161 assert(blk->tag == blkAddr); | |
162 blk->status = 0; 163 blk->isTouched = false; 164 tagsInUse--; 165 } 166} 167 168FALRUBlk* 169FALRU::findBlock(Addr addr, int &lat, int *inCache) --- 27 unchanged lines hidden (view full) --- 197 *inCache = tmp_in_cache; 198 } 199 200 lat = hitLatency; 201 //assert(check()); 202 return blk; 203} 204 | 159 blk->status = 0; 160 blk->isTouched = false; 161 tagsInUse--; 162 } 163} 164 165FALRUBlk* 166FALRU::findBlock(Addr addr, int &lat, int *inCache) --- 27 unchanged lines hidden (view full) --- 194 *inCache = tmp_in_cache; 195 } 196 197 lat = hitLatency; 198 //assert(check()); 199 return blk; 200} 201 |
205FALRUBlk* 206FALRU::findBlock(PacketPtr &pkt, int &lat, int *inCache) 207{ 208 Addr addr = pkt->getAddr(); | |
209 | 202 |
210 accesses++; 211 int tmp_in_cache = 0; 212 Addr blkAddr = blkAlign(addr); 213 FALRUBlk* blk = hashLookup(blkAddr); 214 215 if (blk && blk->isValid()) { 216 assert(blk->tag == blkAddr); 217 tmp_in_cache = blk->inCache; 218 for (int i = 0; i < numCaches; i++) { 219 if (1<<i & blk->inCache) { 220 hits[i]++; 221 } else { 222 misses[i]++; 223 } 224 } 225 hits[numCaches]++; 226 if (blk != head){ 227 moveToHead(blk); 228 } 229 } else { 230 blk = NULL; 231 for (int i = 0; i < numCaches+1; ++i) { 232 misses[i]++; 233 } 234 } 235 if (inCache) { 236 *inCache = tmp_in_cache; 237 } 238 239 lat = hitLatency; 240 //assert(check()); 241 return blk; 242} 243 | |
244FALRUBlk* 245FALRU::findBlock(Addr addr) const 246{ 247 Addr blkAddr = blkAlign(addr); 248 FALRUBlk* blk = hashLookup(blkAddr); 249 250 if (blk && blk->isValid()) { 251 assert(blk->tag == blkAddr); --- 83 unchanged lines hidden --- | 203FALRUBlk* 204FALRU::findBlock(Addr addr) const 205{ 206 Addr blkAddr = blkAlign(addr); 207 FALRUBlk* blk = hashLookup(blkAddr); 208 209 if (blk && blk->isValid()) { 210 assert(blk->tag == blkAddr); --- 83 unchanged lines hidden --- |