2

I am looking to determine Binary address, tag, index, and Hit or miss of a cache with 16 one-word blocks and one which uses 8 2-word blocks all assumed empty at the begginning

Say I have the referenced instructions 4, 4, 32, 31, 5, 32

For the first cache (16 one word blocks) you must first convert 4 to binary then that binary value is split to get tag then if you find that index again it will be mark as a hit

That being said, I believe the table below to be correct using this method.

Ref | Binary |  Tag  | Index | Hit or Miss
 4   00000100   0000   0100      miss
 4   00000100   0000   0100      hit
32   00100000   0010   0000      miss
31   00011111   0001   1111      miss
 5   00000101   0000   0101      miss
32   00100000   0010   0000      hit

I wish to do the same for the the second cache(8 two-word blocks) however I am unsure how to continue.

I figure the binary is the same for the numbers however I am confused on how to determine tag and index from it and whether there was a hit or a miss on the same referenced instructions as the first cache.

How would one determine the tag, index, and whether or not it was a hit or miss in this cache?

4

1 回答 1

4

它的不同之处在于您有一半的高速缓存行可供使用,在高速缓存行内提供 4 位标记、3 位索引和 1 位位移(指示两个字块的哪个字被寻址)。对于给定的示例,由于访问 4 获取 5 以及更广泛的获取将获得一个额外的命中。

Ref | Binary |  Tag  | Index | Disp |  Hit or Miss
 4   00000100   0000   010     0       miss
 4   00000100   0000   010     0       hit
32   00100000   0010   000     0       miss
31   00011111   0001   111     1       miss
 5   00000101   0000   010     1      *hit
32   00100000   0010   000     0       hit
于 2013-11-12T02:47:41.470 回答