Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. offset = log(blocksize) / log(2);
  2. index =  log(numberofblocks) / log(2);
  3. sets = numberofblocks / assoc
  4.    
  5.     while(getline(cin, addr)){
  6.         //convert ascii into binary
  7.         strcpy(line, addr.c_str());
  8.        
  9.         binaryConverted = hexToBin(line);
  10.    
  11.         //split binary to tag/index/offset
  12.         //blocknumber = tag + index
  13.         cacheindex = (blocknumber % sets) * assoc
  14.  
  15.         //check if cacheindex in cache structure
  16.        
  17.         if(if cacheindex in cache structure)
  18.         {
  19.             hit++'
  20.         }
  21.         else(if cacheindex not in cache structure)
  22.         {
  23.             miss++;
  24.             //add cacheindex to cache
  25.         }
  26.  
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement