看板 Grad-ProbAsk 關於我們 聯絡資訊
※ 引述《mqazz1 (無法顯示)》之銘言: : 2-way set associative cache of 8K bytes data : The block size is 2 words with 4 bytes in each word. Assume that the total : cacheable physical memory is 16MB bytes. : ( 16MB ) : 請問index bit數 不是 lg(---------) = 10嗎? : ( 2 * 8KB ) : 可是書上說是9 bit 請問這要怎麼算? : 張凡下冊283頁 50題(1) cache總共是8K bytes , 共 8K/(2*4) = K 個 blocks 2-way set-associative , 再除2 , K/2 = 2^9 , index bit = 9 (16MB那是address的大小) : ============================================= : (1) a direct-mapped cache with 16 one-word blocks : (2) a dircet-mapped cahce with 4 four-word blocks : (3) a four-way set associative cache with block size of one-word : (1) (2) (3) : Decimal Binary Tag Index Tag Index Tag Index : 2 00010 0 0010 0 00 000 10 : 3 00011 0 0011 0 00 000 11 : 4 00100 0 0100 0 01 001 00 : 16 10000 1 0000 1 00 100 00 : 18 10010 1 0010 1 00 100 10 (1)一個block有 2^0 = 1 個word,offset bit有0個 , 2^4 = 16個block index bit有4個,剩下那個是tag bit (2)一個block有2^2個word , offset bit有2個 , 2^2 = 4個block index bit有2個 , 剩下那個是tag bit (3)一個block有 2^0 = 1 個word,offset bit有0個 , 16/4 = 2^2個set index bit有2個,剩下那三個是tag bit : 我大概知道是照binary去切割的 : 可是不太清楚這三種方法切割的規則 : 請問這個要怎麼算? : 張凡下冊291頁 : 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 1.174.9.4
mqazz1:謝謝 08/25 10:10