作者jim055006 (jim)
看板Grad-ProbAsk
標題[理工] [計組]direct mapped cache
時間Mon Oct 31 22:30:05 2011
問題如下:
Assume the three caches below, each consisting of 16 words. Given the
series of address references as word addresses:2, 3, 4, 16, 18, 4, 2. Please
label each reference as a hit or a miss for the three caches (a), (b) and (c)
below. Assuming that LRU is used for each replacement algorithm and all the
caches are initially empty.
(a)a direct-mapped cache with 16 one-word blocks.
(b)a direct-mapped
cache with 4 four-word blocks.
(
c)For each of above (a)
and (b)
caches, how many misses are
compulsory misses?
(
d)For each of above (a)
and (b)
caches, how many misses are
conflict miss
es?
-------------------------------------------------------------------------------
答案如下:
(a
) direct-mapped cache with 16 one-word blocks.
address Block no. index tag H/M
---------------------------------------------------------
--
2 2 2 0 M compulsory miss
3 3 3 0 M compulsory miss
4 4 4 0 M compulsory miss
16 16 0 1 M compulsory miss
18 18 2 1 M
compulsory miss
16 16 0 1 H
4 4 4 0 H
2 2 2 0 M conflict miss
(b) direct-mapped cache with 4 four-word blocks.
address Block no. index tag H/M
-----------------------------------------------------------
2 0 0 0 M compulsory miss
3 0 0 0 H
4 1 1 0 M compulsory miss
16 4 0 1 M compulsory miss
18 4 0 1 H
16 4 0 1 H
4 1 1 0 H
2 0 0 0 M conflict miss
紅色閃爍的地方為什麼不是conflict miss?
有勞高手解惑一下...
鋼溫!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 223.139.197.100
推 CrazyBoss:張凡說不管cache有沒有data,只要這個binary addr第一次 10/31 22:44
→ CrazyBoss:進去cache就算了 10/31 22:44
推 mqazz1:我想你應該要先去看一下定義 10/31 22:49
→ jim055006:我看了....我一直以為區塊重未被使用過...第一次讀取 10/31 22:54
→ jim055006:此區塊,必不在cache中 10/31 22:55
→ jim055006:那個區塊不是只cache block嗎? 10/31 22:55
推 genius945:block指的應該是要從memory抓來的block 10/31 23:15
→ genius945:我懂原PO的意思,想成是空的cache區塊就是compulsory 10/31 23:16
→ jim055006:對!!我是這個意思....G大真懂我 10/31 23:17
→ genius945:但miss的本意是找不到所要的資料,重點要放在"要找的" 10/31 23:17
→ jim055006:我知道我想錯了...如果想成M.M block就都說得通了 10/31 23:18
→ jim055006:謝謝大家....我弄懂了....就甘心!! 10/31 23:19
推 da0910cc:課本有個地方,有說tag,index,direct,2-way等等的定義 11/01 10:34
→ da0910cc:我忘了在哪了,那邊看懂應該就沒問題了! 11/01 10:35