Guest User

Untitled

a guest
Jun 20th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. int SharedCache::replaceLine(ullong address){
  2. int evictPID = -1;
  3.  
  4. int cacheSet = calcCacheSet( address );
  5. //random uniformly-distributed value for cache line
  6. float numLines = static_cast<float>(CACHE_LINES_PER_SET);
  7. uint cacheLine = static_cast<uint>(uniformDistr( numLines ));
  8.  
  9. if(cache[cacheSet][cacheLine] != NULL){
  10. evictPID = cache[cacheSet][cacheLine]->PID;
  11. }
  12.  
  13. uint PID= calcPID(address);
  14. uint tag= calcTag(address);
  15.  
  16. cache[cacheSet][cacheLine]->setLine(PID, tag); //mutex method
  17.  
  18. return PID;
  19. }
  20.  
  21. gcc -o my_program SharedCache.o -ldistributions
  22.  
  23. gcc -o my_program SharedCache.o distributions.o
Add Comment
Please, Sign In to add comment