week2
week2
Architecture
MICROPROCESSOR
Features
It is a 16-bit μp.
8086 has a 20 bit address bus can
access up to 220 memory locations (1
MB).
It can support up to 64K I/O ports.
It provides 14, 16 -bit registers.
Word size is 16 bits.
It has multiplexed address and data
bus AD0- AD15 and A16 – A19.
2
8086
Microprocessor Architecture
Dedicated Adder to
generate 20 bit address
Instruction queue
A group of First-In-First-
Out (FIFO) in which up to
6 bytes of instruction
code are pre fetched
from the memory ahead
of time.
5
8086
Architecture Execution Unit (EU)
Microprocessor
EU decodes and
executes instructions.
A decoder in the EU
control system
translates instructions.
and
Some of the 16 bit registers can be
Index registers (Source used as two 8 bit registers as :
Index, Destination Index)
each of 16-bits AX can be used as AH and AL
BX can be used as BH and BL
CX can be used as CH and CL 6
DX can be used as DH and DL
Internal architecture of 8086
14
Segmented Memory Physical Memory
0000
The memory in an 8086/880
based system is organized
as segmented memory. Code segment (64KB)
MB
1
address 1Mbyte of memory.
Extra segment (64KB)
The Complete physically
available memory may be Stack segment (64KB)
divided into a number of
logical segments.
FFFFF
15
• The size of each segment is 64 KB
• A segment is an area that begins at any location
which is divisible by 16.
• A segment may be located any where in the
memory
• Each of these segments can be used for a specific
function.
– Code segment is used for storing the instructions.
– The stack segment is used as a stack and it is used to
store the return addresses.
– The data and extra segments are used for storing data
byte.
MB
1
44EB 54EAF
DSR
54EB0
ESR 54EB EXTRA (64K)
64EAF
695E 695E0
SSR
STACK (64K)
795D
F
Each segment register store
the upper 16 bit of the
starting address of the
segments 17
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
18
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
19
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
20
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
21
8086
Architecture Bus Interface Unit (BIU)
Microprocessor
22
Instruction pointer & summing block
• The instruction pointer register contains a 16-bit offset address
of instruction that is to be executed next.
23
24
• The following examples shows the
CS:IP scheme of address
formation:
CS 34BA IP 8AB4 Code
34BA
segment
Inserting a hexadecimal 0H (0000B) 0
with the CSR or shifting the CSR 8AB4
four binary digits left (offset)
3D64
5
34BA0(CS)+
8AB4(IP)
3D65 4 (next address)
44B9F
25
Q.1 A memory location has physical address
80FD2h.In what segment does it have offset
BFD2h?
Solution:
physical address= segmentX10h+offset
Physical address =80FD2 h
-offset = BFD2 h
26
Q.2.For the memory locations whose physical
address is specified by 1256Ah,give the address
in segment:offset form for segments 1256h and
1240h.
1256A=12560h+X and
1256Ah=12400h+Y
X =1256Ah-12560h and Y=1256Ah-
12400h
Ah 16Ah
27
1256Ah=1256:000A=1240:016A
28
Segment and Address register combination
• CS:IP
• SS:SP SS:BP
• DS:BX DS:SI
31
8086
Architecture Execution Unit (EU)
Microprocessor
32
8086
Architecture Execution Unit (EU)
Microprocessor
Example:
33
8086
Architecture Execution Unit (EU)
Microprocessor
34
8086
Architecture Execution Unit (EU)
Microprocessor
35
8086
Architecture Execution Unit (EU)
Microprocessor
36
8086
Architecture Execution Unit (EU)
Microprocessor
37
EXECUTION UNIT – Flag Register
• A flag is a flip flop which indicates some conditions produced by
the execution of an instruction or controls certain operations of
the EU .
• In 8086 The EU contains
a 16 bit flag register
9 of the 16 are active flags and remaining 7 are undefined.
6 flags indicates some conditions- status flags
3 flags –control Flags
U U U U O D IF T S Z U A U P U C
F F F F F F F F
Sign Auxiliary Carry
Interrupt Trap Zero Parity
Over flow Direction
U - Unused 38
8086
Architecture Execution Unit (EU)
Microprocessor
Auxiliary Carry Flag
Carry Flag
Flag Register This is set, if there is a carry from the
This flag is set, when there is
lowest nibble, i.e, bit three during
addition, or borrow for the lowest a carry out of MSB in case of
nibble, i.e, bit three, during addition or a borrow in case of
subtraction. subtraction.
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
Tarp 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
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