I'm doing a question on architecture and I've come across this question which I do not understand how to answer the question.
Q. How many bits are required to address 4G x 32-bit main memory if
a) Main memory is word addressable b) Main memory is byte addressable
I have read this question Word- or byte-addressable? Correct terminology but it did not clear up my understanding of the question as I am NOT asking what is the difference between byte and word addressable, more specifically I want to understand this question I've written.
The answer given says we need 34 bits for byte addressable memory and 32 bits for word addressable memory. I have thought about this for a while and have come to this conclusion which I do not know if it is correct or not:
Each row in the main memory is 32 bits in width and if it is byte addressable then we have 4 bytes in each row. To select a byte from the row requires log2(4) = 2 bits. Row width + 2 = 34 bits? Similiar concept for 32 bits. Is this correct logic?
Asked By : Nubcake
Answered By : D.W.
The error in your solution comes where you say "Row width + 2?" To select a byte in memory, you must (a) select a row, and (b) select a column.
Let's see how this works out for the byte-addressable case. As you say, selecting a column takes 2 bits, since there are 4 columns. However, the number of bits to select a row is log2(number of rows), not the row width [the row width is irrelevant]. So, figure out how many rows there are, then take the binary logarithm of that, and add 2 to it -- you'll get the correct number of bits needed to address byte-addressable memory.
The same methodology can be applied for the word-addressable case. Just count the number of bits needed to select a row, and the number of bits needed to select a column.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/41650
0 comments:
Post a Comment
Let us know your responses and feedback