Architecture
Architecture
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
1. Carry flag (CF):
• CF is set, if an arithmetic op’n results in
a carry. Otherwise it is reset.
2. Parity flag (PF):
• PF is set if the result has even parity,
PF is zero for odd parity.
• If the result has an even number of 1,
flag is set, for odd no. of 1, flag is
reset.
3. Auxiliary carry flag (AF):
• AF is used by BCD arithmetic
instructions.
• In an arithmetic op’n, when a
carry is generated by digit 3 &
passed to digit 4, the AF flag is set.
4. Zero flag (ZF):
• ZF is set(1) if result is zero, ZF is
zero(0) for nonzero result.
5. Sign flag (SF):
• SF is set if most significant bit of the
result is 1(negative).
• Cleared to zero, for non-negative
result.
6. Overflow flag (OF):
• OF set, if there is an arithmetic
overflow, that is, if the size of the result
exceeds the capacity of destination
location.
• 03 remaining flag used to control
certain op’n of processor.
• 06 conditional flag are set/reset by
EU on the basis of the results of some
arithmetic or logical op’n.
• Control flags are set/reset with
specific instruction put in your prog.
7.Trap (Trace) flag (TF):
• Setting TF to one places the 8086 in
the single-step mode.
• in this mode, 8086 generates an
internal interrupt after execution of
each instruction.
• User can write a service routine at
the interrupt address vector to display
the desired registers & memory
location.
7. TF (Cont…)
• User can thus debug a program.
8. Interrupt flag (IF):
• Used to allow or prohibit the
interruption of a program.
-if I=1, INTR pin is enable.
-if I=0, INTR “ “ disable.
9. Direction flag (DF):
•-DF select either increment or
decrement mode during string
instructions.
• If D =1, register automatically
decrement.
• If D = 0, register “ ” incremented.
General Purpose Registers:
• See fig.(2-7), P-29, Hall.
• The EU has 08 general purpose
registers.
• AH, AL, BH, BL, CH, CL, DH, DL.
• These registers can be used
individually for temporary storage of 8-
bit data.
Cont..
• Certain pairs of these general purpose
registers can be used together to store
16-bit data words.
• The acceptable register pairs are AH
& AL, BH & BL, CH& CL, DH & DL.
Cont..
• AH-AL pair refereed to as AX register.
• BH-BL ………………….BX register.
• CH-CL……………………CX register.
• DH-DL…………………DX register.
• Adv. Of using internal register for the
temporary storage of data is that, since data
is already in EU, it can be accessed much
more quickly than it could be accessed in
external memory.
AX register:
• Called 16-bit accumulator while AL
is 8-bit accumulator.
• The use of accumulator register is
assumed by some instructions.
• I/O instructions always AX/AL for
inputting or outputting 16 or 8-bit
data to or from on I/O port.
Cont..
• Multiplication & division instructions
also use the AX/AL.
-the AL register is same as 8085 A
register.
BX Register:
• Base register, only general purpose
register whose contents can be used for
addressing 8086 memory.
•BX register similar to 8085 H, L register
-8086 BH & BL are equivalent to 8085
H & L registers.
CX Register:
• Counter register, because instructions
such as SHIFT, ROTATE, & LOOP,
use the contents of CX as a counter.
CX cont..
• Example, LOOP START,
automatically decrement CX by 1
without affecting flags & will check if
[CX] = 0.
• If it is zero, 8086 executes next
instruction otherwise, 8086 branches
ti the label STRRT.
* DX Register:
• Data register.
• Used to hold high 16-bit result
(data) in 16*16 multiplication or
high 16-bit dividend (data) before a
32/16 division & 16-bit remainder
after division.
** Two position Registers:
• SP (Stack Pointer)
• BP (Base Pointer)
• Used to access data in the stack
segment (SS).
• SP is used as an offset from the
current SS during execution of
instruction that involve stack segment
in external memory.
SP (cont.)
• SP contents are automatically updated
(increment or decrement) due to
execution of POP or PUSH instruction.
• BP contains an offset address in the
current SS. This offset is used by
instructions utilizing based addressing
mode.
** Two Index Register:
• SI ( Source Index) Register
• DI (Destination Index) Register
• Used in indexed addressing.
• Instruction that process data string
use SI & DI together with DS &
ES, in order to distinguish bet’n
source & destination address.
BIU
1) The Queue:
-The BIU instruction queue is a
first-in-first-out (FIFO) group of
registers in which up to 06 bytes of
instruction code are perfected from
memory ahead of time.
Queue (cont..)
• This is done in order to speed up
prog. Execution by overlapping
instruction fetch with execution.
• When EU is ready for its next
instruction, it simply reads instruction
byte for the instruction from queue in
the BIU.
Queue (cont..)
• This is much faster than sending out
an address to system memory &
waiting for memory to send back to
the next instruction byte/bytes.
• Except in the cases of JMP &
CALL instructions, where queue
must be dumped & then reloaded
starting from a new address.
Queue(cont..)
• This prefetch-&-queue scheme
greatly speeds up processing.
• Fetching next instruction while
current instruction executes is
called Pipelining.
2. Adder: