2,048 Block Frames Starting From B B 0 2,047 - So That R 11 Bits.

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

8

Problem 5.9 – Consider a cache ( M1 ) and memory ( M2 ) hierarchy with the following

characteristics :

M 1 : 16 Kwords, 50 ns access time.

M 2 : 1 Mwords, 400 ns access time.

Assume eight-word cache blocks and a set size of 256 words with set-associative mapping.

a. Show the mapping between M 2 and M 1 .

b. Calculate the effective memory access time with a cache hit ratio of h = 0.95 .

Answers :

a. Mapping between M 2 and M 1 . From the above statement we collect some

information such that :

) 1 block = 8 word → b = 23 ↔ w = 3.

) 16 Kwords cache = m ↔ m = 214 words = 214− 3 = 211 block frames or

2, 048 block frames starting from B0 − B2,047 . So that r = 11 bits.

) 1 Mwords memory = n ↔ n = 220 words = 220− 3 = 217 memory blocks or


131, 072 blocks starting from B0 − B131,071 . So that s = 17 bits.

) Set size, k = 256 = 28 words or k = 28− 3 = 25 blocks. There will be 32-way

m 211
associativity. Then, number of sets, v = = = 26 or 64 sets starting from
k 25
S0 − S63 . Hence, each set will consist of 32 block frames. The bit set number,

d = log 2 v = 6 bits.

) Word field = 3 bits.


) Set field = 6 bits to cover 64 sets of the cache memory.
) Tag field = s − d = 17 − 6 = 11 bits.

Arwin – 23206008@2006
9

Mapping Table

Set Number Block Frame Number Memory Block Number


(6 bits) (32-way associativity)

B0 , B1 , ......., B32
0 (000000) 0, 64, 128, ……, 131008

1 (000001) B33 , B34 , ......., B63 1, 65, 129, ……, 131009

2 (000010) B64 , B65 , ......., B95 2, 66, 130, ……, 131010

3 (000011) B96 , B65 , ......., B127 3, 67, 131, ……, 131011

………….. …………. ……………….

36 (100100) B1152 , B65 , ......., B1183 36, 100, 167, ……, 131047

………….. …………. ……………….

63 (111111) B2016 , B65 , ......., B2047 63, 127, 191, ……, 131071

Arwin – 23206008@2006
10

The mapping scheme is as followed :

Arwin – 23206008@2006
11

b. The effective memory-access time can be derived as followed :

The general formula for effective memory-access time is :

n
Teff = ∑ f i .t i where n is nth -memory hierarchy.
i =1

Because f i = (1 − h1 )(1 − h2 ) ........ (1 − hi −1 ) hi , the above formula can be rewritten as

Teff = h1t1 + (1 − h1 ) h2 t 2 + ............ + (1 − h1 ) h2 t 2 ....... (1 − hn −1 ) t n

What we’ve got are :

) Cache ( M 1 ) access time, t1 = 50 ns

) Memory ( M 2 ) access time, t 2 = 400 ns

) Cache hit ratio, h1 = 0.95 and the access to the outermost memory, M 2 , is always

hit or h2 = 1

So, the effective memory-access time is :

Teff = h1 t1 + (1 − h1 ) h2 t 2
= ( 0.95 )( 50 ) + (1 − 0.95 )(1)( 400 )
= 47.5 + 20
= 67.5 ns

Arwin – 23206008@2006

You might also like