Hi,all
In the flexus-4.1/components/FastCache/StdCache.hpp file, we use this function 
to get the set no:
 int32_t get_set(uint64_t addr) {
    return (addr >> blockShift) & blockSetMask;
  }
and blockShift = log_base2(theBlockSize); blockSetMask = (theNumSets - 1); 
For example, we set L1i cache's size 32KB, the block size is 64B, the assocs is 
2, and so blockShift is 6, blockSetMask is (32K/64/2-1)=255.
So we shift right of the addr for 6 position, and then get the last 8 bits of 
the shifted addr to get the set no?
I feel a bit confused about the blockShift. I think we should shift  
log_base2(theBlockSize*assocs) to get the set no. We find the set first, and 
then find the block in the set. If we used  log_base2(theBlockSize), the 
blockSetMask contains the way of a block, and there is no need to compare the 
tag to find the way in the set.
Does sth I misunderstand or is this a bug?
Look forward your reply. Thank you.
2013-08-21



Best Regards!
MAIL: [email protected]

Reply via email to