推 gmotwm2001:3Q~第一行讓我笑了XD..戴眼鏡的.. 01/15 16:10
※ 引述《gmotwm2001 (yabi)》之銘言:
: Consider a two-way set associative cache which has 12 blocks,a four-word block
: size ,and a 32-bit adderss.
: (a)How many bits are required for this cache,including tag and valid fields?
: 我的算法是
: 12/2=6 sets 所以index的bits=3 bits
: |-----------|-------|-----|------|
: 25bits 3bits 2bits 2bits
: 25 bits=>tag
: 3 bits=>index
: 2 bits=>block address
: 2 bits=>word address
: (25+1+4*32)*12=1848bit
: 解答是
: 12/2=6 index=2bit
: 32-4-2=26
: 12*(1+26+4*32)=1860
這一題,剛剛我隔壁那個戴眼鏡的和我說
如果你用3個bit去記錄的話
有可能會有多出來的記憶體位罝
但是如果你用2個bit去當index的話
雖然會少了一些位罝
但是這並不會有非法的位置出現
只是少了一些空間上的利用而已
至基本上這一題應該是出錯了吧
2可能也是一個比較好的答案啦
應該還是要2的次方數才可以啦
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.225.140.95