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

Thread Starter

#### Dorumon

Joined Oct 8, 2009
24
Like I have H'000000 to H'07FFFF

So whats the memory size in kb?

How do u get it?

#### JoeJester

Joined Apr 26, 2005
4,390
What is "07FFFF" hex to decimal?

#### mrmount

Joined Dec 5, 2007
59
Find 07FFF in decimal and you have that many memory addresses. Convert it into kilobytes.

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.

#### beenthere

Joined Apr 20, 2004
15,819
The number of addresses and the bits in the memory at each address are not related.

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.

#### t06afre

Joined May 11, 2009
5,934
Google is your friend, try a search like kilo byte. I am sure Wiki has something about it.

Thread Starter

#### Dorumon

Joined Oct 8, 2009
24
ERM... all I can find is 1 kb = 1024b... how does that has to do with anything?

#### retched

Joined Dec 5, 2009
5,208
Ok so you have x number of memory bytes, to find KB you
x / 1024

#### Papabravo

Joined Feb 24, 2006
16,173
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
16,173
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

Thread Starter

#### Dorumon

Joined Oct 8, 2009
24
Thanks thanks, I understand now!