1
votes

Considering a machine with a byte-addressable main memory of 256 Kbytes and a block size of 8 bytes. With a set associative mapped cache consisting of 32 lines divided into 2-line sets.

  1. How many bytes will be stored in the cache?
  2. How many bits are there in the main memory address?
  3. How is the main memory address divided up to provide the mapping to the cache?
  4. Into which set would the byte with the following address be stored - 110101010101011010?

Explanations as to why would be extremely helpful as i'm trying to understand how to work these out for further understanding.

1

1 Answers

1
votes

Before your answer let's look at some calculations(see log as log to the base 2):

i) Number of Sets= 32/2 =16. Hence number of bits required to point address a set= log 16=4.

ii) Number of bits to be left aside as offset within a line= log 8 =3. 8 is the block or line size here.

iii) Number of blocks in RAM = 256KB /8 = 2^15.

  1. The cache can hold at max 32 X 8 = 256 bytes.(this is independent of mapping technique used)
  2. The main memory address has to be 18 bits.(Since size of RAM is 256 X 8 = 2^18 and log(2^18)= 18.
  3. Main memory isn't actually divided, though you may view it as being logically partitioned into 16(no. of sets) different regions consisting of 2^11 lines each, such that every line in that region will get mapped in a particular set only. Since there are 2^15 blocks,dividing 2^15 by 16 gives the number 2^11.
  4. 110101010101011010: In this address first leave aside last 3 bits for offset, the next four bits are 1011 equivalent to 11 in decimal. hence this would fall into 11th set.