Reputation: 51
I am currently studying basic ccomputer architecture and require help solving the following:
How many bits are required to address a 4M x 16 main memory if:
a) The memory is byte addressable?
b) The memory is word addressable?
The answer is, like in most cases located in the back of the text book, but I want to know how to work it out.
Thanks in advance!
Upvotes: 1
Views: 17033
Reputation: 1
That is incorrect Individual bits are not addressable. Admittedly, the memory contains
4M * 16 bits = 2^22 * 2^4 = 2^26 bits
but it is the byte or word count that is used for the addressing.
Upvotes: 0
Reputation: 24145
4M x 16 = 64Mb of memory = 67108864 bytes or 33554432 words (word is usually 2 bytes)
this means that last byte in memory will have address: 0x3FFFFFF (67108864-1) = 26 bits
last 2 byte word will have address: 0x1FFFFFF (67108864/2-1 = 33554432-1) = 25 bits
and if we consider 4 byte word - we have latest address 0xFFFFFF (67108864/4-1) = 24 bits
UPDATE: I wrongly multiplied 4M by 16, actually 16 here is number of bits, so correct calculations will be:
4M x 16 = 4 194 304 cells, each cell is 16 bit = 2 bytes
To address each byte, you need 4 194 304 * 2, so last byte will have address (0x800000-1) = 7FFFFF, ie 23 bits
To address each word (2 bytes), you need 4 194 304, so last word will have address 0x3FFFFF, ie 22 bits
Upvotes: -1
Reputation: 1463
If you are working on Chapter 4, No. 5 of Null and Lobur, here's the answer:
a) 23 bits
4M * 16 = 2^2 * 2^20 * (2^4 / 2^3) (16 bits / 8 bits is a byte) = 2^2 * 2^20 * 2^1 = 2^23 => 23 bits.
b) 22 bits
Assuming a word is 16 bits or 2 bytes long (reasonable assumption in Null and Lobur especially if you look the previous exercise (No. 4).
4M * 16 = 2^2 * 2^20 * (2^4 / 2^4) (16 bits / 16 bits is a word) = 2^2 * 2^20 * 2^0 = 2^22 => 22 bits.
Upvotes: 5
Reputation: 81
Lashane is incorrect despite being erroneously upvoted. We're talking about being byte addressable, not bit addressable. In reality, we should end up with 23 bits on a byte addressable system and 22 bits on a word addressable system (assuming the word size is 16 bits wide):
Byte addressable: 4M x 16 = 2^2(4) x 2^20(1m) x 2^1 (2 bytes, or 16 bits) = 2^23, or 23 bits
Word addressable: 4M x 16 = 2^2(4) x 2^20(1m) x 2^0 (1 word, or 16 bits) = 2^22, or 22 bits
Hopefully this clears up any confusion that Lashane may have caused...
Upvotes: 8