Domanda

In particolare:

1) A scalo mappato della cache con 4096 blocchi / linee in cui ciascun blocco contiene 8 parole di 32 bit. Quanti bit sono necessari per i campi tag e indice, ipotizzando un indirizzo a 32-bit?

2) stessa domanda 1), ma per completamente associativa della cache

mi corregga se sbaglio, è vero:

bit tag = lunghezza del bit indirizzo - esponente del index - esponente del compensati?

[è l'offset = 3 a causa di 2 ^ 3 = 8 o è 5 da 2 ^ 5 = 32?]

È stato utile?

Soluzione

The question as stated is not quite answerable. A word has been defined to be 32-bits. We need to know whether the system is "byte-addressable" (you can access an 8-bit chunk of data) or "word-addressable" (smallest accessible chunk is 32-bits) or even "half-word addressable" (the smallest chunk of data you can access is 16-bits.) You need to know this to know what the lowest-order bit of an address is telling you.

Then you work from the bottom up. Let's assume the system is byte addressable.

Then each cache block contains 8 words*(4 bytes/word)=32=25 bytes, so the offset is 5 bits.

The index for a direct mapped cache is the number of blocks in the cache (12 bits in this case, because 212=4096.)

Then the tag is all the bits that are left, as you have indicated.

As the cache gets more associative but stays the same size there are fewer index bits and more tag bits.

Altri suggerimenti

Your formula for tag bits is correct.

Whether the offset is three bits or five bits depends on whether the processor uses byte (octet) addressing or word addressing. Outside of DSPs, almost all recent processors use byte addressing, so it would be safe to assume byte addressing (and five offset bits).

I'm learning for the final exam of subject Computer System, I googled for a while and found this question. And this part of the question is confuse : "in which each block has 8 32-bit words". A word is 4 bytes (or 32 bits) so the question just need to be "...in which each block has 8 words"

The answer is - Each block is 32 bytes (8 words), so we need 5 offset bits to determine which byte in each block - Direct-mapped => number of sets = number of blocks = 4096 => we need 12 index bits to determine which set

=> tag bit = 32 - 12 - 5 = 15

For fully associative, the number of set is 1 => no index bit => tag bit = 32 - 0 - 5 = 27

There are no index bits in a fully associative cache. The index bits are used to uniquely identify which set the block belongs. In a fully associative cache, all blocks are essentially part of the same set.

in full associate mapping index is 0 b/s like you say set = 1 so index=log of 1 in base 2 =0 set offset =log of block size of byte base 2 so use 8=2^3 or 32=2^5 tag=32-0-5=27 for direct index=2^12=12 offset=0 bit tag= 32-12-0=20

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a cs.stackexchange
scroll top