PadhaikoAll subjects

8086 Features & Architecture (BIU and EU)

Microprocessors (ENEX 201)

Open in the Padhaiko app

3.1 Features of 8086

The Intel 8086, introduced in 1978, is Intel's first 16-bit microprocessor. Unlike the 8-bit 8085, the 8086 handles 16-bit data natively, addresses 1 MB of physical memory using segmented addressing, and introduces instruction pipelining by splitting internal processing into two asynchronous functional units.

Definition

Key Technical Features of Intel 8086

  1. 16-Bit Architecture: Possesses a 16-bit Arithmetic and Logic Unit (ALU), 16-bit internal registers, and a 16-bit external data bus (multiplexed as AD0–AD15). It supports 8-bit (BYTE) and 16-bit (WORD) operands.
  2. 20-Bit Address Bus (1 MB Memory): Multiplexed pins AD0–AD15 and A16/S3–A19/S6 form a 20-bit address bus, addressing 2^20 = 1,048,576 bytes (1 MB) from 00000H to FFFFFH.
  3. Segmented Memory Organization: Memory is divided into four logical 64 KB segments at any time (CS, DS, SS, ES), permitting modular programs and easy relocation.
  4. Instruction Pipelining: A 6-byte instruction prefetch queue inside the Bus Interface Unit (BIU) fetches upcoming instruction bytes while the Execution Unit (EU) executes the current instruction.
  5. Operating Modes: A single MN/MX_bar pin configures the processor for Minimum Mode (single-processor system) or Maximum Mode (multiprocessor system with 8087 math coprocessor or 8089 I/O processor).
  6. Clock & Packaging: Packaged in a 40-pin DIP using HMOS technology (+5 V supply), operating at 5 MHz (8086), 8 MHz (8086-2), or 10 MHz (8086-1).
  7. Powerful Instruction Set & Interrupts: Supports hardware multiply/divide (MUL, DIV), string primitives (MOVS, CMPS, SCAS), 256 vectored interrupts (INT 00H–FFH), and separate 64 KB I/O address space (65,536 8-bit or 32,768 16-bit ports).
AspectIntel 8085Intel 8086
Data Bus & ALU Width8-bit data bus (AD0–AD7), 8-bit ALU16-bit data bus (AD0–AD15), 16-bit ALU
Address Bus & Memory16-bit address bus -> 64 KB (2^16 bytes)20-bit address bus -> 1 MB (2^20 bytes)
Pipelining / QueueNon-pipelined (sequential fetch-execute)Pipelined with a 6-byte FIFO prefetch queue
Memory SegmentationLinear flat 64 KB space (no segment registers)Segmented via four 16-bit registers (CS, DS, SS, ES)
Operating ModesSingle mode onlyMinimum mode (MN/MX_bar = 1) and Maximum mode (MN/MX_bar = 0)
Hardware Multiply / DivideNot available (done in software)Built-in MUL, IMUL, DIV, IDIV instructions

3.2 Internal architecture of 8086

To overlap instruction fetching with execution and eliminate idle bus cycles, the internal architecture of the 8086 is partitioned into two independent, asynchronous units connected by an internal bus: the Bus Interface Unit (BIU) and the Execution Unit (EU).

Internal Architecture of Intel 8086 (BIU and EU)Text
+-------------------------------------------------------------------------+
|                       BUS INTERFACE UNIT (BIU)                          |
|                                                                         |
|   +--------+   +--------+   +--------+   +--------+   +------------+    |
|   |   CS   |   |   DS   |   |   SS   |   |   ES   |   |     IP     |    |
|   +--------+   +--------+   +--------+   +--------+   +------------+    |
|       \            |            |           /               |           |
|        +-----------+------------+----------+                |           |
|                             |                               |           |
|                             v                               v           |
|                 +-----------------------------------------------+       |
|                 |         20-Bit Physical Address Adder         |       |
|                 +-----------------------------------------------+       |
|                                        |                                |
|                                        v  20-bit Physical Address       |
|   +------------------------------------+----------------------------+   |
|   |         Bus Control Logic & External System Bus (AD0-AD15)      |   |
|   +------------------------------------+----------------------------+   |
|                                        |  Prefetched Bytes              |
|                                        v                                |
|                 +---+---+---+---+---+---+                               |
|                 | 1 | 2 | 3 | 4 | 5 | 6 |  6-Byte Instruction Queue     |
|                 +---+---+---+---+---+---+                               |
+--------------------------------|----------------------------------------+
                                 |  Instruction Byte Stream
                                 v
+-------------------------------------------------------------------------+
|                         EXECUTION UNIT (EU)                             |
|                                                                         |
|   +---------------------------+    +-------------------------------+    |
|   | Instruction Decoder &     |    | General Purpose Registers     |    |
|   | Control System            |    |   AX (AH | AL)  BX (BH | BL)  |    |
|   +---------------------------+    |   CX (CH | CL)  DX (DH | DL)  |    |
|                 |                  | Pointer & Index Registers     |    |
|                 v                  |   SP    BP     SI     DI      |    |
|   +---------------------------+    +-------------------------------+    |
|   |        16-Bit ALU         |<-----------------> Internal Data Bus    |
|   +---------------------------+                                         |
|                 |                                                       |
|                 v                                                       |
|   +---------------------------+                                         |
|   |   16-Bit Flag Register    |  (CF, PF, AF, ZF, SF, TF, IF, DF, OF)   |
|   +---------------------------+                                         |
+-------------------------------------------------------------------------+

3.2.1 BIU and components

The Bus Interface Unit (BIU) serves as the 8086's gateway to external memory and I/O devices. It performs all bus operations: generating 20-bit physical addresses, fetching instructions from memory, reading data from memory/ports, writing data to memory/ports, and maintaining the instruction prefetch queue.

Definition

Components of the Bus Interface Unit (BIU)

  1. Segment Registers (four 16-bit registers):
    • CS (Code Segment): Holds the 16-bit base address of the active 64 KB segment containing executable instructions.
    • DS (Data Segment): Holds the base address of the default 64 KB segment storing program variables and data arrays.
    • SS (Stack Segment): Holds the base address of the 64 KB segment used for the stack (PUSH, POP, CALL, RET, interrupts).
    • ES (Extra Segment): An auxiliary 64 KB data segment used primarily as the destination segment during string instructions (MOVSB, STOSB, SCASB).
  2. Instruction Pointer (IP, 16-bit): Holds the 16-bit offset address of the next instruction byte to be fetched by the BIU from the Code Segment (CS:IP). Programmers cannot manipulate IP directly with MOV; instead, control-transfer instructions (JMP, CALL, RET, INT) modify it.
  3. Dedicated 20-Bit Address Adder: Computes the 20-bit physical address sent onto the address bus by shifting the 16-bit segment register left by 4 bits (multiplying by 16 or 10H) and adding the 16-bit offset: Physical Address = (Segment Base * 10H) + Offset
  4. 6-Byte Instruction Queue (FIFO): A First-In, First-Out buffer that holds up to 6 prefetched instruction bytes ahead of the EU. Whenever at least 2 bytes in the queue are empty and the EU is not requesting a memory/I/O data transfer, the BIU performs a word (2-byte) instruction fetch to refill it.
  5. Bus Control Logic: Drives external control and multiplexed address/data lines (AD0–AD15, A16/S3–A19/S6, RD_bar, WR_bar, ALE, M/IO_bar, DT/R_bar, DEN_bar).

3.2.2 EU and components

The Execution Unit (EU) is responsible for decoding and executing instructions. It has no direct connection to the external system buses; instead, it pulls instruction bytes from the BIU's 6-byte queue and requests the BIU whenever an instruction needs to read or write an operand in external memory or I/O space.

