Week 2 8086 Microprocessor Jan 2018
Week 2 8086 Microprocessor Jan 2018
Fourth Generation
During 1980s
Low power version of HMOS technology
(HCMOS)
Third Generation 32 bit processors
During 1978 Physical memory space 224 bytes = 16 Mb
HMOS technology Faster speed, Higher Virtual memory space 240 bytes = 1 Tb
packing density Floating point hardware
16 bit processors 40/ 48/ 64 pins Supports increased number of addressing
Easier to program modes
Dynamically relatable programs
Processor has multiply/ divide arithmetic Intel 80386
hardware
More powerful interrupt handling
capabilities Second Generation
Flexible I/O port addressing During 1973
NMOS technology Faster speed, Higher
Intel 8086 (16 bit processor) density, Compatible with TTL
4 / 8/ 16 bit processors 40 pins
First Generation Ability to address large memory spaces
Between 1971 – 1973 and I/O ports
PMOS technology, non compatible with TTL Greater number of levels of subroutine
4 bit processors 16 pins nesting
8 and 16 bit processors 40 pins Better interrupt handling capabilities
Due to limitations of pins, signals are
multiplexed Intel 8085 (8 bit processor)
The Intel Family Addressable
Memory, bytes
= 2A
(A)
(1978)
Microcontrollers)
(2000)
Increase Increase
•First 16- bit processor released by
INTEL in the year 1978
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 Index, used as two 8 bit registers as :
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
DX can be used as DH and DL
8086 microprocessor Bus Interface Unit (BIU)
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
1000H
Memory Segmentation of 8086
A 16-digit binary number is reduced to a 4-digit in
Hexadecimal number system. Since 4-digit binary number
is represented by a single digit in Hexadecimal number
system.
So Given the contents of any segment register in
Hexadecimal format, one zero is added to the right to form
Base address.
Example: Contents of Code Segment Register CS: 2A10H
2 A 1 0
2 A 1 0 0
6FFFFH (End of Extra Segment)
----
1000H
The 8086 memory-addressing scheme, using a
segment address plus an offset.
– this shows a memory
segment beginning at
10000H, ending at
location 1FFFFH
• 64K bytes in length
23
(11MB)
MB
20-bit (5-byte) 64 KB +
Physical Segment 16-bit each
Memory address
16-bit
Segment
Registers
16-bit
Points to the current stack.
The 20-bit physical stack address is
calculated from the Stack Segment
(SS) and the Stack Pointer (SP) for
stack instructions such as PUSH and
POP.
In based addressing mode, the 20-
bit physical stack address is
calculated from the Stack segment
(SS) and the Base Pointer (BP).
8086 microprocessor Bus Interface Unit (BIU)
Instruction Pointer
Segment
Registers
16-bit
Always points to the next
instruction to be executed within
the currently executing code
segment.
So, this register contains the
16-bit offset address pointing to
the next instruction code within
the 64Kb of the code segment
area.
Its content is automatically
incremented as the execution of
the next instruction takes place.
8086 microprocessor Bus Interface Unit (BIU)
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.
This is done in order
to speed up the
execution by
overlapping
instruction fetch with
This mechanism is execution.
known as pipelining.
8086 microprocessor Execution Unit (EU)
EU
Consists of two 8-bit registers CL and
Registers CH, which can be combined together
and used as a 16-bit register CX.
When combined, CL register contains
the low order byte of the word, and CH
contains the high-order byte.
Instructions such as SHIFT, ROTATE
and LOOP use the contents of CX as a
counter.
Example:
The instruction LOOP START automatically
decrements CX by 1 without affecting flags and
will check if [CX] = 0.
OF DF IF TF SF ZF AF PF CF
8086 microprocessor Execution Unit (EU)
This flag is set, when the result of This flag is set, if the result of the This flag is set to 1, if the lower byte of the
any computation is negative computation or comparison performed result contains even number of 1’s ; for
by an instruction is zero odd number 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 enters
This flag is set, if an overflow occurs, i.e, if the result of a signed operation is large
the single step execution mode by
enough to accommodate in a destination 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-
generating internal interrupts after the
bit sign operations, then the overflow will be set. execution of each instruction
Interrupt Flag
Direction Flag
This is used by string manipulation instructions. If this flag bit is ‘0’, the string
is processed beginning from the lowest address to the highest address, i.e., Causes the 8086 to recognize external mask
auto incrementing mode. Otherwise, the string is processed from the highest interrupts; clearing IF disables these
address towards the lowest address, i.e., auto incrementing mode. interrupts.
8086 microprocessor Architecture Registers and Special Functions
AX 16-bit Accumulator Stores the 16-bit results of arithmetic and logic operations
AL 8-bit Accumulator Stores the 8-bit results of arithmetic and logic operations
BX Base register Used to hold base value in base addressing mode to access memory
data
CX Count Register Used to hold the count value in SHIFT, ROTATE and LOOP
instructions
DX Data Register Used to hold data for multiplication and division operations
SP Stack Pointer Used to hold the offset address of top stack memory
BP Base Pointer Used to hold the base value in base addressing using SS register to
access data from stack memory
SI Source Index Used to hold index value of source operand (data) for string
instructions
DI Data Index Used to hold the index value of destination operand (data) for string
operations
Instruction-1 Fetch Execute
(BIU) (EU)
Instruction-2 Fetch Execute
(BIU) (EU)
Instruction-3 Fetch Execute
(BIU) (EU)
Instruction-4 Fetch Execute
(BIU) (EU)
Instruction-5 Fetch Execute
(BIU) (EU)
Time T1 T2 T3 T4 T5 T6 T7 T8
Advantage: Lets assume that BIU and EU units require 5 seconds each for Fetch and
Execution of each instruction. So processing of each instruction requires: 5 + 5 = 10
seconds.
In a non-pipelined processor, processing of 1000 instructions would require: 1000 X
10 = 10,000 seconds
In a pipelined processor, to get the output of 1 st instruction, we have to wait for 10
seconds. For the remaining instructions, we get outputs after each 5 seconds!
So the processing of 1000 instructions would require:
10 sec ; (for 1st instructions)
+ 999 X 5; (remaining instructions 1000-1 X 5 seconds)
= 5005 Seconds
For 2-stage pipelining: speed-up factor = (10,000 seconds ÷ 5005 Seconds ) ≈ 2
Pipelining
• Pipelining is an implementation technique where multiple instructions are
overlapped in execution. The computer pipeline is divided in stages. Each stage
completes a part of an instruction in parallel. The stages are connected one to the
next to form a pipe - instructions enter at one end, progress through the stages,
and exit at the other end.
• Pipelining does not decrease the time for individual instruction execution. Instead,
it increases instruction throughput. The throughput of the instruction pipeline is
determined by how often an instruction exits the pipeline.
• Because the pipe stages are hooked together, all the stages must be ready to
proceed at the same time. We call the time required to move an instruction one
step further in the pipeline a machine cycle . The length of the machine cycle is
determined by the time required for the slowest pipe stage.
• The pipeline designer's goal is to balance the length of each pipeline stage . If the
stages are perfectly balanced, then the time per instruction on the pipelined
machine is equal to