我在努力解決這個問題,我環顧四周,但所有類似的問題比我的更先進,利用日誌,這比我們在課堂上做得更先進。這裏的問題:設置關聯緩存:計算標記的大小?
Suppose you have a 4-way set associative cache which has in total 4096 bytes of cache memory and each cache line is 128 bytes. How many sets are there is this cache? If memory is byte addressable and addresses are 16 bits then how many bytes are used for the tag?
這是我到目前爲止有:
4096/128 = num lines
4096/128/4 = 8 = num sets (each set is 4 lines in 4-way set assoiative)
So, need 3 bits to choose set (2^3=8)
We have 16-3 = 13 bits left for the tag and word.
由於問題說內存是字節可尋址的,我認爲這意味着該字長爲8位(= 1字節),因此標記長度爲16-3-8 = 5位。
雖然我對此不太確定。有沒有人有解決這個問題?
謝謝。