Execution Unit (EU) Register Set
GroupRegisterHigh / Low HalvesPrimary Role in 8086
General PurposeAX (Accumulator)AH, ALDefault operand for MUL, DIV, I/O (IN/OUT), string load/store, BCD adjustments
General PurposeBX (Base)BH, BLHolds base memory offset in based addressing ([BX]) and lookup (XLAT)
General PurposeCX (Count)CH, CLAutomatic iteration counter for LOOP, REP, and multi-bit shifts/rotates (CL)
General PurposeDX (Data)DH, DLHolds upper 16 bits of 32-bit MUL/DIV values and 16-bit indirect I/O port address
PointerSP (Stack Pointer)—16-bit offset of top of stack within SS (SS:SP)
PointerBP (Base Pointer)—16-bit offset within SS (SS:BP) for accessing stack parameters/local variables
IndexSI (Source Index)—16-bit offset within DS for general indexed addressing and string source (DS:SI)
IndexDI (Destination Index)—16-bit offset within DS (general) or ES for string destination (ES:DI)

Along with these registers, the EU contains:

8086 16-Bit Flag Register Bit Layout
Bit(s)15–1211109876543210
FlagResOFDFIFTFSFZFResAFResPFResCF
Type—StatusControlControlControlStatusStatus—Status—Status—Status
Definition

8086 Status (Condition) and Control Flags

Six Status Flags (updated automatically by ALU results):

Three Control Flags (set or cleared explicitly by the programmer):

3.2.3 EU and BIU operations

The BIU and EU operate asynchronously and in parallel in a two-stage fetch-execute pipeline:

  1. Normal Pipelined Execution: While the EU decodes and executes the current instruction internally, the BIU monitors the 6-byte instruction queue. Whenever at least 2 bytes are free (note: the 8088, with an 8-bit bus, has a 4-byte queue and refills when 1 byte is free), the BIU executes a 4-clock memory read cycle to fetch the next 16-bit instruction word from CS:IP, appends it to the queue, and increments IP by 2.
  2. Operand Memory Access Priority: When the EU needs to read or write a memory or I/O operand (e.g., MOV AX, [2000H]), it sends the effective offset to the BIU. Data bus requests from the EU take priority over queue prefetching: the BIU completes any in-progress bus cycle, computes the operand's 20-bit physical address, performs the data transfer, and then resumes prefetching.
  3. Queue Flush on Control Transfer: When the EU executes a branch or call (JMP, conditional jump taken, CALL, RET, INT, IRET), the prefetched instructions already sitting in the queue belong to the sequential path and are now invalid. The EU instructs the BIU to flush (clear) the queue, loads the target segment/offset into CS:IP, and restarts sequential prefetching from the new address.
Example 1

1 (5 marks)

Suppose an 8086 has CS = 2500H, IP = 0124H, DS = 4000H, AX = 0000H, and BX = 1A20H. At memory location 40010H–40011H (data segment offset 0010H) lies the 16-bit word 3508H (stored little-endian: 08H at 40010H, 35H at 40011H). Trace what the BIU and EU do during MOV AX, [0010H] (a 3-byte instruction) followed by ADD AX, BX.

Instruction Fetch Address (BIU): Before execution, the BIU fetches instruction bytes from the physical address determined by CS:IP:

  • Instruction Physical Address = (2500H * 10H) + 0124H = 25000H + 0124H = 25124H

The 3-byte instruction MOV AX, [0010H] is pulled from the 6-byte prefetch queue by the EU, advancing logical IP by 3 to 0127H.

Operand Fetch & Register Update (MOV AX, [0010H]):

The BIU computes the operand physical address using DS = 4000H:

  • Operand Physical Address = (4000H * 10H) + 0010H = 40000H + 0010H = 40010H

It reads 08H (low byte) and 35H (high byte) into AX. Note that MOV does not modify any flags.

State After MOV AX, [0010H]
AX3508H
BX1A20H
CS2500H
DS4000H
IP0127H
[40010H]08H
[40011H]35H

