Memory Mapping in a Microprocessor

The microprocessor does there major functions: 

1. Read from Memory to internal register

2. Write to Memory from internal register

3. Execute using internal registers

The microprocessor does not execute using external memory. It performs the execution using its internal registers. So Microprocessor performs two major activities externally. Read from Memory and Write to Memory are these two major activities.
Let us discuss a generic microprocessor which has 16 address and 8 data lines.

In this case, the Microprocessor can access up to 64 K locations because it has 16 address lines (2^16 = 64K). Since this microprocessor has 8 data lines each location contains 8 bits (1 byte).

Now let us see the address range of Microprocessor
Since representing in binary is quite laborious, we use Hexa-Decimal Representation which is nothing but a short form of Binary. 

So the microprocessor which has 16 address lines can address 0000 - FFFF locations. The same way the 64K memory has 16 address lines has locations 0000 - FFFF. Since both are identical and made for each other. Every address location addressed by Microprocessor has a corresponding location in Memory. Every address of Microprocessor is mapped to every location of Memory (0000 -> 0000, 0001 -> 0001, 0002 -> 0002, FFFE -> FFFE, FFFF -> FFFF). This is the simplest Memory Mapping. 1 Microprocessor, 1 Memory, and Microprocessor to memory are directly connected.

Let us assume the Memory is RAM.
The above memory map is very simple because there is only one device and that also has the maximum size addressable by Microprocessor.

Now let us consider how to connect two devices of 32K size.

Now we have two 32K devices. 
Since we have multiple devices, we have introduced a new signal to select the Chip or we can call that signal Chip Select. Now let see how to introduce the Chip Select in the above 32K device. 
Now let us connect two 32K memories with the microprocessor and see how CS signal is used . 
In the above diagram, Microprocessor gives 16 Address line A0 - A15. But the memories have only 15 Address lines A0 - A14. So the 15 Address lines A0 - A14 are connected to the Memories and the address line A15 is used to select the Chip. If A15 is 0, Device #1 is selected and if A15 is 1, Device #2 is selected. Now let see how to create a Memory map for this circuit. Individually both the memories are 32K. So their address Range is 0000 - 7fff (000 0000 0000 0000 - 111 1111 1111 1111). But when both the memories are placed inside the circuit, the address line A15 decides which Device has to be selected. Since A15 = 0 selects Device #1 and A15 = 1 selects Device #2, here is the address Range 

Device #1 - 0000 0000 0000 0000 - 0000 to 0111 1111 1111 1111 = 0000 - 7FFF

Device #2 - 1000 0000 0000 0000 - 8000 to 1111 1111 1111 1111 = 8000 - FFFF
So Memory Map in a Microprocessor-based is system is nothing but the address range (Low - High) of each device within the available address space. For example, in the above design, we have two devices. The available address space is 64K, because the microprocessor has 16 address lines (2^16). Device #1's address range is 0000 - 7FFF and Device #2's address range is 8000 - FFFF. 

If the microprocessor has 16 address bits then we can connect the devices with the following memory sizes.

64K - 2^16 : 32K - 2^15 : 16K - 2^14 : 8K - 2^13

4K - 2^12 : 2K - 2^11 : 1K - 2^10 : 512 - 2^9

256 - 2^8 : 128 - 2 ^ 7 : 64 - 2 ^ 6 : 32 - 2^7

16 - 2^4 : 8 - 2^3 : 4 - 2^ 2 : 2 - 2^1

1 - 2^0

So we have devices with 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1K, 2K, 4K, 8K, 16K, 32K and 64K size are used with Microprocessor which has 16 address lines. We can have any number of devices connected with the Microprocessor.

source: http://www.idc-online.com/technical_references/pdfs/electrical_engineering/Microprocessors_memory_map.pdf
Quora-Balajee

Comments

Popular posts from this blog

FPGA In Layman''S Terms

BOARD BRING-UP

High Speed Digital Design Considerations