Memory segmentation & 20-bit Physical address generation

 

Memory segmentation:

        The 8086 microprocessor is capable of accessing 1MB of memory. The memory is segmented into 4 parts called as

1) Code segment:       Used to store program code.

2) Data segment:        used to store data.

3) Extra segment:      Also used to store dada whenever the size of data is large.

4) Stack segment:      Used to return addresses in case of interrupt related operation.


 Fig.  Memory Segmentation

 

            The size of each segment is 64kb. At a particular time 8086 can work with 4 segments.

            The base address of each segment is stored in segment registers. For generating 20 bit physical address of 8086 adds an offset address (distance from base) with base address. For each segment there is default pair of registers in which base & offset address. Table below shows these default pairs.

Segment

(Base Address)

Offset

Special Purpose

CS

IP

Instruction address

DS

BX, DI, SI, 8/16 Bit Number

Data  address

SS

SP/BP

Stack Address

ES

DI

String destination address

















20-bit Physical address generation / Real mode memory addressing 

            The memory of 8086 is segmented into 4 different parts i.e. code segment, data segment, extra segment and stack segment. The size of each segment is 64KB. The maximum size of internal registers of 8086 is 16 bits. Therefore, we can store maximum 16-bit address of memory in internal registers of 8086, by using 16 bit address we can address up to 64KB memory (216 = 64 KB). But for reading or writing code & data from memory 8086 outputs 20 bit physical address to memory. Therefore in 8086, 20-bit physical address is generated by adding two 16-bit logical addresses. (Logical addresses are those addresses that are used in program). Figure below shows this.


Suppose 8086 wants to read a program code byte stored at address 346E7H in code segment. This 20 bit physical address is generated by adding based address in code segment register with offset address stored in IP register as follows



The base address in segment register is shifted to left by 4-bits by adding a zero at LSB position of base address. Since these 4 bits are inserted by Microprocessor automatically they are called as hard wired zeros.




Post a Comment

3 Comments