ALU Execution (ADD AX, BX): Now ADD AX, BX (a 2-byte instruction) executes entirely inside the EU with zero external data bus cycles:

  • AX = 3508H + 1A20H = 4F28H
  • IP advances by 2 to 0129H.
  • Check status flags for result 4F28H (low byte 28H = 0010 1000B):
    • SF = 0 (bit 15 of 4F28H is 0)
    • ZF = 0 (result is non-zero)
    • CF = 0 (no carry out of bit 15)
    • AF = 0 (8H + 0H = 8H, no carry from bit 3 to bit 4)
    • PF = 1 (low byte 28H = 0010 1000B has two 1s -> even parity)
    • OF = 0 (positive + positive = positive)
State After ADD AX, BX
AX4F28H
BX1A20H
IP0129H
OF0
SF0
ZF0
AF0
PF1
CF0
Answer:

Instruction fetch occurs at physical address 25124H (CS:IP), data operand read occurs at 40010H (DS:0010H), giving AX = 3508H, and after ADD AX, BX, AX = 4F28H, IP = 0129H, and flags are OF=0, SF=0, ZF=0, AF=0, PF=1, CF=0.

Example 2

2 (4 marks)

Determine the contents of AL and all six 8086 status flags (CF, PF, AF, ZF, SF, OF) after executing: MOV AL, 7EH MOV BL, 05H ADD AL, BL

Binary Addition of AL and BL: Convert the 8-bit operands to binary:

  • 7EH = 0111 1110B (+126 signed, 126 unsigned)
  • 05H = 0000 0101B (+5 signed, 5 unsigned)

Adding bit by bit:

  • Lower nibble: 1110B + 0101B = 1 0011B (carry out of bit 3 into bit 4 = 1)
  • Upper nibble: 0111B + 0000B + 1 (carry from bit 3) = 1000B (carry into bit 7 = 1, carry out of bit 7 = 0)
  • 8-bit sum in AL = 1000 0011B = 83H.

Evaluating Each Status Flag:

  • CF = 0: No carry out of bit 7.
  • AF = 1: Carry generated from bit 3 to bit 4 (E + 5 = 13H).
  • ZF = 0: Result 83H is non-zero.
  • SF = 1: Bit 7 (MSB) of 83H (1000 0011B) is 1.
  • PF = 0: Count of 1 bits in 1000 0011B is 3 (odd parity -> PF = 0).
  • OF = 1: Carry into bit 7 (1) differs from carry out of bit 7 (0).
EU Registers and Flags After ADD AL, BL
AL83H
BL05H
OF1
SF1
ZF0
AF1
PF0
CF0
Answer:

AL = 83H, and the status flags are OF = 1, SF = 1, ZF = 0, AF = 1, PF = 0, CF = 0.

Example 3

3 (6 marks)

(Institute of Engineering Exam Style) Explain how the BIU and EU achieve instruction pipelining in the 8086, and describe what happens to the prefetch queue when a JMP instruction is executed.

1. Functional Division and Pipelining: State clearly that the 8086 splits work between two asynchronous units:

  • The BIU handles all external bus transactions and maintains a 6-byte FIFO prefetch queue.
  • The EU decodes and executes instructions drawn from that queue without waiting on external memory fetches.
  • Because the BIU prefetches upcoming instruction words whenever 2 or more bytes in the queue are free (and no EU data bus request is pending), instruction fetching overlaps with execution of the current instruction.

2. Behaviour During a JMP Instruction:

  • Sequential bytes already prefetched into the 6-byte queue immediately after the JMP opcode are no longer the next instructions to run.
  • When the EU decodes and executes JMP, it signals the BIU to flush (discard) the entire 6-byte queue.
  • The EU passes the jump target offset (or segment + offset for a far jump) to the BIU, which updates IP (and CS if far), fetches the target instruction directly from memory, and resumes filling the queue sequentially from the new location.
