How to find the memory from address range? Really simple. Urgent.

Thread Starter

Dorumon

Joined Oct 8, 2009
24
Erm... 07FFFF = 524287

So I have 524287 memory address

So each address has 3 bytes because 1 byte = 8 bits.

So I have 524287 x 3 = 1572861 bytes

1572861/1024 = 1535?

Hey tats wrong.
 

Thread Starter

Dorumon

Joined Oct 8, 2009
24
Erm why? I though we are suppose to find the memory size?

Okie fine, I know how to find it take the decimal and / 1023, I just don't understand why.
 

Papabravo

Joined Feb 24, 2006
21,159
The number of things in a range can be found from the following relationship
Rich (BB code):
(Upper_Limit - Lower_Limit) + 1
Example 1 - How many integers are in the range 3 to 18?
Answer (18 - 3) + 1 = 16

Example 2 - How many addresses in the range 0x00000 to 0x7FFFF?
Answer (0x7FFFF - 0x00000) + 1 = 0x80000
Convert Hex to Decimal to find
0x80000(Hex) = 524,288 Bytes

Example 3 - How many kibibytes are there in 524,288?
http://en.wikipedia.org/wiki/Kibibyte

Answer 524,288 / 1024 = 512 Kibibytes

Example 4 - How many kilobytes are there in 524,288 where "kilo-" has its standard SI meaning
Answer 524,288 / 1000 = 524.288 kilobytes

Lastly if you want to multiply by the number of bits in a data word and express the resulting size in bits you can of course do that.

Clear enough or did I just muddy the waters?
 

Thread Starter

Dorumon

Joined Oct 8, 2009
24
Ah I see. I understand now.

Just one thing.

Isn't each memory address like 3 bytes. Because H'000000

So how is it we can find the memory just by finding the number of memory address/1024? without multiplying by 3 first?
 

Papabravo

Joined Feb 24, 2006
21,159
I think you may be confusing the number of bytes in the address with the number of bytes at each address. In a byte addressable memory each address corresponds to exactly one byte. Words are located at even addresses and can be either big-endian or little-endian. Similarly long words are at addresses that are a multiple of four and again can be big or little endian
 
Top