19
Introduction To 8086 : The main limitations of the 8 bit microprocessors were their low speed of execution ,low memory addressing capability, limited number of general purpose registers & a less powerful instruction set. All these limitations of the 8 bit microprocessors tempted the designers to go for more powerful processors in terms of advanced architecture , more processing capability and a more powerful instruction set. 8086 was a result of such development design efforts. Intel 8086 is a 16-bit µp that is intended to be used as CPU in microcomputer 8086 has 16-bit data bus,so it can read data from or write data to memory and ports either 16 bits or 8 bits at a time.

8086 Arch

Embed Size (px)

Citation preview

Page 1: 8086 Arch

Introduction To 8086 : The main limitations of the 8 bit microprocessors were their

low speed of execution ,low memory addressing capability, limited number of general purpose registers & a less powerful instruction set. All these limitations of the 8 bit microprocessors tempted the designers to go for more powerful processors in terms of advanced architecture , more processing capability and a more powerful instruction set. 8086 was a result of such development design efforts.

Intel 8086 is a 16-bit µp that is intended to be used as CPU in microcomputer

8086 has 16-bit data bus,so it can read data from or write data to memory and ports either 16 bits or 8 bits at a time.

Page 2: 8086 Arch

The 8086 has 20- bit address bus,so it can address any one of 220 (1048576) memory locations. Each of the 1048576 memory locations of 8086 represents a byte wide location. Sixteen bit words will be stored in two consecutive locations.If the first byte of the word is at an ODD address the 8086 will read the first byte with one bus operation & second byte with another bus operation. And if the first byte of a word is at an EVEN address the 8086 can read the entire word in one operation.

Page 3: 8086 Arch

8086 Internal Architecture :

The 8086 CPU is divided into two independent functional units so that dividing the work

between these two units speed up processing. These functional units are as follows:

BIU (Bus Interface Unit)EU (The Execution Unit)

Page 4: 8086 Arch

ESCSSSDSIP

AH ALBH BLCH CLDH DL

SPBPSIDI

EXECUTION UNITCONTROL SYSTEM

654321

Address adder (Σ)

Arithmetic & Logic Unit

OperandsFlags

C-busBIU

EU

Internal Block Diagram Of 8086 :

Instruction streamByte queue

A - bus

Memory Interface

B-bus

Page 5: 8086 Arch

The Bus Interface Unit (BIU):The BIU sends out addresses,fetches

instructions from the memory, reads data from ports & memory and writes data to ports

& memory. Its various functional parts are :The Queue

The Segment RegistersThe Instruction Pointer

Page 6: 8086 Arch

The QUEUE : While the EU is decoding or executing an instruction which does not require use of the buses , the BIU fetches up to six instruction bytes for the following instructions & stores these prefetched bytes in a FIRST-IN-FIRST-OUT register set called QUEUE . When the EU is ready for its next instruction ,it simply reads the instruction bytes for the instruction from the queue in the BIU. This is much faster than sending out an address to the system memory & waiting for memory to send back the next instruction byte or bytes.As the time required to access registers is less than the time required to access the memory , it increases the overall processing speed of the microprocessor. Fetching the next instruction while current instruction

executes is called as “PIPELINING”.

Page 7: 8086 Arch

The Segment Registers : The address of the memory bytes need to be accessed is generated with the help of segment registers . The BIU contain four 16-bit registers : Code Segment Data Segment Stack segment Extra Segmentthese segment registers are used to hold the upper 16-bits of the starting address of the logical group of the memory,called the segment,that 8086 is working with a particular time.

Page 8: 8086 Arch

Logical Organisation Of 8086 memory:

8FFFF H

80000H

6FFFF H

64K

64K

64K

64K

60000 H

5489F H

448A0 H

3FFFF H

30000 H

Top of extra segment

Extra segment base ES= 8000 H

Top of stack segment

Stack segment base SS= 6000 H

Top of code segment

Code segment base CS= 448A H

Top of data segment

Bottom ofData segment DS= 3000 H

Page 9: 8086 Arch

In the 8086 microprocessor , the total memory is divided into segments . Each segment is of 64k . However the segments can be overlapping , thereby giving an impression that they can actually of variable size , with maximum as 64k . Each of these segments can be used for a specific function . For example : Code segment for is used for storing the instructions. Stack segment is used as STACK.Data and extra segments are used for storing the data bytes. In the assembly language program , there can be more than one data/code/stack segments defined . However only one segment of each type can be active at any time.

Page 10: 8086 Arch

The starting address of the segments which are currently active , or in use , at any time is stored in the respective segment register . As the segment register is of only 16-bits, while the address width is of 20-bits , therefore to get the complete starting address of the segment , the segment register is multiplied by 16 or (10)H . The physical address is calculated as follows :

Ex:1 Physical address calculation using SP &SS

10FFF H

01010 H01000 H

Maximum value of stack segment

SP = 10 H

Base of stack segment

Page 11: 8086 Arch

The value of the SP (stack pointer) = 0010 HThe value of the(Stack Segment register)SS =0100 HPhysical Address of the top of the stack is = = 0100 H * 10 H + 0010 H = 01010 H

SS 0 1 0 0 0SP + 0 0 1 0

P.A. 0 1 0 1 0

Implied zero(obtained on multiplication by 16)

Physical Address = segment register *16 + effective address

Page 12: 8086 Arch

Example 2 : Physical Address calculation using Data Offset and Data Segment:The offset of the data byte = 0020 HThe value of DS register = 0200 HPhysical Address of Data byte = 0200 H* 10 H + 0020 H = 02020 H

Top of data segment

Offset = 20HBase of data segment02000

H

02020H

11FFFH

Page 13: 8086 Arch

Example 3 : Physical address calculation using Instruction Pointer & Code Segment register : The value of the instruction pointer , holding the address of instruction currently being executed = 1234 HThe value of CS = 3200 HPhysical Address of the instruction currently being executed = 3200 H *10 H+ 1234 H = 33234 H

41FFF H

33234 H

32000 H

Top of Code Segment

I P = 1234 H

Base of Code Segment

Page 14: 8086 Arch

Instruction Pointer : As discussed earlier , the entire memory of 8086 is divided into logical partitions , called segments . One of the segment , called the code segment , is used to store the segment address of the instructions. The pointer to the instruction that is currently being executed is actually the offset of the instruction within the code segment. This pointer is called as INSTRUCTION POINTER.

Page 15: 8086 Arch

Execution Unit (EU): EU tells the BIU which memory location to access , and what to do with that . This involves decoding & execution of the instructions . It consists of the following sections : a) Control Circuitry , Instruction Decoder and ALU : Instructions are fetched from the instruction Queue , and stored in the decoder ,where the instruction is translated into sequence of actions which the EU carries out. The arithmetic & logic operations are performed in the ALU . All actions are controlled by control circuitry.

Page 16: 8086 Arch

b) Registers : The 8086 registers can be divided into 5 groups according to their functionality. They are as follows: 1) General Purpose Registers 2) Segment Registers 3) Pointer & Index Registers 4) Special Purpose Registers 5) Flag Registers

Page 17: 8086 Arch

General Purpose registers : 8086 has four 16-bits general purpose registers. They are AX ,BX , CX , DX. In addition to being used as 16-bit registers , they can be used as 8-bit registers also as AL, AH, BH , BL , CH , CL , DH , DL.Though these registers are general purpose but with certain instruction they acquire a special meaning. AX register is called as Accumulator. BX is mainly used as Base register. This means by default it is assumed to contain the offset of memory region within data segment . CX is assumed to work as a counter in some loop like instructions . DX register in I/o instructions is assumed to contain the port address.

Page 18: 8086 Arch

Pointer & Index Registers : 8086 contains three 16-bit pointer & index registers. They are BP(Base Pointer), Source Index (SI) and Destination Index(DI). These three registers can also be used as general purpose registers . Their main purpose is to contain the indexes , in stack segment , data segment and extra segment respectively . Special Registers : A stack is a block of memory used to store address & data . This data is accessed in LIFO manner . 8086 has reserved 64k of memory aside to be used as stack. The base of the stack is stored in SS register & top of the stack is referred by another special register called as Stack Pointer (SP). Physical Address = SS * 10 H + SP

Page 19: 8086 Arch

Flag Registers :

u u u u OF

DF

IF TF SF ZF u AF

u PF u CF

U undefined

8085 compatibleflags

01215 14 13 12 11 10 9 8 7 6 5 4 3

OF- overflow flag

DF - String direction flagIF - interrupt enable flag

TF – Single step trap flag

CF – carry flagPF – parity flag

AF – auxiliary carry flag(BCD)ZF – zero flagSF – sign flag