Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- offset = log(blocksize) / log(2);
- index = log(numberofblocks) / log(2);
- sets = numberofblocks / assoc
- while(getline(cin, addr)){
- //convert ascii into binary
- strcpy(line, addr.c_str());
- binaryConverted = hexToBin(line);
- //split binary to tag/index/offset
- //add to cache
- //blocknumber = tag + index
- cacheindex = (blocknumber % sets) * assoc
- //check if cacheindex in cache structure
- if(if cacheindex in cache structure)
- {
- hit++'
- }
- else(if cacheindex not in cache structure)
- {
- miss++;
- //add cacheindex to cache
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement