Professional Documents
Culture Documents
Intel 8086 Microprocessor Architecture, Features, And: Signals
Intel 8086 Microprocessor Architecture, Features, And: Signals
13.1 INTRODUCTION
In 1978, Intel released its first 16-bit microprocessor, the 8086, which executes the
nstructions at 2.5 MIPS (million instructions per second). The execution time for
one instruction is 400 ns (= 1MIPS = 1/(2.5 x 10). The 8086 can address 1 MB
MB=20 bytes) of memory, as it has a 20-bit address bus. The width ofthe data
Us in the 8086 is 16 bits. This higher execution speed and larger memory s1ze
have enabled the 8086 to replace the smaller minicomputers in many applications.
Another feature in the 8086 is the presence of a small six-byte instruction queue
n which the instructions fetched from the memory are placed before they are
executed.
13.2
ARCHITECTURE OF 8086
unctional block diagram ofthe 8086 is shown in Fig. 13.1. It is subdivided
into the
following two units:
An execution unit (EU), which includes the ALU, eight 16-bit general
purpose registers, a 16-bit flag register, and a control unit.
A bus interface unit (BIU), which includes an adderfor address calculations,
our 16-bit segment registers (CS, DS, SS, and ES), a 16-bit instruction
pointer (IP), a six-byte instruction queue, and bus control logic.
13.2.1 Execution Unit
The
SPConsists of eight 16-bit general-purpose
registers BX, CX, DX,
S 1 , and DI. Among these registers, AX, BX, CX, and DX can be further
420 MICROPROCESSORS AND MICROCONTROLLERS
AX AH AL
Address bus
BX BH BL
20 bits
CX CH CL
Adder Data bus
DX DH DL General IK E
CS 16 bits
registers
BP
DS
SP
SS
SI
ES
DI Bus
IP control
16bits
system
ALUdata bus
16 bits
Temporary
register
Six bytes
EU Instruction queue
ALU control 123466K
system
Flags
divided into two 8-bit registers-AH and AL, BH and BL, CH and CL, and DH
and DL, respectively, as shown in Fig. 13.1. The general-purpose registers can
be used to store 8-bit or 16-bit data during program execution. In addition, each
register has the following special functions:
(i) AX/AL: AX or AL is used as the accumulator. It is used in the
multiply.
divide, and input/output (/O) operations, and in some decimal and ASCII
adjustment instructions.
i) BX: The BX register holds the offset address of a location in the
memory.
It is also used to refer to the data in the memory using the look-up table
technique, with the help of the XLAT instruction.
(ii) CX/CL: CX is used to hold the count value while executing the repeated
string instructions (REP/REPE/REPNE) and the LOOP instruction. CL is
used to hold the count value while executing the shift/rotate instructions.
The count value indicates the number of times the same code has to be
executed when the LOOP instruction is used and the number of times the
data item has to be shifted/rotated when the shift/rotate instruction is used.
(iv) DX: DX is used to hold a part of the result during a multiplication
and a part of the dividend before a division operation. It is also used to hold operaton
the VO device address while
executing the IN and OUT instructions.
(v) SP: The SP register or the stack pointer is used to hold the offset address
0
INTEL 8086
MICROPROCESSOR ARCHITECTURE, FEATURES, AND SIGNALS 421
Here, the term segment refers to a portion of the memory where the
stack for a program is stored. In the 8086, the maximum size data, code,
be 64 KB and the minimum size can be even I of a segment can
byte. segment always begins at a
A
memory address divisible by 16. This means that the
in the in hexadecimal
starting address of a segment
memory form is XXXXOH. The reason for this is
in Section 13.2.2. explained
The flag register of the 8086 is shown in Fig. 13.2.
S F (sign flag): SF holds the arithmetic sign ofthe result after an arithmetic
Or logic instruction is executed. If S =0, the sign bit is 0 and the result is
positive.
( t r a p flag): TF is used to debug a program using the single-step
422 MICROPROCESSORS AND MICROCONTROLLERS
technique. If it is set (i.e., TF = 1), the 8086 gets interrupted (trap or single.
automatically decremented. This flag can be set and cleared using the STD
and CLD instructions, respectively.
(vii) IF (interrupt flag): IF controls the operation of the INTR interrupt pin of
the 8086. If IF =0, the INTR pin is disabled andif IF = 1, the INTR pin is
enabled. This flag can be set and cleared using the STI and CLI instructions,
respectively.
ix) OF (overflow flag): Signed negative numbers are represented in the 2's
complement form in the microprocessor. When signed numbers are added
or subtracted, an overffow may occur. An overflow indicates that the result
has exceeded the capacity ofthe machine. For example, if the 8-bit signed
data 7EH = +126) is added with the 8-bit signed data 02H (= +2), the
result is 80H (=-128 in the 2's complement form). This result indicates
an overflow condition and the overflow flag is set during the given signed
addition operation. In an 8-bit register, the minimum and maximum value
ofthe signed number thatcanbe stored is -128 (-80H) and +127 (= 7FH).
respectively. In a 16-bit register, the minimum and maximum value of
the signed number that can be stored is -32,768 (= 8000H) and +32,767
7FFFH), respectively. For operations on unsigned data, OF is ignored.
13.2.2 Bus Interface Unit
There are four segment registers CS, DS, SS, and ES in the 8086. The function
of these registers is to indicate the starting or base address of the code segment,
data segment, stack segment, and extra segment, respectively, in the memory. The
code segment contains the instructions ofa program and the data segment contains
data for the program. The stack segment holds the stack of the program, which
is needed while executing the CALL and RET instructions and also to handle
interrupts. The extra segment is an additional data segment that is used by some
string instructions.
The base address of any segment can be obtained by adding four binary 0s
to the farthest right portion of the content of the coresponding segment register,
which is the same as adding the hexadecimal digit 0. It is also equivalent to shifting
the content of the segment register left by four bits. Hence, a segment in the 8086
always starts at a memory address that is divisible by the decimal number 16 (also
known as 16-byte boundary). This is illustrated with an example as follows:
Example 13.1:
Let us assume that the segment registers have following values stored in them:
CS DS SS ES
MICROPROCESSORS
AND
424
Offset address
+IP 2000H=
Memory Address
10000H
AH AL
4BH 3AH
3000H (offset)
3AH 13000H
4BH 13001H
1 byte
and
steps carried out by the 8086 to of the instruction PUSH AX by the 8UD The
execute
i) SPis decremented by 1 (i.e., the PUSH
SP =0104H) andAX
the content of the a
instruction are ADs follow
as
AH register
INTEL 8086
MICROPROCESSOR ARCHITECTURE, FEATURES, AND SIGNALS 425
(a)
Memory Address
AH 30000H-(SS X10H)
(b)
Fig. 13.5 PUSH AX: (a) pushing the first byte of AX onto the stack
segment (b) pushing the
second byte of AX onto the stack segment
he
instruction queue is six bytes long and stores the
pre-fetched instructions
t h e code segment. From there, the instruction is taken to the instruction
COder, where it is decoded. The decoder passes the decoded information to the
n g and control circuit, which in turn generates the various control signals to
u e the instruction. Whenever this decoded instruction requires branching
(whi
thearises
when conditional or unconditional jump instructions are decoded),
instruction
Ion queue is flushed and the instruction bytes from the branch address
Whecdinto the queue. The BIU fetches the instruction bytes from the memory
henever the EU is not the address/data bus and puts them in the instruction
using
theeching and execution of instructions can take place simultaneously. Thus
instruction
queue reduces the execution time of a program.
The
gment and offset mechanism for accessing the memory in the 8086 allows
the
programmer towrit
rite relocatable programs or data structures. A relocatable
rogram or data structure
stru is one that can be placed anywhere in the memory map
MICROCONTROLLERS
AND
426 MICROPROCESSORS
8086.
Max. mode (Min. mode)
GND 1 40
AD14 2 39AD15
AD13 3 38A16/s3
AD12 4 37A17/S4
AD11 5 36A18/S5
AD10 6 35A19/S6
AD9 7 34BHES7
AD8 8 33MNMX
AD7 9 32RD
8086
AD6 10 31ROGTO (HOLD)
AD5 11 30ROGT1 (HLDA)
AD4 12 29LOCK (WR)
AD3 13 28$2 (MIO)
AD2 14 271 (DT/R)
AD1 15 26 S0 (DEN)
ADO 16 25 Qso (ALE)
NMI 17 24 QS1 (INTA)
INTR 18 23TEST
CLK 19 22 READY
GND 20 21RESET
the address signals A19-A16 and the status bits S6-S3. When ALE = 1,
these pins carry the address and when ALE = 0, they carry the status lines.
Using one external octal latch (74373) along with the ALE signal, these
pins can be de-multiplexed into the address bus (A19-A16) and the status
(S6-S3). S3 and s4 indicate the
segment accessed by the 8086 during
the current bus cycle. This is shown in Table 13.2.
S4 $3 9egment accessed
0 Extra segment
1 Stack segment
0 Code segment or no segment
Data segment
(xi) operations.
READY: This input used to insert wait states into the timing cycle of the
428 MICROPROCESSORS AND MICROCONTROLLERS
(iv) DEN: The Data Bus Enable signal activates external data bus buffers. When
data is transferred through the data bus of the 8086, this signal is at logic 0.
When DEN is high, no data flows in the data bus.
(v) ALE: When the Address Latch Enable (ALE) signal is high, it indicates
that the 8086 multiplexed address/data bus (ADI5-AD0) and multüplexed
can be
address/status bus (A19/S6-A16/S3) contain an address, which
either a memory address or an IO port address.
(vi) INTA: The Interrupt Acknowledge signal is a response to the INTR npur
in
vector number
pin. The INTA signal is used to place the interrupt type or
the data bus, in response to the INTR interrupt.
and
(vii) HOLD: The Hold input requests a direct memory access (DMA) i
generated by the DMA controller. If the Hold signal is at logic 1, theSu
0
Function
0
0 Interrupt acknowledge
I/O read
0 1 0
V0 write
Halt
0 0
Opcode fetch
0
Memory read
1 0
Memory write
Passive (inactive)
POINTS TO REMEMBER
The internal architecture of the 8086 mainly contains two units-the bus interface unit
(BIU) and the execution unit (EU).
ne BIU fetches instructions and data from the memory to the processor, using the
Uent of a segment register and an offset.
NTe exists a six-byte instruction queue in the 8086, which is used to store the recently
etched instructions in the CPU. This is used to speed up the execution of a program.
a r e four memory segments-code, data, stack, and extra segments in the 8086 and
Dase address is indicated by adding four binary 0s to the right ofthe corresponding
nent register's content. The maximum size of a memory segment is 64 KB.
Tetching either an instruction byte or a data, the 8086 adds the base address of the
T segment with an offset address present in a register, available as an 8- or l6-
TL acement in the instruction, or obtained by a combination of both.
The desig
ESIgners of the 8086 have fixed the default offset register(s) for every segment