8086 Microprocessor: The intel 8086 is a 16-bit microprocessor. It finds its application as the CPU in a microcomputer. The arithmetic logic unit, its internal registers, and instructions of the 8086 microprocessor are designed to work with the 16-bit binary word. Hence, the 8086 microprocessor is termed a 16-bit microprocessor.

The intel 8086 microprocessor features a 16-bit data bus. The 8086 microprocessor has the ability to read data or write data to memory and ports either 16-bit or 8 bits at a time. Also,  the 8086 microprocessor has a 20-bit address bus. Hence this processor has the ability to address any one of 220, or 1,048,576 memory locations.

Internal Architecture of 8086 Microprocessor

internal architecture of 8086 microprocessor

Figure: Block diagram of the internal architecture of 8086 microprocessor

As the figure shows, the 8086 microprocessor is divided into two independent functional parts:

1.Bus Interface Unit

2.Execution Unit

Bus Interface Unit (BIU) of 8086 Microprocessor

The Bus Interface Unit of 8086 microprocessor manages all the data and addresses transfers for the Execution Unit (EU) like sending address, fetching an instruction, reading data from the memory/ports as well as writing data to the ports/memory. The Execution Unit of the 8086 microprocessor has no direct connection to the system bus so this is possible with BIU. The BIU and EU are connected by an internal bus as shown in the block diagram above.

The BIU of 8086 microprocessor has the following functional parts:

1. Instruction Queue

The Bus Interface Unit of the 8086 microprocessor contains an instruction queue. BIU gets up to six bytes of the next instructions and stores them in the instruction queue. When the Execution unit executes an instruction and is ready for the next instruction, it simply reads the instruction from the instruction queue resulting in increased execution speed. Pipelining is the process of fetching the next instruction cycle when the current instruction is being executed.

2. Segment Register

The BIU of 8086 microprocessor has 4 segment buses i.e. CS, DS, SS & ES. Ts holds the address of instructions and data in the memory which are used by the processor to access memory locations. It also contains one pointer register IP.

(i) Code Segment Register (CS)

The base of the current code segment is contained by the code segment register of the 8086 microprocessor. It finds its application in addressing a memory location in the code segment of the memory where the executable program is stored.

(ii) Data Segment Register (DS)

The data segment contains the starting address of the program’s data segment. It is accessed in the data segment by an offset address or the content of the other register that holds the offset address.

(iii) Stack Segment Register (SS)

The stack segment register of the 8086 microprocessor contains the starting address of a program’s stack segment. The current word in the stack that is addressed is indicated by the segment address plus an offset value in the stack pointer.

(iv) Extra Segment Register (ES)

The ES of the 8086 microprocessor is an additional data segment used by some strings to hold extra data. The string instructions always use the ES and destination index (DI) to determine the 20-bit physical address.

(v) Instruction Pointer Register (IP)

The Instruction Pointer is a 16-bit register. IP is responsible for holding the distance or offset from this address to the next instruction byte to be fetched.

Execution Unit (EU)

The execution unit of the 8086 gives instructions to the bus interface unit stating from where to fetch the instructions or data from, decode the instructions, and execute those instructions.

The main function of the EU of the 8086 microprocessor is to control operations on data using an instruction decoder and ALU. It has no direct connection with the system and performs over data through BIU.

The EU includes an arithmetic and logic unit (ALU), a control unit, and a set of registers.

1. ALU

The arithmetic and logic unit performs all the arithmetic and logical operations like add, subtract, OR, AND, NOT in the 8086 microprocessor.

2. General-Purpose Registers

The 8086 microprocessor has 8 registers AH, AL, BH, BL, CH, CL, DH, DL. Individually, these registers can store 8-bit data, and in pairs, they can store 16-bit data. The valid register pairs are AHAL, BHBL, CHCL, DHDL. They can be represented as AX, BX, CX, and DX.

a. AX Register

The AX register is called a 16-bit accumulator and AL is called the 8-bit accumulator. For inputting/outputting data from or to I/O ports, the I/O (IN or OUT) instructions often use AX or AL.

b. BX Register

The BX register of the 8086 microprocessor is known as the base register. It is used to store the starting base address of the memory field within the data section. It is also used as an index to extend addressing. BX can also be used as a foundation register in conjunction with DI or SI for special addressing.

c. CX Register

The contents of the CX register of the 8086 microprocessor are used as a counter in certain instructions such as SHIFT, ROTATE, and LOOP.

d. DX Register

The DX register of the 8086 microprocessor is known as the data register. It is used to hold the I/O port address during the I/O instructions.

3. Stack Pointer Register (SP) and Base Pointer Register (BP)

Both the SP and BP registers in the 8086 microprocessor are used to access data in the stack segment. During the execution of instructions, the SP is used as an offset from the current stack section. The contents of SP are automatically updated (increment/decrement) during the execution of a POP and PUSH instruction. The offset address in the current stack section is stored in the BP. Instructions that use the based addressing mode make use of this offset.

4. Index Register

The two index registers SI (source index) and DI (destination index) o the 8086 microprocessor are used in indexed addressing. The instructions that process data strings use the SI and DI index registers, along with DS and ES, to differentiate between the source and destination address.

5. Flag Register

The flag register of the 8086 microprocessor is also known as the status register. It is a 16-bit register that can be used as a flipflop as its status changes according to the result. The control bit in the flag register can be set or reset by the programmer. It has 9 flags and they are divided into two groups: Conditional flags and Control flags.

8086 Microprocessor Flag Register

Conditional flags

These flags reflect the outcome of the most recent arithmetic or logical instruction. Following is the list of conditional flags of the 8086 microprocessor:

a. Carry flag(C)

This flag is set in an 8086 microprocessor when there is a carry out of MSB in addition or borrow in subtraction.

b. Parity flag (P)

This flag is set to 1 if the lower byte of the result contains an even number of 1’s otherwise reset.

c. Auxiliary Carry flag (A)

This is set if there is carry from the lowest nibble during addition or borrow from the lowest bibble during subtraction in an 8086 microprocessor.

d. Zero flag (Z)

If the product of arithmetic or logical operations is zero, this flag is set to 1, otherwise, it is set to 0.

e. Sign flag (S)

This flag bears the result’s symbol. i.e. when the result of the operation is negative, the sign flag is set to 1 else it is set 0.

f. Overflow flag (O)

This flag indicates what happens when the system’s capability is surpassed.

g. Control flags

Control flags govern the execution unit’s activities. They are:

h. Trap flag (T)

This flag is used for single-step monitoring and helps the user to debug by executing one instruction at a time. If it is set, then the program can run in a single-step mode.

i. Interrupt flag (I)

It is an interrupt enable/disable flag i.e. It is used to authorize or prevent program interruption. It is set 1 for interrupt enabled condition and set 0 for interrupt disabled condition.

j. Direction flag (D)

This flag is used for string manipulation instructions. If this parameter is set to0, the string is processed from the lowest to the highest address. i.e. the string is processed from the highest address to the lowest address unless the auto-incrementing mode is used i.e. auto decrementing mode.