Memory Addressing

addressingmemory

How many bits would you need to address a 4M X 8 memory if

  1. the memory is byte-addressable?
  2. the memory is word-addressable with a word size of 16 bits?
  3. the memory is word-addressable with a word size of 32 bits?

For #1, I have understood the solution as 4M = 22 x 220 = 222 = 22 bits.

For #2 and #3, the answers provided in our lecture was:

  • 4M X 8 bit memory requires 21 bit addresses if it is word-addressable and word size is 16 bits.
  • 4M X 8 bit memory requires 20 bit addresses if it is word-addressable and word size is 32 bits.

Question:
How did it arrive to 21 and 20 bit addresses for 16-bit and 32-bit word sizes respectively?

EDIT:

Homework:
How many bits would you need to address a 2M X 32 memory if

  1. the memory is byte-addressable?
  2. the memory is word-addressable with a word size of 32 bits?

Solutions:

  1. 2M = 2 x 220 = 21 x 220 = 221 = 21 bits
  2. 21 – [log 2 (32/32)] = 21 – [log 2 (1)] = 21 – 0 = 21 bits

Are my solutions correct?

Best Answer

Yes, your solutions for the homework are correct. Note that for the 4Mx32 you only use 8 bits per 32 bit word. If you want to use all bits you'd need a 32-to-8 multiplexer/demultiplexer.

#2 and #3 of the lecture are a bit confusing. If the memory is word-addressable with 16-bit words, it's no longer a 4Mx8 memory but a 2Mx16 memory. To address 2M words you need 21 bits. Similar for #3.