Answer:

Pipelining is achieved by overlapping BIU instruction prefetching (into a 6-byte FIFO queue whenever >= 2 bytes are empty) with EU instruction decoding and execution. On a JMP, the EU signals the BIU to flush the stale prefetched bytes, updates IP (and CS if far), and refills the queue starting at the jump target.

Exercises

Question 1

List any five distinguishing features of the Intel 8086 microprocessor and compare it briefly with the 8085 in terms of bus width, memory capacity, and pipelining.

Five Key Features of 8086:

  • 16-bit ALU, 16-bit internal registers, and 16-bit external data bus (AD0–AD15).
  • 20-bit address bus addressing 2^20 = 1 MB of physical memory (00000H–FFFFFH).
  • Segmented memory model using four 16-bit segment registers (CS, DS, SS, ES).
  • Two-unit pipelined architecture (BIU + EU) with a 6-byte FIFO instruction queue.
  • Dual operating modes (Minimum and Maximum) selectable via MN/MX_bar, plus hardware MUL/DIV and 256 interrupts.

Comparison with 8085:

  • Bus Width: 8085 has an 8-bit data bus and 16-bit address bus; 8086 has a 16-bit data bus and 20-bit address bus.
  • Memory Capacity: 8085 addresses 64 KB linearly; 8086 addresses 1 MB via 64 KB segments.
  • Pipelining: 8085 fetches and executes sequentially (no queue); 8086 overlaps fetch and execute using a 6-byte BIU prefetch queue.
Answer:

The 8086 is a 16-bit microprocessor with a 20-bit address bus (1 MB), segmented memory (CS, DS, SS, ES), a 6-byte prefetch queue, and Min/Max modes—doubling data width, expanding memory 16-fold, and introducing pipelining compared to the 8-bit, 64 KB, non-pipelined 8085.

Question 2

Draw/describe the internal components of the Bus Interface Unit (BIU) and Execution Unit (EU), and explain the role of each component.

Bus Interface Unit (BIU) Components:

  • Four 16-bit Segment Registers (CS, DS, SS, ES): Hold 16-bit base addresses of the active Code, Data, Stack, and Extra 64 KB segments.
  • Instruction Pointer (IP, 16-bit): Stores the offset of the next instruction byte to fetch from CS.
  • 20-bit Address Adder: Computes Physical Address = (Segment * 10H) + Offset.
  • 6-Byte Instruction Queue: FIFO buffer storing prefetched opcode/operand bytes; refilled whenever >= 2 bytes are free.
  • Bus Control Logic: Generates external read/write/address-latch bus signals.

Execution Unit (EU) Components:

  • Control System & Instruction Decoder: Reads bytes from the BIU queue and generates internal execution control signals.
  • 16-bit ALU: Performs 8-bit and 16-bit arithmetic, logic, shift, and rotate operations.
  • General Registers (AX, BX, CX, DX): 16-bit data registers (each split into H and L 8-bit halves).
  • Pointer & Index Registers (SP, BP, SI, DI): Hold 16-bit memory offsets for stack and indexed/string operations.
  • 16-bit Flag Register: Stores 6 status flags (CF, PF, AF, ZF, SF, OF) and 3 control flags (TF, IF, DF).
Answer:

The BIU contains CS, DS, SS, ES, IP, the 20-bit address adder, bus control logic, and the 6-byte instruction queue to handle all external bus transfers. The EU contains the instruction decoder, 16-bit ALU, general/pointer/index registers (AX–DX, SP, BP, SI, DI), and the 16-bit Flag Register to decode and execute instructions.

Question 3

Determine the value of AX and the six status flags (CF, PF, AF, ZF, SF, OF) after executing: MOV AX, FFFFH ADD AX, 0001H

16-Bit Addition: Add FFFFH and 0001H in 16-bit binary:

  • FFFFH = 1111 1111 1111 1111B
  • 0001H = 0000 0000 0000 0001B
  • FFFFH + 0001H = 1 0000H, so the 16-bit result stored in AX is 0000H, with a carry out of bit 15 (CF = 1).

