calculation of address lines

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Kindly guide me with the following question:
Let's suppose computer's memory is composed of 8k words of 32 bits each. How many bits are required for memory address?
I know for 1k we need 10 address lines. So for 2k it would 11. For 4k it would be 12. And for 8k, it should be 13. Is 13 correct answer?

Zulfi.
 

Papabravo

Joined Feb 24, 2006
21,225
Yes, and the formula is:

ciel(log_2(M))

where M is the size of the memory [in words or other addressable units]
log_2 is the logarithm to the base 2
ciel is the ceiling function, which is also known a smallest integer which is larger than or equal to the argument
 
Last edited:

WBahn

Joined Mar 31, 2012
30,052
Yes, and the formula is:

ciel(log_2(M))

where M is the size of the memory
log_2 is the logarithm to the base 2
ciel is the ceiling function, which is also known a smallest integer which is larger than or equal to the argument
But you need to recognize that M is the number of addressable words in memory, not the size of the memory. In this case, the total memory is 32kB or 256kb, but neither of those matter because there are 8k words and it is the words that are being addressed.
 

Papabravo

Joined Feb 24, 2006
21,225
But you need to recognize that M is the number of addressable words in memory, not the size of the memory. In this case, the total memory is 32kB or 256kb, but neither of those matter because there are 8k words and it is the words that are being addressed.
I did recognize that of course. Why did you assume I was talking about something else?
 

WBahn

Joined Mar 31, 2012
30,052
No. No. I had no doubt that you recognized it. I was just making the point explicit for the OP, who may or may not have caught the distinction. I suspect they did, since they got the right answer for the right reason, but some other noob coming across this thread may not.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your reply and feedback.
Let's suppose computer's memory is composed of 8k bytes of 8 bits each.
This means that the answer would be 13 even for the above memory dimensions.

Zulfi.
 

takao21203

Joined Apr 28, 2012
3,702
If you use real memory chips, you can see this information in the datasheet.

Counting always starts with 0.

It is simply 2 EXP number of bits.

255 - 1 byte - 8 bit (256 different values)
65535 ((2x 256 )- 1) - 2 byte - 1 word - 16 bit (65536 values)

This zero or one offset is a big trap for beginners.
 

WBahn

Joined Mar 31, 2012
30,052
If you use real memory chips, you can see this information in the datasheet.

Counting always starts with 0.

It is simply 2 EXP number of bits.

255 - 1 byte - 8 bit (256 different values)
65535 ((2x 256 )- 1) - 2 byte - 1 word - 16 bit (65536 values)

This zero or one offset is a big trap for beginners.
This is quite a tangent from the discussion, are you sure you replied to the thread you thought you were?
 

takao21203

Joined Apr 28, 2012
3,702
This is quite a tangent from the discussion, are you sure you replied to the thread you thought you were?
Not so much tangent as the address bit numbers don't automatically correspondend to the actual memory size.

It depends.

To me it is quite obvious OP did not read even one single memory IC datasheet.

Maybe it is a school question.

Memory on a piece of paper without any context or purpose.

If OP also writes WHY he wants to know about that?
 

WBahn

Joined Mar 31, 2012
30,052
The OP's question was just fine and there was sufficient info to answer the question and he did it right. There's no need to run to a data sheet to answer a question like this and if someone's level of understanding is such that they did need to run to a data sheet, then their fundamentals are seriously in question. Besides, the data sheet you posted isn't for a RAM that matches the question. It is an 8kB and his question uses a 32kB RAM. Both simply have 8k of addressable words and therefore need 13 address lines.
 

takao21203

Joined Apr 28, 2012
3,702
Yes I maybe did not understand the question properly.

An 8K 32bits deep RAM normally is composed from 8bit RAM chips. There are also 16bit RAMs but 32bit 8K RAMs are not known to me.

What I mean is OP should write more information about the circuit.
Or it is maybe just an isolated question about an imaginary paper memory.

I have read many documents from the 1970s and they are not always easy to understand- especially the schematics are large and use different standards.

That is the time when such memories were common, 8K or 16K.

So maybe he writes what kind of computers are examined.

The datasheet I show is not so much difficult.
 
Top