Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate size of memory by given a range of address?

I have an exercice that I couldn't resolve it, I have 3 memory range :

      First @      Last @ 

range1: FD00 0000 to FDFF FFFF

range2 : D000 0000 to DFFF FFFF

range3 : FA00 0000 to FBFF FFFF

the question is :give the size of the memory for each range (Mega byte)?

what I know is that I should calculate size of the range = last address - first address so the result for the first range is : 00FF FFFF . Is this right? then what should I do? I have searched on the internet I didn't found an example

Please help

like image 925
Julie Avatar asked Jan 01 '13 18:01

Julie


People also ask

How do you determine memory size from address line?

Step 1: calculate the length of the address in bits (n bits) Step 2: calculate the number of memory locations 2^n(bits) Step 3: take the number of memory locations and multiply it by the Byte size of the memory cells.

What is the size of a memory with address range of 0x0000 to 0x1FFF?

The atmega16 data sheet says that it has 16KB on-chip flash program memory, but the memory map for flash memory ranges from 0x0000 to 0x1FFF(8192, i.e, 8KB) only, which gives a range of only 8KB flash memory. Also the program counter is only 13 bits wide, which can access only 8KB of memory.

How do I know my memory size?

Press Ctrl + Shift + Esc to launch Task Manager. Or, right-click the Taskbar and select Task Manager. Select the Performance tab and click Memory in the left panel. The Memory window lets you see your current RAM usage, check RAM speed, and view other memory hardware specifications.

What is the size of a memory address?

Each address identifies a single byte (eight bits) of storage. Data larger than a single byte may be stored in a sequence of consecutive addresses.


2 Answers

In your example for Range 1, you are correct. That is the size of the memory, stated in hexidecimal, in bytes.

You may gain the most insight by first converting 00FF FFFF to a decimal number, then converting that number of bytes into megabytes.

To convert from bytes to megabytes use the relationship

1 MB = 1 Megabyte = 1024 * 1 KB = 1,048,576 bytes.

There are tons of online Hex to Decimal converters. The calculator built in to Windows can also do the conversion.

For the other ranges, you again want to do subtraction to determine the size of the range, and then apply the steps above, e.g.

 FBFF FFFF
-
 FA00 0000
 ---------
 01FF FFFF

Having gone through those steps to better grasp what is happening, the following relationship will allow you to answer such questions faster:

0010 0000 = 1,048,576

So 1MB is the same as 0010 0000 (sometimes called 0x100000).

like image 82
Eric J. Avatar answered Sep 20 '22 07:09

Eric J.


Simple analogy, what is amount range (address) from 0 - 9? The answer is 10, not 9 because range/address 0 is counted.

So, Capacity = Last Address - First Address + 1.

Capacity for range1: FD00 0000 to FDFF FFFF will be FDFF FFFF - FD00 000 + 1 = FF FFFF + 1 = 100 0000 in hex Or 16777216 in dec (16MB).

like image 24
Rusj Avatar answered Sep 21 '22 07:09

Rusj