Evaluating Status Flags:

  • CF = 1: Unsigned addition overflowed 16 bits (carry out of bit 15).
  • AF = 1: Low nibble FH + 1H = 10H produced a carry from bit 3 to bit 4.
  • ZF = 1: All 16 bits of AX = 0000H are zero.
  • SF = 0: Bit 15 (MSB) of 0000H is 0.
  • PF = 1: Low byte 00H (0000 0000B) contains zero 1 bits (even parity).
  • OF = 0: Signed addition of -1 (FFFFH) and +1 (0001H) equals 0, which is valid (C_in(bit 15) = 1, C_out(bit 15) = 1, so 1 XOR 1 = 0).
Final State After ADD AX, 0001H
AX0000H
OF0
SF0
ZF1
AF1
PF1
CF1
Answer:

AX = 0000H, with status flags OF = 0, SF = 0, ZF = 1, AF = 1, PF = 1, CF = 1.

Question 4

Explain the three control flags (TF, IF, DF) in the 8086 Flag Register and state the instructions or mechanisms used to set and clear IF and DF.

Control Flags in the 8086 Flag Register:

  1. TF (Trap Flag, Bit 8): Enables single-step debugging. When TF = 1, the processor automatically generates a Type 1 interrupt after each instruction so a debugger can inspect registers. There is no single dedicated instruction like STF; instead, TF is modified by pushing flags onto the stack (PUSHF), altering bit 8 in memory, and popping back (POPF).
  2. IF (Interrupt Flag, Bit 9): Controls whether the CPU responds to maskable hardware interrupts on the INTR pin (IF = 1 enables, IF = 0 disables). Set with STI (Set Interrupt Flag) and cleared with CLI (Clear Interrupt Flag).
  3. DF (Direction Flag, Bit 10): Controls auto-increment or auto-decrement of SI and DI during string operations (MOVS, CMPS, SCAS, LODS, STOS). Set with STD (DF = 1, decrements SI/DI from high to low addresses) and cleared with CLD (DF = 0, increments SI/DI from low to high addresses).
Answer:

TF (bit 8) enables single-step mode via PUSHF/POPF; IF (bit 9) enables/masks external INTR interrupts via STI/CLI; DF (bit 10) selects string auto-decrement/auto-increment via STD/CLD.

Question 5

An 8086 has CS = 1000H and IP = 0200H when the BIU starts fetching into an empty 6-byte queue. If the BIU fetches 2 words (4 bytes) sequentially before the EU executes a 2-byte JMP instruction located at 10200H–10201H, what is IP right after the 2 fetches, and what happens to the 2 remaining bytes in the queue when JMP executes?

Initial Fetch and IP Update:

  • First instruction word is fetched from (1000H * 10H) + 0200H = 10200H–10201H; IP advances to 0202H.
  • Second instruction word is fetched from 10202H–10203H; IP advances to 0204H.
  • The queue now holds 4 bytes (bytes from 10200H–10203H).

Queue Flush on JMP Execution:

  • The EU pulls the 2-byte JMP opcode/operand from 10200H–10201H.
  • The 2 bytes remaining in the queue (from 10202H–10203H) belong to the fall-through path, not the jump target.
  • Therefore, when the EU executes JMP, it flushes those 2 remaining bytes from the queue, updates IP (and CS if inter-segment) to the jump target, and restarts prefetching from the target address.
Answer:

After the two word fetches, IP = 0204H (pointing to 10204H). When the JMP instruction executes, the 2 stale sequential bytes (10202H–10203H) remaining in the prefetch queue are flushed and IP is reloaded with the jump target offset.

Past exam questions for Microprocessors

← Instruction, Machine & T-Cycles; Timing DiagramsSegment:Offset Addressing, Pins & Addressing Modes →