November 24th, 2013, 03:08 AM

Memory Addressing
How many bits would you need to address a 2M X 32 memory if
1) the memory is byteaddressable?
2) the memory is wordaddressable with a word size of 32 bits?
Solutions:
1) 2M = 2 x 2^20 = 2^1 x 2^20 = 2^21 = 21 bits
2) 21  [log 2 (32/32)] = 21  [log 2 (1)] = 21  0 = 21 bits
I am feeling a bit iffy for #2. Can someone help?
November 24th, 2013, 03:18 AM

Obviously for byteaddressed memory result should be 2 bits larger than for wordaddressed memory.
Number of bits is log2 of the number of choices. In the first case you have 2M choices for 32bit words and 4 choices inside each word (since 32bit word contains 4 bytes of 8 bit each).
In the second case you have only 2M choices. Each choice uniquely identifies the word.
I'm sorry, but your formula for #1 is a kind of mess  perhaps some of these equals signs do not mean equality?
CodeAbbey  programming problems for novice coders
November 24th, 2013, 06:42 AM

Originally Posted by rodiongork
#1 is a kind of mess  perhaps some of these equals signs do not mean equality?
They do mean equality.
mega (M) = 2^20
Therefore:
2M
= (2) x (2^20)
= (2^1) x (2^20)
= 2^21
I arrived to 21 bits by taking the exponent.
Originally Posted by rodiongork
Obviously for byteaddressed memory result should be 2 bits larger than for wordaddressed memory.
Does this mean #2 should be 19 bits?
November 24th, 2013, 06:51 AM

I meant the last equality:
Does this mean #2 should be 19 bits?
I think it is bad idea to try guessing.
What do you mean by "2M x 32"  perhaps we are speaking of different things?
For example, try to solve the same task for "2 x 32"  i.e. for only 2 words of 32 bit.
CodeAbbey  programming problems for novice coders
November 24th, 2013, 07:40 AM

Ah yes, the last "equality" just means "therefore" it is 21 bits for byteaddressable memory.
2M x 32 = L x W (from our lecture)
I did ask the question at Electrical Engineering Stack Exchange and I got the following formula for wordaddressable memory:
Byteaddressable bits  log 2 (word size / Width)
Our lecture example was 4M x 8, where 22 bits (4M = 2^22) are needed for byteaddressable memory.
However, no solution was given for wordaddressable memory:
 4M x 8 bit memory requires 21 bit addresses if it is wordaddressable and word size is 16 bits
 4M x 8 bit memory requires 20 bit addresses if it is wordaddressable and word size is 32 bits
Applying the formula did yield the answers provided in our lecture example.
I am wondering if it is possible to have the same number of bits for byteaddressable and wordaddressable as can be seen in the homework problem 2M x 32?