Created
April 10, 2010 22:09
-
-
Save angusb/362330 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int whichSet = -1; | |
int wordBase = word; | |
int i; | |
int hit = 0; | |
while(1) { | |
if (wordBase % cache->blockSizeInWords == 0) | |
break; | |
wordBase--; | |
} | |
whichSet = (wordBase / cache->blockSizeInWords) % cache->numSets; | |
/* Determine if the requested instruction/word is a hit */ | |
for (i=0; i<cache->blocksPerSet; i++) { | |
int blockWord = cache->cacheElt[whichSet][i].addr; | |
if (wordBase == blockWord && cache->cacheElt[whichSet][i].valid) { | |
hit = 1; | |
cache->cacheElt[whichSet][i].LRUnum = 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment