Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 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.         //add to cache
  13.         //blocknumber = tag + index
  14.         cacheindex = (blocknumber % sets) * assoc
  15.  
  16.         //check if cacheindex in cache structure
  17.        
  18.         if(if cacheindex in cache structure)
  19.         {
  20.             hit++'
  21.         }
  22.         else(if cacheindex not in cache structure)
  23.         {
  24.             miss++;
  25.             //add cacheindex to cache
  26.         }
  27.  
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement