8086 Architecture RNM
8086 Architecture RNM
8086 Architecture RNM
16 bit microprocessor
20 address lines i.e 220=1MB memory addressed.
256 interrupt
2
BLOCK DIAGRAM OF 8086
BLOCK DIAGRAM OF 8086
2) EU (Execution Unit)
BUS INTERFACE UNIT (BIU)
BIU
An 8086 microprocessor exhibits the property of pipelining the
instructions in a queue while performing decoding and
execution of the previous instruction.
This saves the processor time of operation by a large amount.
9
THE QUEUE (Q)
10
• These pre-fetching instructions are held in its
FIFO queue.
11
• The EU accesses the queue from
the output end. It reads one
instruction byte after the other from
the output of the queue.
12
EXECUTION UNIT
16
8086/88
8086/88internal
internalregisters
registers16
16bits
bits(2
(2bytes
byteseach)
each)
SP
BH BL
BX
SI
CH CL
DI
CX
DH DL
DX Segment
CS
Flags DS
IP ES
21
8086 REGISTERS
1)Data Registers
AX,BX,CX,DX
2)Address Registers
a> Base registers: BX,BP
Index registers :SI,DI
Instruction pointer: IP
b> Segment registers
CS,SS,DS,ES
3)Flag register (PSW)
General Purpose Registers
AX - the Accumulator
BX - the Base Register
CX - the Count Register
DX - the Data Register
• BX
– Base Register
– Also serves as an address register
24
General Purpose Registers
• CX
– Count register
– Used as a loop counter
– Used in shift and rotate operations
• DX
– Data register
– Used in multiplication and division
– Also used in I/O operations
25
Pointer and Index Registers
27
• Concept of Memory
Segmentation in 8086
&
Physical address calculation
28
• The 1Mbyte memory is divided into segments
• We have 16-bits logical address (because the
registers are in 16-bits), so we have maximum
memory size locations which are addressed by
16-bits as below:
• 216 = 65,536 = 64K
• Thus, any location within the segment can be
accessed using 16-Bits.
• The 8086 allows only four active segments at a
time
• For the selection of four active segments the 16-
bit segment registers are provided
The four segment registers are:
ES register and DS register are used to hold the upper 16-bits of the starting
address of the two memory segments which are used for data.
• Note:
• By default BX, SI and DI registers work with DS
segment register
• BP and SP work with SS segment register.
• IP work with CS segment register.
Program Segments
Code segment
• The 8086 fetches the instructions (opcodes and
operands) from the code segments.
• Logical address:
• consist of a segment value and an offset
address
• Logical address:
– Consist of a CS (code segment) and an IP (instruction
pointer)
• format is CS:IP
• Offset address
– IP contains the offset address
• Physical address
– generated by shifting the CS left one hex digit and then
adding it to the IP
– the resulting 20-bit address is called the physical
address
Suppose we have:
CS 2500
IP 95F3
• Logical address:
– Consist of a CS (code segment) and an IP (instruction pointer)
format is CS:IP 2500:95F3H
• Offset address
– IP contains the offset address which is 95F3H
• Physical address
– generated by shifting the CS left one hex digit and then adding it to the
IP
25000 + 95F3 = 2E5F3H
41
• The following examples shows the
CS:IP scheme of address
formation:
CS IP 8AB4
34BA Code
34BA0
segment
Inserting a hexadecimal 0H (0000B)
with the CSR or shifting the CSR
8AB4
four binary digits left
(offset)
3D654
34BA0(CS)+
8AB4(IP)
3D65 4 (next address)
44B9F
42
Example: The following operation illustrates the generation of 20-bit physical address from
CS and IP registers.
Let: CS = 3 4 8 A H , IP= 4 2 1 4 H
Therefore,
Physical Address = Offset + Segment Register (Shifted by 1 digit in Hexadecimal)
Example:
If CS=24F6h & IP=634Ah, show the;
1- The logical address
2- The offset address
3- The physical address
4- The lower range of the segment
5- The upper range of the segment
Solution:
1- The logical address is the CS: IP content which is: 24F6:634A
2- The offset address is the content of the IP register which is: 634A
3- The physical address:
4- The lower range of the segment:
CS DS ES SS
BX,
SI, SP,
IP DI
DI BP
46
Segment
Segment and
and Address
Address register
register combination
combination
• CS:IP
• SS:SP SS:BP
• DS:BX DS:SI
• DS:DI (for other than string
operations)
• ES:DI (for string operations)
47
Flag Register
Overflow Carry
Direction Parity
This flag is set, when the This flag is set, if the result of This flag is set to 1, if the lower
result of any computation the computation or comparison byte of the result contains even
is negative performed by an instruction is number of 1’s ; for odd number
zero of 1’s set to zero.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OF DF IF TF SF ZF AF PF CF
Trap Flag
Over flow Flag If this flag is set, the processor
This flag is set, if an overflow occurs, i.e, if the result of a signed
enters the single step execution
operation is large enough to accommodate in a destination
mode by generating internal
register. The result is of more than 7-bits in size in case of 8-bit
signed operation and more than 15-bits in size in case of 16-bit interrupts after the execution of
sign operations, then the overflow will be set. each instruction
50
8086 Microprocessor
Architecture
8086 registers
categorized 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
into 4 groups OF DF IF TF SF ZF AF PF CF
AX AH AL Accumulator
EU registers BX BH BL Base Register
CX CH CL Count Register
DX DH DL Data Register
SP Stack Pointer
BP Base Pointer
SI Source Index Register
DI Destination Index Register
FLAGS
53