uProccessors

487
Computer An electronic equipment that performs high-speed arithmetic, logical or transfer operations or that assembles, stores, correlates, or otherwise processes information. EXAMPLE •Computer Elements are Logic Gates •Addition Function is programmed by the interconnection of wires Hardware + Software

description

Cursuri Microprocesoare Electronica Aplicata

Transcript of uProccessors

Page 1: uProccessors

ComputerAn electronic equipment that performs high-speed

arithmetic, logical or transfer operations or that assembles, stores, correlates, or otherwise processes information.

EXAMPLE•A 4-bit adder circuit is a specialized, dedicated computer •Computer Elements are Logic Gates •Addition Function is programmed by the interconnection of wires

Hardware + Software

Page 2: uProccessors

Early Computer - ENIAC(Electronic Numerical Integrator and Computer)• 1946, Univ. of Pennsylvania

• Constructed by Eckert and Mauchly

• 30 tons

• 1500 sq ft

• 18,000 Vacuum Tubes

• Programmed by connecting:

– switches and cables

• 6000 different switches and cables!

HARDWARE PROGRAMMABLE

Page 3: uProccessors

Stored Program Concept•John von Neumann (Univ. of Penn.), A.W. Burks, H.H. Goldstein

- wrote paper describing “Stored Programs”

•Based on Theoretical Mathematical model, Turing Machine, Alan

Turing, 1936 –Simple type of computer

•works by reading/writing symbols on tape •tape can move left or right

–Finite State Machine –As powerful (in theory) as any possible computer –Still Used in Computability Theory, find out what they can’t do

•Charles Babbage also proposed a mechanical device that could

store a program, Analytical Engine in 1822

–Never constructed (although he tried)

Page 4: uProccessors

First Stored Program Computer - EDVAC(Electronic Discrete Variable Automatic Computer)

•Completed in 1952

•Storage: 1000 words

•1 word=10 decimal digits •Programmed using Paper Tape

–Sequential Storage

•Random Access Core Developed

–Random Access

SOFTWARE PROGRAMMABLE

Page 5: uProccessors
Page 6: uProccessors
Page 7: uProccessors

Modern Computer Model

• CPU - Central Processing Unit = Microprocessor– arithmetic, logical, synchronization functions

• Memory - Stores Information (DRAM, ROM)– CPU instructions and Data

• I/O - Input/Output Devices - Peripherals (KBD, PRN)– Interface to Outside World (humans, other machines)

• Bus - Set of Parallel wires (Address Bus, Data Bus)– Transmit instructions/data between CPU/Memory/IO

Page 8: uProccessors
Page 9: uProccessors
Page 10: uProccessors
Page 11: uProccessors
Page 12: uProccessors

Fetch and Execute Cycle• 1. CPU issues: (FETCH)

– Memory Read Signal on Control Bus – Location of Desired Memory Data on Address Bus

• 2. Memory issues: (FETCH)– Data Valid Signal on Control Bus – Actual Memory Data on Data Bus

• 3. CPU Stores Data Internally (FETCH)– Contains Registers

• 4. CPU Interprets Data as an Instruction(FETCH/EXECUTE*)– Instruction Decoder Circuit

• 5. CPU Performs the Instruction(EXECUTE)

– May Require more Memory Accesses – May Require Interaction with Peripherals*Some consider step 4. To be part of fetch; others part of Execute

Page 13: uProccessors
Page 14: uProccessors
Page 15: uProccessors
Page 16: uProccessors
Page 17: uProccessors
Page 18: uProccessors

Quantifying Memory

• Measured in the quantity of BInary digiT (BIT) • 1 nybble = 4 bits • 1 byte = 8 bits • 1 word = 16 bits • 1 doubleword = 32 bits • 1 quadword = 64 bits • 1 paragraph = 16 bytes • 1 page = 256 bytes • 1 segment (max) = 65,636 bytes

Standard

Machine Dependent

(8086)

• Capacity Measures1 kilobyte (kB) = 210 bytes 1 megabyte (MB) = 220 bytes 1 gigabyte (GB) = 230 bytes 1 terabyte (TB) = 240 bytes

Page 19: uProccessors
Page 20: uProccessors
Page 21: uProccessors
Page 22: uProccessors
Page 23: uProccessors
Page 24: uProccessors
Page 25: uProccessors
Page 26: uProccessors
Page 27: uProccessors
Page 28: uProccessors

Inside the CPU - Arithmetic Logic Unit(ALU)

•Combinational Logic Circuit –Two Classes of Inputs:

•Control •Data

–Two Classes of Outputs •Status •Data

Page 29: uProccessors

General Arithmetic Circuit- Attempt to “Share” logic

Example - Purely combinational - data path between registers - 3-bit ALU

CinX

FA S Y

Cout

CinX

FA S Y

Cout

CinX

FA S Y

Cout

0 1 2 3 s1 s0

0 1 2 3 s1 s0

0 1 2 3 s1 s0

A0

B0

A1

B1

A2

B2

S1 S0

C0

C1

C2

C3

Page 30: uProccessors

In a higher level diagram:

A

B

CALU

n

n

n+1

CLK

S1

S0

Arithmetic Logic Unit (ALU)

Page 31: uProccessors

Inside the CPU - Control Unit• FSM - Finite State Machine

– Generates Control Signals • External - Bus Signals • Internal - Register Load/Clear; ALU Control

– Synchronization • Controls when to Fetch/Execute • Generates Timing Signals • Handles External Events - Interrupts

– Generally Composed of Subcircuits• Bus Controller • Memory Controller • Cache Controller

Page 32: uProccessors

Computer OrganizationPrinciple Components

• CPU - (Central Processing Unit) – Fetch/Execute Machine

• Main Memory – An Array of Storage Locations for Bits – Data and Instructions Stored Here

• Secondary Storage – Memory that is Cheap – Memory that is Slow

• I/O Devices - (Input/Output) – Human and Computer to Communication – Computer and Other Device Communication

Page 33: uProccessors

Intel x86 MicroprocessorsCPU Name Year Intro. Int. CPU Clock # Trans. Addr. Pins Data Pins

8080 1974 2-3 MHz 4500 8 168086 1978 5-10 MHz 29000 16 20

80286 1982 6-16 MHz 130000 16 2480386 1985 16-33 MHz 275000 32 3280486 1989 25-50 MHz 1.2M 32 32

Pentium 1994 60-200 MHz 3.1M 64 32Pentium Pro 1995 150-200 MHz 5.5M 64 36

Pentium MMX 1997 133-266 MHz 64 32Pentium II 1998 233-500 MHz 7.5M 64Celeron 1998 266-500 MHz 7.5M 64

Pentium III 1999 450-600 MHz 64

Page 34: uProccessors

Intel x86 Microprocessors• 8086 - 20 bit Addr. Bus - 1MB of Memory • 80286 - 24 Addr. Bus - Added Prot. Mode • 80386 - 32 bit regs/busses - Virtual 86 Mode • 80486 - RISC Core - L1 Cache - FPU • Pentium - Superscalar - Dual Pipeline - Split L1 Cache • Pentium Pro - L2 Cache - Br. Pred. - Spec. Exec. • Pentium MMX - 57 Instructions - Integrated DSP (MMX) • Pentium II - 100 MHz Bus - L2 Cache - MMX • Celeron - 66 MHz Bus - True L2 Cache Integration • Pentium III - 100 MHz Bus - 70 Instr. Streaming SIMD Ext. • ….actual processors: P IV, Centrino, DualCore, Atom,…

Page 35: uProccessors

Intel x86 Family TreeDesigner Processor Codename Year CPU Clk BUS Clk Clk Mult Voltage Feature Size Tech. Package Pins

Intel 4004 1971 0.1 1 10Intel 8080 1974 2 1 5, 12 6 NMOS DIP 40Intel 8086 1978 4.77 4.77 1 5 3 NMOS, CHMOS DIP 40Intel 8086 1978 8 8 1 5 3 NMOS, CHMOS DIP 40Intel 8086 1978 10 10 1 5 3 NMOS, CHMOS DIP 40Intel 8088 1979 4.77 4.77 1 5 3 NMOS, CHMOS DIP 40Intel 8088 1979 8 8 1 5 3 NMOS, CHMOS DIP 40Intel 80186 1982 8 1 5 NMOS, CHMOS PLCC, PGA,LCC 68Intel 80186 10 1 5 NMOS, CHMOS PLCC, PGA,LCC 68Intel 80186 12.5 1 5 NMOS, CHMOS PLCC, PGA,LCC 68Intel 80188 8 1 5 NMOS, CHMOS PLCC, PGA,LCC 68Intel 80188 10 1 5 NMOS, CHMOS PLCC, PGA,LCC 68Intel 80286 1982 8 1 5 1.5 NMOS PLCC, PGA,LCC 68Intel 80286 1982 10 1 5 1.5 NMOS PLCC, PGA,LCC 68Intel 80286 1982 12.5 1 5 1.5 NMOS PLCC, PGA,LCC 68Intel 80386DX 1985 16 5 1.5 CHMOS PGA 132Intel 80386DX 20 5 CHMOS PGA 132Intel 80386DX 25 5 CHMOS PGA 132Intel 80386DX 33 5 CHMOS PGA 132Intel 80386SX 1988 16 5 1.5 CHMOS PQFP 100Intel 80386SX 1988 20 5 1.5 CHMOS PQFP 100Intel 80486DX 1989 25 5 0.8 CHMOS PGA 168Intel 80486DX 33 5 CHMOS PGA 168Intel 80386SL 1990 20 5 CHMOS PQFP, LGA 196/227Intel 80486SX 1991 16 5 0.8 CHMOS PQFP, PGA 196/168Intel 80486SX 1991 20 5 0.8 CHMOS PQFP, PGA 196/168Intel 80486SX 1991 25 5 0.8 CHMOS PQFP, PGA 196/168Intel 80486DX2 1992 50 25 2 5 0.6 PGA 168Intel 80486DX2 1992 50 25 2 5 0.6 Quad FP 196Intel 80486DX2 1992 66 33 2 5 0.6 PGA 168Intel 80486DX2 1992 66 33 2 5 0.6 Quad FP 196Intel 80486DX4 1994 60 3.3 0.6Intel Pentium 1993 60 60 1 5 0.8 BiCMOS PGA 273Intel Pentium 66 66 1 5 0.8 BiCMOS PGA 273Intel Pentium 75 50 1.5 3.3 0.6 PGA 296Intel Pentium 90 60 1.5 3,3 0.6 PGA 296

Page 36: uProccessors

80x86 microprocessors• 1972 Intel Corp. 8008 발표

• 1978 8086 발표– 20 bit address instead of 16

– 1MB memory access / 64K

– Bus Interface Unit/ Execution Unit 분리

– instruction fetch/ execution 동시실행

– Internal Registers : Data = 16bits

– HW multiplier/Divider

– External arithmetic processor

Page 37: uProccessors

8088

• 8bit external Bus

• Can use cheap and simple 8bit memory interface

• 16bit register / 20 bit address bits

• 1982 XT 발표 : 16 K memory, 4.77 MHz

Page 38: uProccessors

ALU/EXECUT

ADDAH

BH

CH

AL

BL

CL

DL

BP

DI

SI

SP

DH

CS

ES

SS

DS

IP

Instr. Decode; Bus Controller

1

2

3

4

5

6

FLAGS

SYSTEM BUS (Internal)

EU Instruction Queue

BIU

Data BusAddress BusInternal architecture of 8086

microprocessor

Page 39: uProccessors

80186/80188

• Single Computer in a chip

• 8086(8) + clock generator + timer + interrupt controller + DMA (Direct Memory Access) controller + IO interface

Page 40: uProccessors

80286

• 16bit data/ 24bit address

• Operation modes: Real mode / protected mode– Real mode : same as 8086

– Protected mode : multi- tasking programming

– Many segments in memory

– Once in a protected mode, cannot return real mode -> pitfall

Page 41: uProccessors

80386

• 1985 : 32 bit data/address

• 4GB physical memory access

• Real mode : same as 8086

• Protected mode : descriptor register controls tasks, allocates segment

• Segment size boundary, size

• Virtual Memory support

Page 42: uProccessors

80386

• Windows, OS/2

• 2 clock cycles for memory access

• Cache

• 16 added instructions

• 386SX : 16bit data/ 24bit address bits

Page 43: uProccessors

80486

• RISC (Reduced Instruction Set Computer) concept is applied

• Improved 386 performance

• 5 stage pipeline

• 80387 floating point processor

• DX2/DX4 : fast internal bus/slow external bus(clock)

Page 44: uProccessors

Pentium

• Super-scalar processor

• Separate 2 Pipelines

• Code cache/data cache

• 5 -8 -stage pipeline

• 64 bit external bus

Page 45: uProccessors

Operating modes for Pentium

• REAL MODE – similar as 8086 with possibility to switch

• PROTECTED MODE– Virtual 8086 multitasking, virtual memory addressing,

• SYTEM MANAGEMENT MODE (SMM):– Standard architectural feature since Intel 387 SL provides an

operating system and application independent power management system

– Activated by an external interrupt SMI# switches the CPU to a separate address space while saving the entire context of the CPU

Page 46: uProccessors

Advanced technologies used in Pentium (1)• Superscalar execution

– Compared with I486 which can execute only one instruction at a time, Pentium can sometimes execute 2 instructions at a time

• Pipeline architecture– Instructions are executed in 5 stages: this allows the processor to

overlap multiple instructions so that it takes less time to execute two instructions in a row

– Pentium has 2 independent pipelines• Branch target buffer

– Pentium processor fetches the branch target instruction before it executes the branch instruction

• Dual on-chip caches

– two separate caches on chip--one for instructions and one for datawhich allows the processor to fetch data and instructions from the cache simultaneously

• Write-back cach– When data is modified; only the data in the cache is changed. Memory

data is changed only when the processor replaces the modified data in the cache with a different set of data

Page 47: uProccessors

Advanced technologies used in Pentium (2)

• 64 bit bus– with its 64-bit-wide external data bus (Intel486 has 32-bit external bus) the

processor can handle up to twice the data load of the Intel486 processor at the same clock frequency

• Instruction optimization– The Pentium processor has been optimized to run critical instructions in fewer

clock cycles than the Intel486 processor

• Floating Point Optimization– The Pentium processor executes individual instructions faster through execution

pipelining, which allows multiple floating-point instructions to be executed at

the same time

• Pentium extension– The Pentium processor has fewer instruction set extensions than the Intel486

processors. The Pentium processor also has a set of extensions for multiprocessor (MP) operation. This makes a computer with multiple Pentium

processors possible

Page 48: uProccessors

Compared with I486:

• separate instruction and data caches

• dual integer pipelines (U and V)

• branch prediction with BTB

• pipelined FPU

• 64 external bus

• about 3 million transistors

Page 49: uProccessors

Pentium Pro

• Two separate silicon die : processor + second cache(256K or 512K)

• Internal bus : 32 bit

• External data bus : 64 bit

• Address bus : 36bit for 64GB

• 100% compatible with 80x86 programs

• 3 processor instruction + 2 floaingpoint instructions

Page 50: uProccessors

Improvements in Pentium Pro • Superpipelining: increases the number of execution steps, to 14, from the

Pentium's 5.• Integrated Level 2 Cache: The Pentium Pro features a higher-performance

secondary cache compared to all earlier processors. Instead of using motherboard-based cache running at the speed of the memory bus, it uses an integrated level 2 cache with its own bus, running at full processor speed, typically three times the speed that the cache runs at on the Pentium. The Pentium Pro's cache is also non-blocking, which allows the processor to continue without waiting on a cache miss.

• 32-Bit Optimization: The Pentium Pro is optimized for running 32-bit code (which most modern operating systems and applications use) and so gives a greater performance improvement over the Pentium when using the latest software.

• Wider Address Bus: The address bus on the Pentium Pro is widened to 36 bits, giving it a maximum addressability of 64 GB of memory.

• Greater Multiprocessing: Quad processor configurations are supported with the Pentium Pro compared to only dual with the Pentium.

• Out of Order Completion: Instructions flowing down the execution pipelines can complete out of order.

• Superior Branch Prediction Unit: The branch target buffer is double the size of the Pentium's and its accuracy is increased.

• Register Renaming: This feature improves parallel performance of the pipelines.• Speculative Execution: The Pro uses speculative execution to reduce pipeline stall

time in its RISC core.

Page 51: uProccessors

P6 Microarchitecture

• 1st level cache = 8KB instruction cache + 8KB data cache

• 2nd Level cache = 1 MB static RAM, 64 bits bus

• CENTERPIECE =Out of Order Execution called “Dynamic Execution) – 3 functions

• Deep branch prediction (DBP)

• Dynamic Data Flow Analysis (DDFA)

• Speculative Execution (SE) – execute instructions beyind a branch

Page 52: uProccessors

Pentium 4 • NetBurst Architecture

– 1. Hyper pipeline technology: more pipelines: 20 – 31 pipes

– 2. Rapid Execution Engine: the ALU in the core of the CPU actually operate at twice the core clock frequency

– 3. Execution Trace Cache: It stores decoded micro-operations, so that when executing a new instruction, instead of fetching and decoding the instruction again, the CPU directly accesses the decoded micro-ops from the trace cache, thereby saving a considerable time

• High clock speeds (up to 4 GHz)

• SSE2 and SSE3 instruction sets to accelerate media processing

• Integration of HyperThreading

– make one physical CPU work as two logical and virtual CPUs

• Bigger L2 cache (512KB, 2MB)

• Pipeline: 31 stages

Page 53: uProccessors

HyperThreading Technology

• The technology enables a single physical processor to execute two or more separate code streams (threads) concurrently logical processors

• The logical processors in an IA-32 processor supporting HT Technology share the core resources of the physical processor. This includes the execution engine and the system bus interface.

• After power up and initialization, each logical processor can be independently directed to execute a specified thread, interrupted, or

halted.

• Figure shows a comparison of a processor that supports HT Technology (implemented with two logical processors) and a traditional dual processor system.

Page 54: uProccessors

Dual (Multi) Core Processors • Based on core technology: more processors on a single chip they

share some of the resources / external buses, cache

• Dual core - Less power consumtion (50%, peak of 65W)

• Faster on CPU intensive applications (audio/video processing, files scans, etc)

Page 55: uProccessors

Homework

• Explain the concept of pipeline

• Explain which is the difference in addressing the memory and addressing the peripheral devices

• Explain the role of the “retirement unit” from P6 microarchitecture

• Explain the difference between 1st level cache and 2nd level cache

• Explain the concept of “speculative execution”

• SIMD and SSE2 stand for …… (Explain).

• Explain the concept of HyperThreading

• Which is the number bits allocated for data bus, respectively address bus for the following microprocessors: 8080, Pentium IV, 80484, 80286, 8086, 80186.

Page 56: uProccessors
Page 57: uProccessors
Page 58: uProccessors
Page 59: uProccessors
Page 60: uProccessors
Page 61: uProccessors

(C2)

80x86 Internal Architecture

Page 62: uProccessors

Computer Operation Model FETCH Instruction - EXECUTE Instruction

FETCH EXECUTE FETCH EXECUTE FETCH EXECUTE

time

FETCH 1) Read Instruction from Memory

2) Decode/Interpret Instruction

3) Increment Instruction Address Register

EXECUTE 1) Control Unit - Input is Decoded Instruction

2) Control Signals Set

3) Data is Processed

Page 63: uProccessors

8086 Architecture Specifics BIU and EU - Pipelined Arrangement

• BIU - Bus Interface Unit

• Instruction Pipeline

• EU - Execution Unit • Pipeline - Hardware Designed for Parallel Operation

FETCH

EXECUTE

FETCH

EXECUTE

FETCH

EXECUTE WAIT

FETCH FETCH GET DATA

EU

BIU

time

Page 64: uProccessors

8086 Internal Architecture Execution Model

Page 65: uProccessors

8086 Overall Architecture BIU and EU - Pipelined Arrangement

EXECUTION

UNIT EU

BUS

INTERFACE

UNIT BIU

System Bus (PC Bus)

Instruction

Pipeline

Page 66: uProccessors
Page 67: uProccessors
Page 68: uProccessors

ALU/EXECUT

ADD AH

BH

CH

AL

BL

CL

DL

BP

DI

SI

SP

DH

CS

ES

SS

DS

IP

Instr. Decode;

Bus Controller

1

2

3

4

5

6

SYSTEM BUS (Internal)

FLAGS

EU Instruction

Queue

BIU

Data Bus Address Bus

Page 69: uProccessors

Content of the EU:…… Content of the BIU: ….

Page 70: uProccessors

BIU – Bus Interface Unit

(Resp: signals and data/instruction

control)

• To bring the instructions into the internal QUEUE

• To control the content of the queue

• To computes the address

• To generates the control signals

Page 71: uProccessors

BIU - contents

• Bloc for controlling the signals

• FIFO memory to implement the 6 bytes queue

• Instruction pointer (next instruction to be executed)

• ALU to calculate the address

• Internal communication registers

• Registers for memory segmentation

Page 72: uProccessors

EU – Execution Unit

• Decoding of instructions

• ALU

• General registers (accessible by user)

• Internal registers (internal operations)

• Register to store the status and control of the program

Page 73: uProccessors
Page 74: uProccessors

CS

DS

SS

ES

AH

BH

CH

DH

AL

BL

CL

DL

IP

SP

BP

SI

DI

0 7

0 15

0 7

0 15

Accumulator

Base

Counter

Data

Code Segment

Data Segment

Stack Segment

Extra Segment

Instruction Pointer

Stack Pointer

Base Pointer

Source Index

Destination Index

}

} }

AX

BX

CX

DX

Page 75: uProccessors

For 32 bit processors: AX register (16b) EAX (32b)

Page 76: uProccessors

8086/8088 Register File (cont) Instruction Pointer Register

0 15

IP Contains Address of NEXT Instruction to be Fetched

– Automatically Incremented

– Programmer can Control with jump and branch

Page 77: uProccessors

AX, BX, CX, DX General Purpose Registers

• Can Be Used Separately as 1-byte Registers

»AX AH:AL

• Temporary Storage to Avoid Memory Access

– Faster Execution

– Avoids Memory Access

• Some Special uses for Certain Instructions

AH

BH

CH

DH

AL

BL

CL

DL

0 7 0 7

Accumulator

Base

Counter

Data

Page 78: uProccessors

AX, BX, CX, DX General Purpose Registers - Some Specialized Uses

• AX, Accumulator

– Main Register for Performing Arithmetic

– mult/div must use AH, AL

– “accumulator” Means Register with Simple ALU

• BX, Base

– Point to Translation Table in Memory

– Holds Memory Offsets; Function Calls

• CX, Counter

– Index Counter for Loop Control

• DX, Data

– After Integer Division Execution - Holds Remainder

AH

BH

CH

DH

AL

BL

CL

DL

0 7 0 7

Accumulator

Base

Counter

Data

Page 79: uProccessors

CS, DS, ES, SS - Segment

Registers Contains “Base Value” for Memory Address

• CS, Code Segment

– Used to “point” to Instructions

– Determines a Memory Address (along with IP)

– Segmented Address written as CS:IP

• DS, Data Segment

– Used to “point” to Data

– Determines Memory Address (along with other registers)

– ES, Extra Segment allows 2 Data Address Registers

• SS, Stack Segment

– Used to “point” to Data in Stack Structure (LIFO)

– Used with SP or BP

– SS:SP or SP:BP are valid Segment Addresses

Page 80: uProccessors
Page 81: uProccessors
Page 82: uProccessors
Page 83: uProccessors

IP, SP, BP, SI, DI - Offset Registers Contains “Index Value” for Memory Address

• IP, Instruction Pointer

– Used to “point” to Instructions

– Determines a Memory Address (along with CS)

– Segmented Address written as CS:IP

• SI, Source Index; DI, Destination Index

– Used to “point” to Data

– Determines Memory Address (along with other registers)

– DS, ES commonly used

• SP, Stack Pointer; BP, Base Pointer

– Used to “point” to Data in Stack Structure (LIFO)

– Used with SP or BP

– SS:SP or SP:BP are valid Segment Addresses

These can also be used as General Registers !!!!!!

Page 84: uProccessors

8086/8088 Register File (cont) Flags Register

x x x x OF DF IF TF SF ZF x AF x PF x CF

0 15

Status and Control Bits Maintained in Flags Register

– Generally Set and Tested Individually

– 9 1-bit flags in 8086; 7 are unused

Page 85: uProccessors

Status Flags

• CF Carry Flag Arithmetic Carry

• OF Overflow Flag Arithmetic Overflow

• ZF Zero Flag Zero Result; Equal

Compare

• SF Sign Flag Negative Result; Non-

Equal Compare

• PF Parity Flag Even Number of “1” bits

• AF Auxiliary Carry Used with BCD

Arithmetic

Indicate Current Processor Status

Page 86: uProccessors

Control Flags Influence the 8086 During Execution Phase

• DF: Direction Flag Increment/Decrement

– used for “string operations”

• IF: Interrupt Flag Enables Interrupts

– allows “fetch-execute” to be interrupted

• TF Trap Flag Allows Single-Step

– for debugging; causes interrupt after each op

Page 87: uProccessors

MOV AH,[SI]

Page 88: uProccessors
Page 89: uProccessors

8086 Segmented Memory

• x86 Memory Partitioned into Segments – 8086: maximum size is 64K (16-bit index reg.) – 8086: can have 4 active segments (CS, SS, DS, ES)

– 8086: 2-data; 1-code; 1-stack – x386: maximum size is 4GB (32-bit index reg.) – x386: can have 6 active segments (4-data; FS, GS)

• Why have segmented memory ???????? •Other microprocessors could only address 64K since they

only had a single 16-bit MemAddrReg (or smaller).

Segments allowed computers to be built that could use more

than 64K memory (but not all at the same time).

Page 90: uProccessors
Page 91: uProccessors

8086/8088 Memory Access Registers

CS

DS

SS

ES

IP

SP

BP

SI

DI

0 15

0 15

Code Segment

Data Segment

Stack Segment

Extra Segment

Instruction Pointer

Stack Pointer

Base Pointer

Source Index

Destination Index

}

} }

Page 92: uProccessors

ADD

CS

ES

SS

DS

IP

Memory System

Address Lines

0000 Index Reg. Segment Reg.

Physical Address

0 0

0

15 15

19

Portion of BIU Circuitry

Dedicated Segment Registers

Dedicated Index Registers

BP

DI

SI

SP

8086 Generating Physical Addresses

Page 93: uProccessors

Segmented Addressing

CS

ES

SS

DS

IP

BP

DI

SI

SP

• Each Segment must begin at Paragraph Boundary

00000h

00010h

00020h

physical address memory

paragraph 1

paragraph 2

paragraph 3

• Each paragraph has phys. address that is multiple of 10h

• BIU is responsible for appending 0000 to Segment

– only need 16-bit segment registers

Page 94: uProccessors
Page 95: uProccessors

Segmented Memory (x86 Style)

CS

ES

SS

DS

Data

Segment

Stack

Segment

Extra

Segment

Code

Segment

Segment

Registers

System

Memory

• Segment Registers: – Point to Base Address

• Index Registers: – Contain Offset Value

– • Notation (Segmented Address):

– CS:IP – DS:SI – ES:DI – SS:BP – SS:SP

00000h

FFFFFh

fragmentation

Page 96: uProccessors

Memory Storage Organization

• Organized as SEGMENTS – Maximum segment size = 64KB

– (Since 16 bit offsets: 216 = 65,535 = 64KB)

• Maximum Memory Size: – 220 = 1,048,576 = 1MB

• Newer Processors (Pentium) Can Utilize More Memory – Wider Address Registers 32 bits

– 232 = 4,294,967,296 = 4GB

Page 97: uProccessors

Segmented Memory Example

CS

ES

SS

DS

Data

Segment

Stack

Segment

Extra

Segment

Code

Segment

Segment

Registers

System

Memory

• Logical, Segmented Address: 0FE6:012Bh

• Offset, Index Address: 012Bh

• Physical Address: 0FE60h 65120 + 012Bh 299 0FF8Bh 65149

00000h

FFFFFh

Page 98: uProccessors

Segmented Memory Aliasing

• Logical, Segmented Address 1: DS:SI = 1234:4321

• Physical Address: 12340h 74560 + 4321h 17185 16661h 91745

• Logical, Segmented Address 2: ES:DI = 1665:0011

• Physical Address: 16650h 91728 + 0011h 00017 16661h 91745

Page 99: uProccessors

Segment Locations in Physical Memory

Page 100: uProccessors

• 1 Word = 16 bits • Byte Addressable • Little Endian Arrangement

– MSB (Most Significant Byte) at Higher Address

0727H

0726H

0725H

0724H

0723H

0722H

072CH

072BH

072AH

0729H

0728H

• Base Address = ACEDH

AD5F4H

AD5F3H

AD5F2H

AD5FCH

AD5FBH

AD5FAH

AD5F9H

AD5F8H

AD5F7H

AD5F6H

AD5F5H

• Logical Address = 0724H

• Physical Address

= ACED0H + 0724H

= AD5F4H

• M[ACED:0724]

= M[AD5F4]

= 5502H 02H

18H

A3H

7EH

69H

AAH

2EH

00H

55H

11H

72H

0H 2H 5H 5H

0101 0101 0010 0000

0724H 0725H

hex

binary

Page 101: uProccessors

0727H

0726H

0725H

0724H

0723H

0722H

072CH

072BH

072AH

0729H

0728H

AD5F4H

AD5F3H

AD5F2H

AD5FCH

AD5FBH

AD5FAH

AD5F9H

AD5F8H

AD5F7H

AD5F6H

AD5F5H

55H

18H

A3H

7EH

69H

AAH

2EH

00H

02H

20H

11H

AD5F1H

AD5F0H

AD5EFH

AD5EEH

AD5EDH

AD5ECH

0721H

0720H

071FH

071EH

071DH

071CH

72H

DEH

ADH

FAH

CEH

CAH

FEH

Assume:

M[DS:DI] Contains a Pointer Value

DS = AD5Fh; DI = 0005h

(All Segments Start on Paragraph Boundary)

SI M[DS:DI]

Then:

Pointer is M[DS:DI] = M[AD5F:0005]

= M[AD5F5] = 0002h

M[DS:SI] = M[DS:(DS:DI)] = M[DS:0002h]

= M[AD5F:0002] = M[AD5F2] = 1120h

Page 102: uProccessors

Default Segment/Index Pairs

Type of Memory Reference Default Segment Base Alternate Segment Base Offset

Instruction Fetch CS None IP

Stack Operation SS None SP

Variable (except following) DS CS, ES. SS Effective Address

- String Source DS CS, ES, SS SI

- String Destination ES None DI

- BP used as Base Register SS CS, DS, ES Effective Address

- BX Used as Base Register DS CS, ES, SS Effective Address

Page 103: uProccessors
Page 104: uProccessors
Page 105: uProccessors
Page 106: uProccessors
Page 107: uProccessors
Page 108: uProccessors

Homework:

Give several exercises

Keypoints

Page 109: uProccessors

(C3)

Addressing Modes for

80x86 microprocessors

Page 110: uProccessors

Addressing modes- Classification

• Register addressing

• Immediate addressing

• Memory addressing • Direct addressing

• Indirect register addressing

• Based addressing (with/without displacement)

• Indexed addressing (with/without displacement)

• Based-indexed adressing (with/without displacement)

• Addrssing on strings of bytes

• Addressing of ports

Page 111: uProccessors
Page 112: uProccessors
Page 113: uProccessors
Page 114: uProccessors
Page 115: uProccessors

Exceptions:

-Segm segm

-Segm immediate value

Page 116: uProccessors
Page 117: uProccessors
Page 118: uProccessors

Memory addressing

Page 119: uProccessors
Page 120: uProccessors
Page 121: uProccessors
Page 122: uProccessors
Page 123: uProccessors
Page 124: uProccessors
Page 125: uProccessors
Page 126: uProccessors
Page 127: uProccessors
Page 128: uProccessors
Page 129: uProccessors
Page 130: uProccessors
Page 131: uProccessors
Page 132: uProccessors
Page 133: uProccessors

Addressing on strings of bytes

• Strings of bytes

– Source string (SI), in DS (default)

– Destination string (DI), in ES (default)

• Examples of strings

• Examples how the address is calculated:

– MOVSB, LODSB.

Page 134: uProccessors

Addressing the ports

• What is a port?

• Input/output on ports

• Which is the address of the port?

– Difference on memory address

• Registers used in addressing

• Examples

• How to switch on a LED? Example.

Page 135: uProccessors

Instruction encoding (e.g. MOV)

Page 136: uProccessors
Page 137: uProccessors
Page 138: uProccessors
Page 139: uProccessors

The instruction set

http://burks.brighton.ac.uk/burks/language/asm/asmtut/asm1.htm#toc http://webster.cs.ucr.edu/AoA/DOS/AoADosIndex.html

1) Instructions for data transfer

2) Arithmetic instructions

3) Logic instructions

4) Shifts/rotate instructions + LOOPS

5) Instructions on strings of bytes

6) Instructions for port input/outpus

Page 140: uProccessors

Instructions for data transfer

• MOV

• XCHG

• XLAT

• PUSH/POP

• LEA

• LDS, LES

Page 141: uProccessors

Arithmetic Instructions (… to be continued)

• ADD, ADC

• INC

• AAA, DAA

• SUB, SBB

• DEC

• AAS, DAS

Page 142: uProccessors

(C4)

INTRUCTION SET

Page 143: uProccessors

The instruction set

http://burks.brighton.ac.uk/burks/language/asm/asmtut/asm1.htm#toc http://webster.cs.ucr.edu/AoA/DOS/AoADosIndex.html

1) Instructions for data transfer

2) Arithmetic instructions

3) Logic instructions

4) Shifts/rotate instructions + LOOPS

5) Instructions on strings of bytes

6) Instructions for port input/outpus

Page 144: uProccessors

Instructions for data transfer

• MOV

• XCHG

• XLAT

• PUSH/POP

• LEA

• LDS, LES

Page 145: uProccessors

Important:

-Dest & source – the same size in bits

-Register can not be IP

-Transfer “memory” – “memory” is not possible

-Flags are not changed

Page 146: uProccessors
Page 147: uProccessors

Exercises (MOV, XCHG) 1) In AH, byte from the address 0, AL – FFFFF

1) Using direct addressing

2) Using indexed addressing

2) ES=1000, DS=5000, DI=100, SI=200 exchange the values of

mem locations (bytes):

1) Using only MOV

2) Using XCHG

3) Use based with index addressing AX ES:[3000h]

4) Interchange DS with ES

5) AXBXCXDXAX (2 solutions give other solutions)

6) Interchange AX with BX without: MOV, XCHG (**)

7) For laboratory: propose 2-3 exercises similar as above

Page 148: uProccessors
Page 149: uProccessors

Exercise XLAT

1) Draw the schematic principle

2) Where is applied: encryption, conversion

3) Example with ASCII codes

4) Write an encryption algorithm – give the solution:

1) Input from port 100h

2) Encrypt

3) Send to the port 200h

Page 150: uProccessors
Page 151: uProccessors
Page 152: uProccessors
Page 153: uProccessors

LDS, LES - examples

• The schematic explanation (first SI, then

DS)

• LDS SI, adress (LDS BX, address)

• LES DI, address (LES reg,address)

• Example for transfer of strings of bytes

Page 154: uProccessors
Page 155: uProccessors
Page 156: uProccessors
Page 157: uProccessors
Page 158: uProccessors

Exercises PUSH, POP

• Save an the stack all register (CALL)

• Exchange BX with CX using push/pop

• AXBXCX using push/pop

• Propose 2-3 problems

Page 159: uProccessors
Page 160: uProccessors
Page 161: uProccessors
Page 162: uProccessors

Arithmetic Instructions (… to be continued)

• ADD, ADC

• INC

• AAA, DAA

• SUB, SBB

• DEC

• AAS, DAS

Page 163: uProccessors
Page 164: uProccessors
Page 165: uProccessors
Page 166: uProccessors
Page 167: uProccessors
Page 168: uProccessors
Page 169: uProccessors
Page 170: uProccessors

(C5)

INTRUCTION SET - 2

Page 171: uProccessors

The instruction set

http://burks.brighton.ac.uk/burks/language/asm/asmtut/asm1.htm#toc http://webster.cs.ucr.edu/AoA/DOS/AoADosIndex.html

1) Instructions for data transfer

2) Arithmetic instructions

3) Logic instructions

4) Shifts/rotate instructions + LOOPS

5) Instructions on strings of bytes

6) Instructions for port input/outpus

Page 172: uProccessors

Exercise XLAT

• Conversion of the digit from

– AL (0, 1, ...9, A, ...F) in the corresponding

– ASCII code (30h,...39h, 41h, ...46h)

• Give 2 solutions

Page 173: uProccessors
Page 174: uProccessors

Example AAA, DAA

• AL=37h, BL=32h (in ASCII)

• The result:

– in binary,

– in ASCII

• DAA instruction for BCD numbers

Page 175: uProccessors

Example AAA

;Example AAA

MOV AH, 09h

MOV AL, 05h

ADD AL, AH

MOV AH, 0

AAA

; example AAS

MOV AL, 05h

MOV BL, 09h

SUB AL, BL; al=FC (-4)

; convert to BCD, AL = 6, ;

AAS

ADD AL, 30h; convert in

ASCII

Page 176: uProccessors
Page 177: uProccessors

Examples

1) AX= BX-CX

2) Substraction on bytes (SBB)

3) (AX,BX) = (AX,BX) – (CX, DX)

4) Al=al-2

5) Mov bx, 0;

Dec bx

Page 178: uProccessors

On BYTE: AX = AL*operand(8)

On WORD: (DX,AX) = AX*operand(16). Eg:..

Page 179: uProccessors

Examples MUL • Ex:

val1 DB 3

val2 DW 257

mov al, 0ah

mul val1

mov ax,100h

mul val2

• AX=3*AL (mul + add)

• AX= 5*AL – 7*BL

– 2 solutions

• AL = BCD representation of a number on 2 digits. BL – its binary representation.

mov al,8

mov bl,7

mul bl; AX=38h=56

aam; AX=0506

Page 180: uProccessors

On BYTE: AL = [AX / operand(8))], AH = the rest

On WORD: AX = [(DX,AX) / operand(16)], DX – the rest

Page 181: uProccessors

Examples DIV

• AL=AL/3

• BL = BL/2 (give 2 solutions)

• AL= AL/5 – BL/7

– Remarks (AL AX)

Page 182: uProccessors

Examples:

• AX = AX – BX (sub ax,bx OR neg bx; add ax,bx

Page 183: uProccessors

mov al,value

mov bl,2

cmp al,bl

jl label

inc bl

label inc bl

Page 184: uProccessors

Conditional JUMP

JUMP IF less/bellow JL/JB

less or equal/bellow or eq JLE/JBE

equal/zero JE/JZ

not equal/not zero JNE/JNZ

greater or equal/above eq JGE/JAE

greater/above JG/JA

carry/not carry JC/JNC

sign/not sign JS/JNS

Page 185: uProccessors

Exercises

• AL = max(BL, CL)

• AL = BL+CL (if DL>0), BL-CL (DL<0), 0

• DL = 0 if AL is “odd”, 1 if AL is “even”

• AL = ASCII code (digit from AL)

Page 186: uProccessors

TEST dest,source

Page 187: uProccessors
Page 188: uProccessors
Page 189: uProccessors

Exercises

mov ax, 0abcdh

and ax,0ffh

or ah, 0fch

xor al,ah

test al,1

• AL = 0 (if BL6=0), 1 (if BL6=1)

• AX=ASCII AL=binary

• DL=Binary AX-ASCII

Page 190: uProccessors
Page 191: uProccessors
Page 192: uProccessors

(C6)

INTRUCTION SET - 3

Page 193: uProccessors

The instruction set

http://burks.brighton.ac.uk/burks/language/asm/asmtut/asm1.htm#toc http://webster.cs.ucr.edu/AoA/DOS/AoADosIndex.html

1) Instructions for data transfer

2) Arithmetic instructions

3) Logic instructions

4) Shifts/rotate instructions + LOOPS

5) Instructions on strings of bytes

6) Instructions for port input/outpus

Page 194: uProccessors

Instuctions for SHIFT

• Logic (insert 0s)

– Left: SHL reg/mem, {1, CL}

• 1 0 1 1 0 0 0 1

• 0 1 1 0 0 0 1 0

– Right: SHR reg/mem, {1, CL}

• 1 0 1 1 0 0 0 1

• 0 1 0 1 1 0 0 0

• Arithmetic (insert 0s, but keep the SIGN)

– Left: SAL reg/mem, {1, CL}

– Right: SAR reg/mem, {1, CL}

Page 195: uProccessors

Instuctions for ROTATE

• Without Carry (CY is not rotated)

– Left: ROL reg/mem, {1, CL}

• 1 0 1 1 0 0 0 1

• 0 1 1 0 0 0 1 1

– Right: ROR reg/mem, {1, CL}

• 1 0 1 1 0 0 0 1

• 1 1 0 1 1 0 0 0

• With Carry (CY is included in rotation)

– Left: RCL reg/mem, {1, CL}

• CY=x 1 0 1 1 0 0 0 1

• CY=1 0 1 1 0 0 0 1 x

– Right: RCR reg/mem, {1, CL}

• CY=x 1 0 1 1 0 0 0 1

• CY=1 x 1 0 1 1 0 0 0

Page 196: uProccessors
Page 197: uProccessors
Page 198: uProccessors

Examples

a) mov al, 0ffh

shl al,1

mov cl,3

shl al,cl

------------------

c) mov al, 0fch

mov cl,4

rol al,cl

shr al,cl

b) sal al,1; (mul 2)

sar al,1; (div 2)

Page 199: uProccessors

Exercises (1)

1) Store in BL the value of bit a4 from AL

a) b)

mov cl,3 and al,00010000b

shl al,cl mov cl,4

mov cl,7 shr al,cl

shr al,cl mov bl,al

mov bl,al

Find out other 2 solutions !!

Page 200: uProccessors

Exercises (2) 2) AX = ??xy; (x,y=hexa). Obtain AX=0x0y

push cx

mov cl,4

rol ax,cl; AX=?xy?

and ah,0Fh AX=0xy?

shr al,cl; AX=0x0y

pop cx

Propose another solution !!

Page 201: uProccessors

Exercises (3)

3) AX = 8*AL – 7*BL

mov cl,3

cbw

sal ax,cl

xchg ax,bx

cbw

mov dx,ax

sal ax,cl

sub ax,dx

sub bx,ax

xchg ax,bx

Page 202: uProccessors

Exercises (4)

4) Counts into DL the number of bits “1” from AX

xor dl,dl

mov cx,16

nextbit rcl ax,1

jnc zerobit

inc dl

zerobit dec cx

jnz nextbit

Propose another 2 solutions !!

Page 203: uProccessors

Exercises (5)

5) Fill in the first 256 bytes from DS with the values: 00, 01, 02, ..., FFh

mov si,0

mov cx,256

xor al,al

NextByte: mov byte ptr[si],al

inc al

inc si

dec cx

jnz NextByte

Page 204: uProccessors

LOOP instruction Syntax:

LOOP label

Equivalent with:

DEC CX

JNZ label

Other forms:

LOOPE/LOOPZ and

LOOPNE/LOOPNZ

Page 205: uProccessors

Examples

mov cx,100

xor ax,ax

et1: add ax,2

loop et1

Page 206: uProccessors

Instructions to control the FLAGS

Examples: ...some examples.

Page 207: uProccessors

Example: read from keyboard (port 60h) and write to printer

(port 378h):

in al,60h

mov dx,378h

out dx,al

(!!! Some tests are required: keypressed?, printer busy?...later

on)

Page 208: uProccessors

Examples IN/OUT

1) Generate a rectangular signal on D0 from port 300h

2) Control the frequency

3) Give the solution to control the duration of the signal

4) Signal with another form

5) Connect a DAC and generate a triangular signal (maximum frequency)

6) A dynamic light: control the speecd

Page 209: uProccessors

Examples: a) wait for non busy, b) timeout

Page 210: uProccessors
Page 211: uProccessors

LODSB(W)

Page 212: uProccessors

Example LODSB

DX = Sum(DS:SI=100h), i=1...20

xor dx,dx

mov cx,20

mov si,100h

cld

nextbyte: lodsb

cbw

add dx,ax

loop nextbyte

Propose the solution without using LODS

Page 213: uProccessors

STOSB(W)

Page 214: uProccessors

Example STOSB

Generate a string of 256 bytes (00, 01, ...FFh) at the address ES:DI=300H

mov di,300h

xor al,al

mov cx,256

cld

sto: stosb

inc al

loop sto

nop

Propose the solution without using STOSB

Page 215: uProccessors

MOVSB

Page 216: uProccessors

Examples MOVSB

(transfer 20 bytes from DS:SI=100h to ES:DI=300h)

mov si,100h

mov di,300h

mov cx,20

e: mov al,[si]

mov [di],al

inc si

inc di

dec cx

jnz e

mov si,100h

mov di,300h

mov cx,20

cld

e: MOVSB

loop e

Obs:

REP

MOVSB

Page 217: uProccessors
Page 218: uProccessors

Example: returns into BX the offset of the first 00 byte encountered in the

string of 100 bytes found at the address ES:DI=200h

OR 0FFFF if not found.

mov di,200h

mov cx,100

mov al,0

s: cmp al,[di]

je f0

inc di

loop s

mov di,0ffffh

f0: mov bx,di

nop

mov di,200h

mov cx, 100

mov al,0

cld

REPNE

SCASB

jcxnz f

mov di,0

f: dec di

mov bx,di

nop

Page 219: uProccessors
Page 220: uProccessors

Exercise

Data Acquisition System:

- Control port, RD/WR: 200h: (START on D0

active in 1, EOC on D7 active in 0)

- data port, RD, 300h

- Read 10.000 samples in ES:DI=100h

Page 221: uProccessors

MACRO - instructions= a group of instructions identified by a unique name (the name of the

MACRO) and interpreted as a “new instruction”- a MACRO needs to be defined:

name MACRO param_1, ..., param_n....instructions....ENDM

In order to use the MACROs:- They need to be defined- They could be used afterwards

Page 222: uProccessors

Example 1 (without parameters)• MACRO to store/restore the registersDefinitions: (A) (B)push_regs MACRO pop_regs MACRO

push ax pop dxpush bx pop cx push cx pop bxpush dx pop axENDM ENDM

Usage:.... .....push_regs ; substituted by the above sequence.... ....pop_regs.... ....

Discussion:Advantages (+), Disadvantages (-)

Page 223: uProccessors

Example 2 (with parameters)• MACRO to FILL in a string of bytes in ES at the address “addr” with the

value 0 (parameters: address and number of bytes )Definition: fill MACRO addr, n

xor al,alcldmov di, addrmov cx, nrepstosbENDM

Usage:.... .....fill 100h, 200h ; substituted by the above sequence.... ....

Page 224: uProccessors

Example 3 (with parameters)• MACRO to add/subtract 2 numbers n1, n2 of 1 byte into AL (AL=n1+/- n2)Definition: compute MACRO n1, operand, n2

mov al, [n1]cmp [operand], ‘+’jne minusadd al, [n2]jmp final

minus: sub al,[n2]final: nop

ENDMUsage:

mov di DB 20hop DB ‘-’b DB 10h.... .....compute a, op, b ; substituted by the above sequence.... ....

Page 225: uProccessors

Exercises (homework)

MACRO for:

• Obtaining in AX the sum of a string of bytes (the offset address in DS andthe number of the bytes are the parameters)

• Obtaining in AL the maximum of a string of bytes (the address and thenumber of the bytes are the parameters)

• Returning in CX the length of a string of bytes that ends with 00h (theaddress is transmited as parameter)

Page 226: uProccessors

CALL - instructions

• The need to substitute sequences of programs which are repeated OR group thefunctionalities in a single software entity

• Example – diagram• Types of CALLS

– Intrasegment (NEAR Calls) - IP– Intersegment (FAR Calls) – CS, IP

Page 227: uProccessors

Execution Steps1) CALL is classified as NEAR or FAR2) NEAR FAR

– save IP on the stack - save CS on the stack- save IP on the stack

3) JUMP at the address CS:IP4) Execute the sequence, until RET is encountered5) RET execution:

NEAR- get IP from the stack - get IP from the stack

- get CS from the stack6) JUMP at the address CS:IP

Page 228: uProccessors

ProceduresDefinition:

namep PROC {NEAR or FAR}... ...instructions... ...RET; PAY ATTENTION !!

namep ENDP

Usage:... ...call namep... ...

Page 229: uProccessors

Example 1 (find_max in a string; receives in SI begining of the stringand the length in CX; returns the max in AL and the index of max in BX)

find_max PROC NEARmov al, byte ptr [si]mov bx,sidec cx

c: cmp al, byte ptr[si +1]jge Okmov al, byte ptr[si+1]mov bx,siinc bx

Ok: inc siloop cRETENDP

Usage:.... ...mov si, offset string1mov cx,lengthcall find_max... ...

Page 230: uProccessors

Example 2 (strlen – returns in CX the length of a string of bytes finished with00h; receives into DI the begining of the string)

strlen PROCxor cx,cxxor al,alcld

comp: scasbjz exitinc cxjmp comp

exit: retENDP

Usage:str DB ‘un text’, ‘0’.... ...mov di, offset str; (equiv: lea di,str)call strlen... ...

Page 231: uProccessors

Allocation of memory for variables

DB – define byte, DW – define word, DD-define double wordExamples:

a DB 1b DB 2c DW 1, 2, 3str DB ‘text’, ‘0’len EQU $-Str

Usage:mov al, [a]mov si, offset amov al, [si]mov si, offset str

Page 232: uProccessors

Organisation of the programs in Assembling Language(*.asm)

PAGE 60,132TITLE ROTITCOMMENT * *STIVA SEGMENT PARA STACK 'STACK'

DW 256 DUP(?)STIVA ENDS;DATA SEGMENT PARA PUBLIC 'DATE'a DB 0DATA ENDS

CODE SEGMENT PARA PUBLIC 'COD'MAIN PROC FAR

ASSUME SS:STIVA,DS:DATA,CS:CODE,ES:NOTHINGpush dsxor ax,axpush ax ;preg.pt.retmov ax,DATAmov ds,ax ;preg. DS

; .....ret

MAIN ENDPCODE ENDS

END MAIN

Page 233: uProccessors

EXE/COMTASM progr.asm

(progr.obj)

TLINK progr.obj(com/exe – options in TLINK)

Page 234: uProccessors

THE SYSTEM OF INTERRUPTS

1) Definitions2) Questions (??)3) Classification of interrupts4) The Interrupt Vector Table (IVT)5) The steps to execute a ISR6) The interrupt controller 82597) The sequence for “Interrupt Acknowledge”8) Applications of software interrupts

Page 235: uProccessors

1) Definitionsa) Need of communication between the uP and the

peripheral devices

b) Idea: to interrupt the execution of the current program

c) Def: Interrupts + Interrupt Service Routine

uP Peripheral devices

Page 236: uProccessors

2) Questions1) Who can interrupt the uP? (possibilities)

a) Hardwareb) Software Classification of interrupts

2) What happens when an interrupt is accepted?3) How the processor finds the address of ISR?4) Then, which is the difference between a

PROC and ISR?• Address (ISR), address (PROC)• End: ISR (iret), PROC (ret)

Page 237: uProccessors

3) Classification of interruptsa) Internal interrupts / exceptionsb) Hardware interrupts (from peripheral devices data

transfer; signals are used)• INTR – maskable interrupts

• I=1 (STI)• I=0 (CLI)

• NMI – non-maskable interrupts• NMI

When accepted? - At the end of an instruction cycle !How are the peripheral devices recognised? By a type number which is used by the processor as a pointer in the IVT to obtain the address of the ISR

Page 238: uProccessors

c) Software interruptsINT k; k=0...255 (type of interrupt)

Classification (cont)

Examples:

INT 10h (video services)

INT 14h (communication on serial interface)

Page 239: uProccessors

4) The Interrupt Vector Table (IVT)• Implements a mechanism that associates for a specific

interrupt request a service (handler or ISR). It stores the addresses of ISRs

• 256 types of interrupt requests• What we need to obtain an address for ISR

• CS & IP• Many ISRs : k=0 ... 255 (type of interrupts)

• The structure of IVT• Location• Structuring (IP, CS), 256 entries

• The input in the table is the “key k” (interrupt type)• Who delivers the key to the uP? (example of values)

Page 240: uProccessors
Page 241: uProccessors

5) The steps to execute a ISR1) Peripheral device interrupt controller (it

associate a key K to the device); K-progr2) I=1?- uP accepts the interrupt INTA and

asks for the key. The key is transmited to theuP.

3) The uP uses the key K to find out the addressof the ISR (associates an ISR to theperipheral devices)

4) uP execute the ISR and then returns to themain program

Page 242: uProccessors

6) The interrupt controller 8259

Page 243: uProccessors

Inputs on 8259

Explain:

IRQi signals + connection of 2 controllers 8259 in the system

Page 244: uProccessors

7) The sequence for “Interrupt Acknowledge”

= a hardware mechanism to send the “key K” from the interrupt controller 8259 to the uP

• The diagram of signals (if INTR and I=1)1) Save on the stack: PSW, CS, IP, I=0, T=02) It follows the sequence of INTA

• 2 machine cycles• ALE• LOCK• INTA (1st activation, 2nd activation) Key K

3) Point into IVT at address k*4 to get the address of ISR4) Jump to ISR and execute it5) IRET – returns in the main program

Page 245: uProccessors

8) Applications of software interruptsVIDEO SERVICES (INT 10h) – BIOS levelAH =2 (setting the cursor to a specific location)

In: DH = raw, DL=columnExercise: position in the centre of the screen

AH=3 (get current cursor position)Returns in DH=raw, DL=column, CX=the shape of the cursorExercise: Move Relative Nx, Ny

AH=6 (scroll up)In: AL=no of lines for scroll (AL=0, CLS), BH=attribute of blank rawsCH=upper raw, CL=left column, DH=lower raw, DL=right columnExample: Clear Screen

AH= 9 (display a character from AL)AL, BH=video page, BL=atrribute, CX-repExample: Display a string defined in DS, starting in raw 3 column 5

AH=0Eh (display char with increment of cursor)

Page 246: uProccessors

8) Applications of software interrupts

KEYBOARD SERVICES (INT 16h) – BIOS level

AH =1 (test if keypressed)Return Z=0 if Keypressed, Z=1 if not Keypressed

AH=0 (read the character)Returns in AH the scane code and in AL the ASCII code of the Key.

Exercise: Read a string and display it, until ESC is pressed

Page 247: uProccessors

DOS services (INT 21h)

Page 248: uProccessors

INT 21h (cont)

Documentation: INT 1Ah, INT 14h, INT 17h, INT 13h

Page 249: uProccessors

INSTALLING OWN

Interrupt Service Routines

1) Why?

2) How to do?

3) Examples

Page 250: uProccessors

1) Why?

• To change or adapt an existing BIOS service:

– Keyboard: to capture a combination of keys

– Timer: to count real time events related to a specific

process (ADC).

– Mouse related procedures

– Etc? Discussions.

• The install a peripheral-specific procedure:

– ADC or DAC

– Own applications

– Examples?

Page 251: uProccessors

2) How to do?

STEPS:

(the scheme)

1) Write the own ISR

2) Reserve memory in DS for old values from IVT and save

IP and CS of previous routine at these locations (CLI)

3) Upload in IVT the new values for IP and CS of the own

ISR

4) NOW the interrupts may come (STI)

5) ... The program is executed ...

6) CLI and restore the old values of IP and CS into IVT, then

STI.

Page 252: uProccessors

2.1) Write the own ISR

iroutine PROC FAR

...

...

mov al,20h (EOI for 8259)

out 20h, al

iret

iroutine ENDP

Page 253: uProccessors

2.2) Save the old IP and CS from IVT

CS_Old DW ?

IP_Old DW ?

....

....

; save the old IP and CS from IVT

cli

xor ax,ax

mov es,ax

mov di, k*4; k=type of interrupt

mov ax, word ptr es:[di]

mov [CS_Old],ax

add di,2

mov ax, word ptr es:[di]

mov [IP_Old],ax

Page 254: uProccessors

OR 2.2) Save the old IP and CS from IVT

(using INT 21h)CS_Old DW ?

IP_Old DW ?

....

....

; save the old IP and CS from IVT

cli

mov ah,35h

mov al,k

int 21h; in ES the SEGMENT, in BX the OFFSET

mov [CS_Old],es

mov [IP_Old],bx

Page 255: uProccessors

2.3) Install in IVT the new values for IP and CS

mov di,k*4

mov ax, segment iroutine

mov es:[di],ax

add di,2

mov ax, offset iroutine

mov es:[di],ax

STI

Page 256: uProccessors

OR 2.3) Install in IVT the new values for IP

and CS (INT 21h, AH=25h)

mov ah,25h

mov al,k

mov ax,segment iroutine

mov ds,ax

mov bx, offset iroutine

int 21h

STI

Page 257: uProccessors

2.6) Restore the old values of IP and CS

mov ax, [CS_Old]

mov ds,ax

mov bx, [IP_Old]

mov ah,25h

mov al,k

int 21h

Page 258: uProccessors

ELE 3230 - Chapter 5 1

Chapter 58088 Pin Assignment

(*Brey:ch9; Hall:ch7; Triebel:ch7)

ELE 3230Microprocessors and Computer

Systems

Page 259: uProccessors

2

Pin Layout of the 8088Microprocessor

• Nine pins have functions which dependon the state of :

=high - 8088 operates in MINIMUM MODE

=low - 8088 operates in MAXIMUM MODE

• minimum mode: - 8088 directlygenerates the control signals necessaryfor accessing memory and IO ports.

• maximum mode:- external supportchips are needed to generate controlsignals; the processor can work in asystem containing other processors

MXMN/

MXMN/

MXMN/

GND 1A14 2A13 3A12 4A11 5A10 6A9 7A8 8AD7 9AD6 10AD5 11AD4 12AD3 13AD2 14AD1 15AD0 16NMI 17INTR 18CLK 19GND 20

40 Vcc39 A1538 A16/S337 A17/S436 A18/S535 A19/S63433323130292827262524232221

MXMN/ RD

TESTREADYRESET

40 LEAD

8088CPU

SS0 (High)

HOLD )GT0 / RQ(HLDA )GT1 / RQ(WR ) LOCK(

MIO/ )S2(RDT/ ) S1(

DEN ) S0(ALE (QS0)INTA (QS1)

Min Mode (Max Mode)

Page 260: uProccessors

ELE 3230 - Chapter 5 3

Signals Common to Both Minimumand Maximum Modes

Common signalsName Function Type

AD7 – AD0 Address/data bus Bidirectional, 3-state

A15 – A8 Address bus Output,3-state

A19/S6 – A16/S3 Address/status Output,3-state

Minimum/maximumMode control Input

Read control Output,3-state

Wait on test control Input

READY Wait state control InputRESET System reset Input

NMI NomaskableInterrupt request Input

INTR Interrupt request InputCLK System clock InputVCC +5V Input

GND Ground Input

RD

MN/MX

TEST

Page 261: uProccessors

ELE 3230 - Chapter 5 4

Unique Minimum-mode SignalsMinimum mode signals (MN/ = VCC )Name Function Type

HOLD Hold request InputHLDA Hold acknowledge Output

Write control Output,3-state

IO/memory control Output,3-state

Datatransmit/receive

Output,3-state

Data enable Output,3-state

Status line Output,3-state

ALE Address latchenable

Output

Interruptacknowledge

Output

MX

WR

MIO/

RDT/

DEN

SSO

INTA

Page 262: uProccessors

ELE 3230 - Chapter 5 5

Unique Maximum-mode Signals

Maximum mode signals (MN/ = GND)Name Function Type

Request/grant busaccess control

Bidirectional

Bus priority lockcontrol

Output,3-state

Bus cycle status Output,3-state

QS1, QS2 Instruction queuestatus

Output

MX

0 GT1,/RQ

LOCK

S0-S2

Page 263: uProccessors

ELE 3230 - Chapter 5 6

Maximum-Mode of 8088INIT Multibus

S0S1S2LOCK

CLK AEN

CRQLCK

IOB

RESBSYSB/RESB

ANYREQ

8289Busarbiter

AEN IOB

CLK AEN IOBS0S1S2

8288BuscontrollerDEN

DT/RALE

MRDCMWTCAMWCIORCIOWCAIOWCINTAMCE/PDENALE

DENDT/R

A0-A15,A16/S3-A19/S6

D0-D7

RDREADYQS1,QS0

CLKVcc GND

CLK

LOCKS0

S1

S2

Interruptinterface

INTRTEST

NMIRESET

8088MPU

MN/MX

RQ/GT1 RQ/GT0

Local bus control

BUSYCBRQBPROBPRNBREQBCLK

Page 264: uProccessors

ELE 3230 - Chapter 5 7

Maximum-Mode of 8088

❚ 8288 Bus Controller❙ In maximum-mode, the signal to control memory, I/O, and interrupt

interface is produced by 8288.

❙ are no longer produced by8088, instead 8288 generates

INTA and ALE,,DEN ,RDT/ ,MIO/ WR,

INTAAIOWCIOWCIORCAMWCMWTCMRDC -- memory read command

-- memory write command-- advanced memory write command-- I/O read command-- I/O write command-- advanced I/O write command-- interrupt acknowledge command

Page 265: uProccessors

ELE 3230 - Chapter 5 8

Bus Status Codes

Status InputsS1 S0 CPU Cycle 8288 Command

0 0 0 Interrupt Acknowledge INTA0 0 1 Read I/O Port IORC0 1 0 Write I/O Port AIOWC,IOWC0 1 1 Halt None1 0 0 Instruction Fetch MRDC1 0 1 Read Memory MRDC1 1 0 Write Memory AMWCMWTC,1 1 1 Passive None

S2

❚ 8288 produces the commands according to the outputbits from 8088.012 SSS

Page 266: uProccessors

ELE 3230 - Chapter 5 9

Queue Status Codes

QS1 QS0 Queue Status0 (low) 0 No Operation. During the last

clock cycle, nothing was takenfrom the queue.

0 1 First Byte. The byte takenfrom the queue was the firstbyte of the instruction.

1 (high) 0 Queue Empty. The queue hasbeen reinitialized as a result ofthe execution of a transferinstruction.

1 1 Subsequent Byte. The bytetaken from the queue was asubsequent byte of theinstruction.

❚ Two new signals are produced by 8088 in maximum-mode : QS0and QS1. The two-bit code tells the external circuitry what type ofinformation was removed from the queue in the previous cycle.

Page 267: uProccessors

ELE 3230 - Chapter 5 10

Pin Diagram

386DX processor view from pin side Top view for 386SX processor

Page 268: uProccessors

ELE 3230 - Chapter 5 11

8088 Pin FunctionsThe 8088 pins may be grouped into the following nine categories:

1. Power Supply and Clock (VCC, GND and CLK)❚ VCC=5 volts (5 or 10% tolerance)❚ Maximum current needed is 340mA (10 mA for CMOS version)❚ BOTH ground (GND) pins must be connected to 0V.❚ CLK input needs a periodic rectangular waveform with rise and fall times

of less than 10ns. Clock frequency must be between 2 and 5 MHz. (seech06, clock chip 8284).

2. Minimum/Maximum Mode pin❚ Minimum mode selected when is connected to +5V)MX(MN/

Page 269: uProccessors

ELE 3230 - Chapter 5 12

3. Status Pins - in maximum mode onlyThe status pins are outputs which are used by the 8288 bus controller to generatecontrol signals according to the following table:

8088 Pin Functions

S2 S1 S0 Meaning0 0 0 Interrupt acknowledge (INTA)0 0 1 I/O read0 1 0 I/O write0 1 1 HALT1 0 0 Code access (fetching instruction)1 0 1 Memory read1 1 0 Memory write1 1 1 Passive state (not used)

( , )S0 S1, and S2

Page 270: uProccessors

ELE 3230 - Chapter 5 13

8088 Pin Functions

4. Bus Master Control of the local bus is transferred to other devices with aid of the

following signals: Minimum Mode - HOLD and HLDA (hold acknowledge) Maximum Mode - request/grant❚ HOLD is an input (in minimum mode only) which tells the processor to

suspend operations and allow other devices to access the system bus.Program execution only resumes when HOLD=0.

❚ HLDA (hold acknowledge) is an output which informs other devices in thesystem that the 8088 is in a HOLD state. When another device wants toaccess the bus, it waits for HLDA=1.

(HOLD, HLDA, RQ/GT0, RQ/GT1 and LOCK)

LOCK and )GT1/RQ ,GT0/RQ(

Page 271: uProccessors

ELE 3230 - Chapter 5 14

8088 Pin Functions

4. Bus Master (cont.)❚ Request and Grant pins are used only in maximum

mode and function both as inputs (to accept requests) and outputs (togrant requests). When another device wants to become the BUSMASTER (i.e. take control of the local bus) it issues a request by pullingone of the request pins to a low logic state for one clock cycle. After arequest is received, the 8088 enters a HOLD state and sends a grantsignal on the same pin.

❚ is an output pin in maximum mode and informs other devices thatthey cannot takeover the local bus

)GT1/RQ and GT0/RQ(

.GT1/RQ overpriority higher a has GT0/RQ

LOCK

(HOLD, HLDA, RQ/GT0, RQ/GT1 and LOCK)

Page 272: uProccessors

ELE 3230 - Chapter 5 15

8088 Pin Functions

5. Interrupt pins (NMI, INTR and INTA)Interrupt acknowledge pin is available only in minimum mode. NMI(non-maskable interrupt) and INTR (interrupt request) are present in bothmodes.

❚ The NMI (non-maskable interrupt) is an input which accepts a rising edgeto trigger the interrupt. It cannot be disabled by software. Interrupt number2 is generated by an NMI.

❚ INTR is an input which accepts a high logic level as an interrupt request.Provided the interrupt flag in the FLAGS register is enabled, the processorwill respond to the interrupt request in the same way as it processes ansoftware INT instruction.

❚ acknowledges an interrupt request and indicates to the interruptingdevice that it should place an 8-bit interrupt number on the data bus

)INTA(

INTA

Page 273: uProccessors

ELE 3230 - Chapter 5 16

8088 Pin Functions

6. RESET is an input which resets and initializes the processor. After aRESET the processor reads memory location FFFF0h for an instruction.

7. Bus control pinsA group of 7 pins generate the control signals for data transfer to and fromthe data and address bus in minimum mode. In maximum mode only two(RD and READY) of these 7 functions are available directly (the other busprotocol signals are generated from the status pins).The seven pins in this group include:

❚ READY - an input to tell the processor that the selected memory or I/Oport is ready to complete a read or write operation. If READY is notasserted, wait states are added (eg. For slow memory).

Page 274: uProccessors

ELE 3230 - Chapter 5 17

8088 Pin Functions

7. Bus control pins (cont.)❚ (read) - an output indicating when the processor is performing read

operation from memory or an I/O port.❚ ALE (addressing latch enable) - an output to demultiplex the address/data

pins. When ALE is high, address information is being sent.❚ (data enable) - an output used with an external tristate buffer to disconnect

the processor data pins from the data bus. (When is low the processordata pins should be connected to the data bus)

❚ (data transmit/receive) - an output indicates direction of data flow❚ (write) - an output to indicate when the processor is putting data into

memory or I/O port❚ - an output indicates whether access is to memory or I/O ports❚ The logic is different between 8086 & 8088.

RD

DENDEN

DT/RWR

IO/M

Page 275: uProccessors

ELE 3230 - Chapter 5 18

8088 Pin Functions

8. Address, data pins and address status pins

❚ AD0-AD7 (address/data bus pins) - these pins output both address and datainformation and input data at different times of the bus cycle. Usually anexternal latch stores the address information form these pins before the pinsare switched to carry data. Both the low and high order bytes of a 16-bit dataword must be transferred via these pins.

❚ A8-A15 (address bus pins) - used solely for specifying the address of amemory location or IO port.

❚ A16/S3-A19/S6 (address bus or status pins) - these either carry memoryaddressing information or status information. S6 is always at logic 0. S5describes the state of the interrupt flag in the FLAGS register. S4 and S3describe the segment register being used to generate the physical addressthat was output on the address during the current bus cycle.

Page 276: uProccessors

ELE 3230 - Chapter 5 19

8088 Pin Functions

❚ The address pins A0-A15 specify either a 16-bit I/O port number or thefirst 16 bits of a 20-bit address of a memory location.

9. Coprocessor interaction pinsThree pins are used for interactions between the8088 and 8087 arithmetic co-processor to synchronize MPU withexternal hardware.

S4 S3 Segment register0 0 ES0 1 SS1 0 CS or no segment1 1 DS

8. Address, data pins and address status pins (cont.)

(TEST, QS0 and QS1)

Page 277: uProccessors

ELE 3230 - Chapter 5 20

8088 Pin Functions9. Coprocessor interaction pins (cont.)❚ is an input pin that is tested by the WAIT instruction. If is low the

WAIT instruction functions as a NOP. If is at logic 1 then the WAITinstruction waits until it goes to logic 0 (MPU enters “idel state”). The pinis often connected directly to a 8087 coprocessor (it must be connect to logic 0if the 8087 is not present)

❚ QS0 and QS1 (queue status) pins provide information on the 8088 internalinstruction queue. The information is used by the 8087 coprocessor. Thequeue status bits indicate the contents of the internal instruction queueaccording to the following table:

QS1 QS0 instruction queue contents0 0 No operation (queue is idle)0 1 First byte of an opcode1 0 Queue is empty1 1 Subsequent byte of an opcode

TEST TESTTEST

TEST

Page 278: uProccessors

ELE 3230 - Chapter 5 21

DC characteristics of Pin❚ It is important to know the input and output characteristics

which are required for hardware designer to select propercomponents.

❚ Input characteristics: Output characteristics:Logic Level Voltage Current

0 0.8 V max 10µA max

1 2.0 V min 10µA max

Logic Level Voltage Current

0 0.45 V max 2.0mA max

1 2.4 V min -400µA max

Logic 1

Logic 0

UndeterminedRange

Logic 1

Logic 0

DisallowedRange

Output voltagerangeInput voltage

range

VOH(min)

VOL(max)VIL(max)

VIH(min)

Page 279: uProccessors

ELE 3230 - Chapter 5 22

DC characteristics of Pin❚ Noise immunity :

VNL [Low-level (Logic 0) noise immunity] = Vin_low (max)- Vout_low(max)VNH [High-level (Logic 1) noise immunity] = Vout_high(min)-Vin_high(min)

❚ For 8088, VNL is 350mV (=0.8V-0.45V). Typical logic circuit has noiseimmunity 400mV (=0.8V-0.4V).

❚ Smaller noise immunity means 8088 and 8086 would encounter problemwith longer wire or larger load.! recommendation : no more than 10 loads

❚ recommended fan out: Family Fanout Sink Current Source Current

TTL (74XX) 1 -1.6 mA 40 µA TTL (74LSXX) 5 -0.4 mA 20 µA TTL (74SXX) 1 -2.0 mA 50 µATTL (74ALSXX) 10 -0.2 mA 20 µACMOS (74HCXX) 10 -1.0 µA 1.0 µACMOS (CD4XXX) 10 -1.0 µA 1.0 µA

NMOS 10 -10 µA 10 µA

Page 280: uProccessors

ELE 3230 - Chapter 5 23

FAQ❚ What are sink and source current, and the sign of the current?

❙ The component source current is the current that it will outputto the next stage device when the component's output pin is high.

❙ The component sink current is the current that it will take in from itsoutput pin when its output is at its logic low state.

❙ The minus sign for sink current is to denote that the current is flowingback the component.

❚ Noise immunity❙ The noise immunity for logic low and high are defined in pp22 of ch05. Pls use these definitions for

the noise immunity.

Please note that noise immunity is the difference between the INPUT and OUTPUT, not differencebetween logic 0 and logic 1. The old slide that I showed in the class is not correct. Let's use thedefinition in your lecture note.

Page 281: uProccessors

ELE 3230 - Chapter 5 24

FAQ❚ Why uses the difference between input and output for noise immunity calculation?

❙ Let's take a look at the noise immunity for logic 0.If you look the figure in pp21, the output disallow range is bigger than theundetermined range for the input, and V_IL (max)> V_OL(max).

So if the output of logic 0 from a chip is corrupted with noise dN, the aggregated signalinto the other chip will has a max. value of V_OL(max)+dN.This value should be less than V_IL so that the total amplitude will not fall in theundetermined range. So noise immunity for logic 0 is defined asV_IL(max)-V_OL(max).

By the same token, the noise immunity for logic 1 can be defined.

Page 282: uProccessors

ELE 3230 - Chapter 6 1

Chapter 68284 Clock Generator

Bus DemuxBus Cycle

(Brey's ch8; Hall's ch7)

ELE 3230Microprocessors and Computer

Systems

Page 283: uProccessors

ELE 3230 - Chapter 6 2

8284 Clock Generator

❚ 8284 is an integrated circuit which generates the CLOCK,READY and RESET signals needed in the 8088.

❚ Internally the 8284 consists of an oscillator circuit (whichneeds an external crystal oscillator), dividers, flip-flops,buffers and logic gates. The external crystal frequency isdivided by 3 to produce the basic clock frequency as shownbelow:

200 ns Min 500 ns Max

6+ 53.9

1.5.60

-.5

10 ns Max 10 ns Max

118.33 nsMin

68.66 nsMin

Page 284: uProccessors

ELE 3230 - Chapter 6 3

8284 Clock Generator

Internal Block Diagram of the 8284 clock generator

EFI

D

CKQ RESET

RES

÷3

SYNC

÷2

SYNCPCLK

F/C

RDY1

AEN1

RDY2

AEN2

READY

CK

D Q

FF2

CK

D Q

FF1

ASYNC

CRYSTALOSCILLATOR

OSC

X1

X2

CLK

CSYNC

Page 285: uProccessors

ELE 3230 - Chapter 6 4

8284 Clock Generator

CSYNC 1 PCLK 2

3 RDY1 4READY 5 RDY2 6 7 CLK 8 GND 9

18 Vcc17 X116 X21514 EFI1312 OSC1110 RESET

8284A

CF/

ASYNC

RES

AEN1

AEN2

Page 286: uProccessors

ELE 3230 - Chapter 6 5

8284 Output Pins❚ PCLK - peripheral clock outputs clock signal which is at half the

frequency of the main CLK output.

❚ CLK - clock outputs a 33% duty cycle periodic clock which runs atone third the frequency as the EFI or crystal frequency.

❚ OSC - oscillator output provides a buffered periodic waveformrunning at the crystal frequency. Output is suitable for driving theEFI input of another 8284.

❚ RESET - generates an output suitable for the reset input of the 8088.

❚ READY - generates READY signal suitable for 8088 READY input.

Page 287: uProccessors

ELE 3230 - Chapter 6 6

Relation between CLK and PCLK

OSC

CLK

PCLK

Page 288: uProccessors

ELE 3230 - Chapter 6 7

8284 Input Pins❚ VCC, GND - power supply pins

❚ RDY1 and RDY2 - bus ready accepts input of the bus ready signal

❚ AEN1, AEN2 - address enable (qualifies RDY1 and RDY2)

❚ - ready synchronization select (selects one or two stages of synchronization for the RDY1 and RDY2 inputs

❚ X1, X2 - crystal inputs (for connection of external clock signal input)

❚ EFI - external frequency input (external clock signal input)

❚ CSYNC - clock synchronization used with the EFI to synchronize the clock output in multiprocessor systems. MUST BE GROUNDED if the crystal oscillator is used.

❚ - frequency/crystal (selects crystal oscillator or EFI as source)

❚ - reset input (accept input from a switch for generating reset)

ASYNC

F/C

RES

Page 289: uProccessors

ELE 3230 - Chapter 6 8

Example - A simple 8284 circuit

• If WAIT states for slow memory or IO peripherals are needed, the circuit must bemodified.

• The 8284 can be used simply to generated the CLOCK signal as shown below:5V

5V

5V

RDY1 RDY2EFIF/CCSYNCAEN1AEN2

ASYNC

X1

X2 RES

RESET

READY

CLK

8284

RESET

READY

CLK

8088

Reset Switch 100nF

4.7K

4.7K

4.7K

510

510 15MHz

Page 290: uProccessors

9

Minimum Mode System BlockDiagram Vcc

Vcc

GND

GND

Address /data Address

Data

IR0-7

CLK MXMN/READY MIO/RESET RD

WR 8088 INTA CPU

RDT/ DEN ALE

A8-A19INTR

T

OE 8286 Transceiver

EN

8259A Interrupt controller

INT

STBOE

8282 Latch (1, 2 or 3)

WEOE

2142 RAM (2)

OE

27162 PROM

CS WR RD

Peripheral

8284ARES clock generator

AD0-AD7

Page 291: uProccessors

ELE 3230 - Chapter 6 10

Demultiplexing the Address andData Bus

❚ Address and data bus are multiplexed in 8086 (AD0-AD15) and 8088(AD0-AD7) to reduce the number of pinsrequired.

❚ Address and Data need to be demultiplexed from thebus. (Why not leave it multiplexed?)

❚ How to maintain a stable address throughout a read orwrite cycle?

Page 292: uProccessors

ELE 3230 - Chapter 6 11

Demultiplexing the Address andData Bus on 8088

• Two transparent latches (74LS373) are used for demultiplexed.

• ALE indicates when address information is on AD0-AD7. In maximum mode, ALE isgenerated by the bus controller.

Minimum modeaddress/datademultiplexing

G ‘373 OE

8088

A19/S6A18/S5A17/S4A16/S3

A15A14A13A12A11A10A9A8

ALE

MN/MX

+5V

RD

AD0

AD7AD6AD5AD4AD3AD2AD1

IO/M

WR

A13

A3

A19A18A17A16A15A14

A12A11A10A9

A6

A8A7

A5A4

A2A1A0

Address bus

D7D6D5D4D3D2D1D0

WRRDIO/M

Data bus

Control bus

OE‘373

G

Page 293: uProccessors

ELE 3230 - Chapter 6 12

Latches

❚ The address and data bus of the 8088 are multiplexed on pinsAD0 to AD7. Address information are contained on AD0-AD7only when ALE (address latch enable) is asserted.

❚ External Latches are needed to store (“latch”) the addressinginformation before AD0-AD7 change to carrying data. A latchsimply consists of a D-type flip-flop with additional logic toselect when to read and output data.

Page 294: uProccessors

ELE 3230 - Chapter 6 13

Latches and flip-flops

D CK Q QX 0 N

Q NQ0 1 0 11 1 1 0

S R D CK Q Q1 1 1 ↑ 1 01 1 0 ↑ 0 11 1 X 0 N

Q NQ1 1 X 1 N

Q NQ0 1 X X 1 01 0 X X 0 10 0 X X • •

D latch

D flip-flop

D Q

CK

Q

Q

Q

S

D

CK

R

Page 295: uProccessors

ELE 3230 - Chapter 6 14

Latches(cont.)

❚ Integrated circuits containing many latches (one latch isneeded per bit) are available to perform the latching functionof an address line e.g. 8282, 74LS373.

❚ These packages typically have a single input, called “strobe”(STB), “latch enable” (LE) or “Gate” (G), which qualifies thedata (i.e. passes the data to the flip-flops only when it thestrobe or gate input is high).

❚ Some latches also have an “output enable” (OE) input whichqualifies the output data (when OE is low, the outputs areopen circuit).

Page 296: uProccessors

ELE 3230 - Chapter 6 15

8088 Fan-out and Buffers

❚ In order to drive the system buses, which typically have manydevices attached and with large capacitance, the addressand data output pins must be buffered.

❚ A buffer merely amplifies the output current.❚ Demultiplexed pins are already buffered by latches (e.g.

74LS373).❚ Un-multiplexed address pins can be buffered by 74LS245

octal bi-directional buffer and 74LS244 uni-directional buffer.

Page 297: uProccessors

16

Example: 8088 Fully Buffered Buses

A13

A3

• signals are available from the 8088 in minimum modemode only. They must be derived from the bus controller when the 8088operates in maximum mode.

DT/R, DEN and ALE

Example of busbuffering in 8088(minimum modesystem)

OE

‘373G

A19A18A17A16A15A14

A12A11A10A9

A6

A8A7

A5A4

A2A1A0

BufferedAddress bus

G ‘373 OE

WRRDIO/M Buffered

Control bus‘244

D7D6D5D4D3D2D1D0

BufferedData bus

A7A6A5A4A3A2A1A0

B7B6B5B4B3B2B1B0

8088 A19/S6A18/S5A17/S4A16/S3

A15A14A13A12A11A10A9A8

ALE

AD4

AD0

AD7AD6AD5

AD3AD2AD1

RDIO/M

WR

DT/R DEN G DIR

‘244

OE

OE

Page 298: uProccessors

17

Bidirectional Buffers

❚ Information is transferred in both directions on the data bus - hence the databus buffer must be bidirectional.

❚ A bidirectional buffer has a “direction” (DIR) input which indicates the directionof data transfer. The direction input to the buffer can be taken from the(data transmit/receive) output of the 8088 (minimum mode system) or buscontroller (maximum mode 8088 system).

❚ Examples of bidirectional buffers include the 74LS245 and 8286.

RDT/

DIREN

Outputs/inputsInputs/outputs

Page 299: uProccessors

ELE 3230 - Chapter 6 18

8088 Fan-out and Buffers

❚ The output pins of the 8088 have a limited fan out (the output current canonly drive a finite number of derives and large capacitive loading on theoutput will cause problems with dynamic signals

Logic family Sink current(mA)

Source Current(µA)

fanout from8088

TTL (74XX) -1.6 40 1TTL (74LSXX) -0.4 20 5TTL (74SXX) -2 50 1TTL (74ALSXX) -0.2 20 10CMOS (74HCXX) -0.001 1 10CMOS (CD4XXX) -0.001 1 10NMOS -0.01 10 10

Recommended 8088 Fan-out

Q: Pros and cons of buffer?

Page 300: uProccessors

19

Example of Basic 8086 System Timing

MEMORY ACCESS TIME

T1 T2 T3 TWAIT T4 T1 T2 T3 TWAIT T4

(4+NWAIT)=TCY (4+NWAIT)=TCY

CLK

ALE

M/IO

S7-S3A19-A16BHE

A19-A16BHE S7-S3ADDR/STATUS

WAIT

READY

WAIT

READY

READY

BUS RESERVERED

FOR DATA INA15-A0 D15-D0

VALID A15-A0 DATA OUT D15-D0

RD

ADDR/DATA

DT/R

DEN

WR

Page 301: uProccessors

ELE 3230 - Chapter 6 20

Bus Timing of the 8088

❚ Access to memory and I/O operates in bus-cycles. Bus cycles are periodsof time equal to four system clocking periods (1 clock period is oftencalled a T state). For instance, if the 8088 operates at 5MHz, the buscycle rate (which is maximum rate of data transfer) is at 5/4 MHz.

Example of BUS READ CYCLE

❚ The basic steps of the read cycle (simplified) are:

1. Put memory address on the address bus (T1)

2. Issue a read memory signal (T2-T3)

3. Read the data from the data bus (T3)

)RD(

Page 302: uProccessors

ELE 3230 - Chapter 6 21

Bus Timing of the 8088 READ CycleExample - 8088/8086 Read bus cycle (simplified)

VALID ADDRESS

ONE BUS CYCLE

T1 T2 T3 T4

ADDRESS DATA FROM MEMORY

CLK

ADDRESS

ADDRESS/DATA

RD

Page 303: uProccessors

ELE 3230 - Chapter 6 22

Bus Timing Diagrams (General)

❚ To transfer data without error on the system bus, the signals in the busmust change and hold the values within a certain period of time in a buscycle.

❚ Physically, a system bus consists of conducting wires or tracks on circuitboard. These have distributed inductance and capacitance which tend todistort the signal waveforms.

❚ Long system buses can have clock skew (there is a delay in signalsreceived by distant peripherals - and their clock is slightly out of phasewith the clock received by the microprocessor).

❚ The rise-time, fall-time, and duration of signals must be within thespecifications of the device or microprocessor - otherwise errors will occurin transferring data. The manufacturer’s data sheet contain importantinformation on the timing requirements which can be quite demanding.

Page 304: uProccessors

ELE 3230 - Chapter 6 23

Bus Cycle Operation

❚ T1 - start of bus cycle. Actions include setting control signals (or S0-S2status lines) to give the required values for ALE, and , and putting a valid address onto the address bus.

RDT/ IO/M

❚ T2 - the or control signals are issued, is asserted and in the case of a write, data is put onto the data bus. The turns on the data bus buffers to connect the cpu to the external data bus. The READY input to the cpu is sampled at the end of T2 andif READY is low, a wait state TW (one or more) is inserted before T3begins.

WRRD DENDEN

Page 305: uProccessors

ELE 3230 - Chapter 6 24

Bus Cycle Operation

❚ T3 - this clock period is provided to allow memory to access the data. Ifthe bus cycle is a read cycle, the data bus is sampled at the end ofT3.

❚ T4 - all bus signals are deactivated in preparation for the next clock cycle. The 8088 also finishes sampling the data (in a read cycle) inthis period. For the write cycle, the trailing edge of the signal transfers data to the memory or I/O, which activates and write when returns to logic 1 level.

WR

WR

Page 306: uProccessors

ELE 3230 - Chapter 6 25

Read Cycle Timing

❚ The most important information contained in the read timing diagram is theamount of the time allowed for getting data from memory.

❚ Memory chips usually have a specified memory access time.❚ The memory access time is defined as the interval from when a valid

address is put on the address bus (near the start of T1) to the time when thedata is read (near the end of T3). The permitted memory access time istherefore less than three T states if no wait states are added.

❚ To find the exact access time permitted by the read timing diagram:1. Find the maximum interval necessary for a valid address to appear after the

start of T1. This interval is given the symbol TCLAV (clock-to-address valid)the microprocessor data sheet (For a 5MHz 8088, TCLAV=110ns)

Page 307: uProccessors

ELE 3230 - Chapter 6 26

Read Cycle Timing (cont.)

2. Valid data must appear on the data bus before the end of T3 in order toallow the data to be read. The minimum time interval before the end of T3for valid data to appear is given the symbol TDVCL (data valid-to clock)and is specified as 30ns for the 5MHz 8088.

3. The maximum memory access time=3T-TCLAV-TDVCL which, for the5MHz 8088, is 600-110-30=460ns. Actually the memory access time mustbe less than this since there will be propagation delays in going throughbuffers (about another 40ns).

Page 308: uProccessors

Read Cycle Timing Information fromData Sheet

Page 309: uProccessors

ELE 3230 - Chapter 6 28

Bus Timing of 8088 Write Bus Cycle

VALID ADDRESS

ONE BUS CYCLE

T1 T2 T3 T4

ADDRESS DATA WRITE TO MEMORY

CLK

ADDRESS

ADDRESS/DATA

WR

Page 310: uProccessors

ELE 3230 - Chapter 6 29

❚ Write bus cycle (simplified) consists of :1. Put memory address on the address bus (T1)2. Issue a write to memory signal (T2-T3)3. Send data to data bus (T2-T3) and write to memory

❚ Actual (non-simplified) read and write bus cycle include changes on othersignals such as M/IO, ALE, DEN, DT/R and READY. The actual cycleswill be investigated in detail later.

❚ T4 in the bus cycle is used to deactivate all the signals in preparation forthe next bus cycle (it is also the time when the 8088 samples the READYsignal to see if extra wait states are needed)

Example - 8088/8086 Write BusCycle (simplified)

)(WR

Page 311: uProccessors

ELE 3230 - Chapter 6 30

Write Cycle Timing❚ Write cycle is very similar to the read cycle. Main differences are

1. Strobe is replaced by 2. Data bus contains data for memory rather than data from memory 3. =1instead of =0

❚ The most critical of the write timing diagram is the time interval betweenthe point when becomes logic 1 and the time when data are removedfrom the data bus, since data are only written after the trailing edge of thestrobe. This critical time interval is given the label TWHDX and isspecified as 88ns for 5MHz 8088.

RD WR

RDT/ RDT/

WR

Page 312: uProccessors

ELE 3230 - Chapter 6 31

Write Cycle Timing

TW

TCLAX

T1 T2 T3 T4

VCH

VCL

CLK(8284 Output)

AD7-AD0

DEN

WR

WRITE CYCLENOTE 1

TCH1CH2 TCL2CL1

TCLAVTCLDV TCHDX

TCVCTV AD0TCVCTV

TCVCTV

TWLWH

TCVCTX

TWHDX

AD7-AD0 DATA OUT

Page 313: uProccessors

ELE 3230 - Chapter 6 32

READY and the WAIT state❚ If the access time for a memory device is longer than the memory

access time calculated, need to give extra clock periods, wait stateTw, for memory.

❚ The READY input is sampled at the end of T2 and again, if applicable,in the middle of Tw. If READY is a logic 0 on 1-to-0 clock transition,then Tw is inserted between T2 and T3. And will check for logic 1 on0-to-1 clock transition in the middle of Tw to see if it shall go back T3.

❚ During the wait state, signals on the buses remain the same as theywere at the start of the WAIT state.

❚ By having the WAIT state, slow memory and devices has at least onemore cycle (200ns for 5 MHz 8088) to get its data output.

❚ The READY signal is synchronized by the clock generator 8284A.

Page 314: uProccessors

ELE 3230 - Chapter 6 33

READY and RDY input timing

CLK

READY

T2 TW T3

8ns 30ns

CLK

RDY

T2 TW T3

35ns0ns

(b) 8284 RDY Input Timing

(a) 8088/86 READY Input Timing

Page 315: uProccessors

ELE 3230 - Chapter 6 34

Maximum Mode Bus Buffering andDemultiplexing

❚ 8288 bus controller generates control signals needed by interrupt controllersand peripheral devices (memory)

8284A

RDY

CLK READY RESET

8088

AD0-AD7 A8-A19

CLK

8288

STB LS373

DIR

LS245

WAIT STATEGENERATOR

RES

GND0S1S2S

0S1S2S

DEN

ALEDT/R

E

GND

Vcc

ADDR

DATA

Page 316: uProccessors

ELE 3230 - Chapter 6 35

Vcc

NC

GND

GND

Address/data Address

Data

IR0-7

MXMN/ 0S 1SCLK 2SREADYRESET

8088MPU

70 ADAD − 198 AA −

INTR

T

OE 8286

Transceiver

EN

8259A Interrupt controller

INT

STB

OE

8282 Latch (1, 2 or 3)

WEOE

2142 RAM (2)

OE

27162 PROM

CS WR RD

Peripheral

8284ARES clock

generator

CLK MRDC

0S MWTC

1S AMWC2S IORC

DEN IOWCRDT/ IOWCA

ALE INTA

Maximum Mode System BlockDiagram

GND

NC

8288Bus Ctrl

Page 317: uProccessors

ELE 3230 - Chapter 6 36

8088/8086 (maximum mode)Read Bus Cycle (detailed)

Bus master (8088) actions Slave (memory) ActionsS0-S2 changed for ALEOutput A0-A19 (ALE asserted) Decode address, negate RDY =0, change to DEN Put data on data busWait until READY asserted Assert RDYRead data from data busset to 111

RDT/

S2-S0

S2-S0

One bus cycle

CLK

S2 S0* S2 S0- S2 S0- InactiveAddress/dataand BHE/S7

BHE, A19-A16S7 - S3 Float

Address/data(AD15-AD0) A15 - A0

Data in D15 - D0*ALE

*MRDC or IORC

*DT/R

*DEN

T1 T4T3T2

Page 318: uProccessors

ELE 3230 - Chapter 6 37

8088/8086 (maximum mode)Write Bus Cycle (detailed)

Bus master (8088) actions Slave (memory) ActionsS0-S2 changed for ALEOutput A0-A19 (ALE asserted) Decode address, negate RDY =1, change to DENOutput data onto data busWait until READY asserted Store dataread data, set to 111 Assert RDY

RDT/ S2-S0

S2-S0

Address/data(AD15-AD0)

T1 T4T3T2One bus cycle

CLK

S2 S0* S2 S0* S2 S0* InactiveAddress/dataand BHE/S7

BHE, A19-A16S7 - S3 Float

*ALE

*AMWC or AIOWC

A15 - A0 Data in D15 - D0

*MWTC or IOWC*DEN

Page 319: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 1

Pin Diagram of 8085

20

19181716

1514

13

1211

1

2345678

910

21

2223

242526272829

30

403938373635343332

31

8085 A

VSS

AD7

AD6

AD5

X1X2

OUTSODSIDTRAPRST 7.5RST 6.5RST 5.5INTR_____

INTAAD0

AD1

AD2

AD3

AD4

RESET

A8

VccHOLDHLDACLK ( OUT) _________________

RESET IN

S1___

RD

ALES0

READY __

IO / M

___

WR

A9

A10

A11

A15

A14

A13

A12

Serial i/p, o/p signals

DMA

Page 320: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 2

Signal Groups of 8085

Multiplexed address / data bus

GND

VssVcc

+ 5 V

X1 X2

XTAL

4

5

SOD

SID

RESET OUT CLK OUT

____

WR

____

RD

___

IO / M

S0

S1

ALE

A8

A15High order Address bus

AD0

AD7

HLDA______

INTA

READYHOLD ______________

RESET IN

INTRRESET 5.5RESET 6.5RESET 7.5

TRAP

Page 321: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 3

GND

+5V

X1

X2

TIMING AND CONTROLCLK

GEN

CLK OUT READY

CONTROL

RD

ALE

S0 S1 RESET OUT

IO / M HOLD HLDA

DMASTATUS

RESET IN

ARITHEMETIC LOGIC UNIT ( ALU)

(8)

ACCUMULATOR TEMP REG(8)

(8)

FLAG ( 5)

FLIP FLOPS

INTERRUPT CONTROL SERIAL I / O CONTROL

SID SIOTRAP

INTR

INTA RES

5 . 5

RES

6 . 5

RES

7 . 5

8 BIT INTERNAL DATA BUS

INSTRUCTION REGISTER ( 8 )

MULTIPLXER

R

E

G.

S

E

L

E

C

T

ADDRESS BUFFER ( 8 )

DATA / ADDRESS BUFFER ( 8 )

INSTRUCTION DECODER AND MACHINE ENCODING

W ( 8 )

TEMP . REG.B REG ( 8 )

D REG ( 8 )H REG ( 8 )

STACK POINTERPROGRAM COUNTER ( 16 )INCREAMENT / DECREAMENT

ADDRESS LATCH ( 16 )

( 16 )

AD7 – AD0 ADDRESS / BUFFER BUS

A 15 – A8 ADDRESS BUS

C REG ( 8 )

E REG ( 8 )L REG ( 8 )

WR

Page 322: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 4

CYPACS Z

D0D1D2D3D4D5D6D7

Flag Registers

General Purpose RegistersINDIVIDUAL

COMBININATON

B, C, D, E, H, L

B & C, D & E, H & L

Page 323: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 5

AH AL

BH BL

CH CL

DH DL

SP

BP

SI

DI

ES

CS

SS

DS

IP

1

∑ADDRESS BUS

( 20 ) BITS

DATA BUS

( 16 ) BITS

BUS

CONTROL LOGIC

8

0

8

6

BUS

2 3 4 65

INSTRUCTION QUEUE

8 BIT

Q BUS

EU CONTROL SYSTEM

ALU DATA BUS

16 BITS

TEMPORARY REGISTERS

ALU

FLAGS

GENERAL REGISTERS

EXECUTION UNIT ( EU )

BUS INTERFACE UNIT ( BIU)

Fig:

Page 324: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 6

20

19181716

1514

13

1211

1

2345678

910

21

2223

242526272829

30

403938373635343332

31

8086

CPU

GND

CLK

INTR

NMI

GNDAD14

AD13

AD12

AD11

AD10

AD9AD8AD7

AD6

AD5

AD4

AD3

AD2

AD1

AD0

RESET

VCC

AD15

A16 / S3

A17 / S4

____

MN/MX___

RD

_______

LOCK

A19/S6

___

(WR)

READY

______

TEST

QS1

____

S2___

S1 _____

(DEN)(ALE)

A18 / S5

_____

BHE / S7

_____ _____

RQ / GT0 ( HOLD)___ _____

RQ / GT1 ( HLDA)____

(M / IO )___

(DT / R)___

S0 QS0 ________

(INTA)

Pin Diagram of 8086

Page 325: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 7

CLK

GNDVCC

8086

MPU

INTR_____

INTA

______

TEST

NMI

RESET

HOLD

HLDA

VCC

____

MN / MX

INTERRUPT

INTERFACE

DMA

INTERFACE

MODE SELECT READY

_____

DEN

_____

WR

____

RD

__

DT / R

__

M / IO

ALE___

BHE / S7

MEMORY I / O

CONTROLS

D0 - D15

A0 - A15, A16 / S3 – A19/S6

ADDRESS / DATA BUS

Page 326: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 8

Signal Description of 8086

• The Microprocessor 8086 is a 16-bit CPU available in different clock rates and packaged in a 40 pin CERDIP or plastic package.

• The 8086 operates in single processor or multiprocessor configuration to achieve high performance. The pins serve a particular function in minimum mode (single processor mode ) and other function in maximum mode configuration (multiprocessor mode ).

• The 8086 signals can be categorised in three groups. The first are the signal having common functions in minimum as well as maximum mode.

Page 327: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 9

• The second are the signals which have special functions for minimum mode and third are the signals having special functions for maximum mode.

• The following signal descriptions are common for both modes.• AD15-AD0 : These are the time multiplexed memory I/O

address and data lines.• Address remains on the lines during T1 state, while the data is

available on the data bus during T2, T3, Tw and T4.• These lines are active high and float to a tristate during

interrupt acknowledge and local bus hold acknowledge cycles.

Signal Description of 8086 (cont..)

Page 328: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 10

• A19/S6,A18/S5,A17/S4,A16/S3 : These are the time multiplexed address and status lines.

• During T1 these are the most significant address lines for memory operations.

• During I/O operations, these lines are low. During memory or I/O operations, status information is available on those lines for T2,T3,Tw and T4.

• The status of the interrupt enable flag bit is updated at the beginning of each clock cycle.

Signal Description of 8086 (cont..)

Page 329: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 11

• The S4 and S3 combinedly indicate which segment register is presently being used for memory accesses as in below fig.

• These lines float to tri-state off during the local bus hold acknowledge. The status line S6 is always low .

• The address bit are separated from the status bit using latches controlled by the ALE signal.

Alternate DataStack

Code or noneData

Indication S4 S3

0011

0

01

1

Signal Description of 8086 (cont..)

Page 330: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 12

• BHE/S7 : The bus high enable is used to indicate the transfer of data over the higher order ( D15-D8 ) data bus as shown in table. It goes low for the data transfer over D15-D8 and is used to derive chip selects of odd address memory bank or peripherals. BHE is low during T1 for read, write and interrupt acknowledge cycles, whenever a byte is to be transferred on higher byte of data bus. The status information is available during T2, T3 and T4. The signal is active low and tristated during hold. It is low during T1 for the first pulse of the interrupt acknowledge cycle.

Upper byte from or to odd addressWhole word0

01

0

01

Lower byte from or to even addressUpper byte from or to even address

None

Indication BHE A0

1 1

Signal Description of 8086 (cont..)

Page 331: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 13

• RD – Read : This signal on low indicates the peripheral that the processor is performing s memory or I/O read operation. RD is active low and shows the state for T2, T3, Tw of any read cycle. The signal remains tristated during the hold acknowledge.

• READY : This is the acknowledgement from the slow device or memory that they have completed the data transfer. The signal made available by the devices is synchronized by the 8284A clock generator to provide ready input to the 8086. the signal is active high.

Signal Description of 8086 (cont..)

Page 332: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 14

• INTR-Interrupt Request : This is a triggered input. This is sampled during the last clock cycles of each instruction to determine the availability of the request. If any interrupt request is pending, the processor enters the interrupt acknowledge cycle.

• This can be internally masked by resulting the interrupt enable flag. This signal is active high and internally synchronized.

• TEST : This input is examined by a ‘WAIT’ instruction. If the TEST pin goes low, execution will continue, else the processor remains in an idle state. The input is synchronized internally during each clock cycle on leading edge of clock.

Signal Description of 8086 (cont..)

Page 333: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 15

• NMI- Nonmaskable interrupt : This is an edge triggered input which causes a Type 2 interrupt. The NMI is not maskable internally by software. A transition from low to high initiates the interrupt response at the end of the current instruction. This input is internally synchronized.

• RESET : This input causes the processor to terminate the current activity and start execution from FFF0H. The signal is active high and must be active for at least four clock cycles. It restarts execution when the RESET returns low. RESET is also internally synchronized.

• Vcc +5V power supply for the operation of the internal circuit.• GND ground for internal circuit.

Signal Description of 8086 (cont..)

Page 334: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 16

• CLK- Clock Input : The clock input provides the basic timing for processor operation and bus control activity. Its an asymmetric square wave with 33% duty cycle.

• MN/MX : The logic level at this pin decides whether the processor is to operate in either minimum or maximum mode.

• The following pin functions are for the minimum modeoperation of 8086.

• M/IO – Memory/IO : This is a status line logically equivalent to S2 in maximum mode. When it is low, it indicates the CPU is having an I/O operation, and when it is high, it indicates that the CPU is having a memory operation. This line becomes active high in the previous T4 and remains active till final T4 of the current cycle. It is tristated during local bus “hold acknowledge “.

Signal Description of 8086 (cont..)

Page 335: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 17

• INTA – Interrupt Acknowledge : This signal is used as a read strobe for interrupt acknowledge cycles. i.e. when it goes low, the processor has accepted the interrupt.

• ALE – Address Latch Enable : This output signal indicates the availability of the valid address on the address/data lines,and is connected to latch enable input of latches. This signal is active high and is never tristated.

• DT/R – Data Transmit/Receive: This output is used to decide the direction of data flow through the transreceivers (bidirectional buffers). When the processor sends out data, thissignal is high and when the processor is receiving data, this signal is low.

Signal Description of 8086 (cont..)

Page 336: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 18

• DEN – Data Enable : This signal indicates the availability of valid data over the address/data lines. It is used to enable thetransreceivers ( bidirectional buffers ) to separate the data from the multiplexed address/data signal. It is active from the middle of T2 until the middle of T4. This is tristated during ‘hold acknowledge’ cycle.

• HOLD, HLDA- Acknowledge : When the HOLD line goes high, it indicates to the processor that another master is requesting the bus access.

• The processor, after receiving the HOLD request, issues the hold acknowledge signal on HLDA pin, in the middle of the next clock cycle after completing the current bus cycle.

Signal Description of 8086 (cont..)

Page 337: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 19

• At the same time, the processor floats the local bus and control lines. When the processor detects the HOLD line low, it lowers the HLDA signal. HOLD is an asynchronous input, and is should be externally synchronized.

• If the DMA request is made while the CPU is performing a memory or I/O cycle, it will release the local bus during T4provided :

1. The request occurs on or before T2 state of the current cycle.2. The current cycle is not operating over the lower byte of a

word. 3. The current cycle is not the first acknowledge of an interrupt

acknowledge sequence.

Signal Description of 8086 (cont..)

Page 338: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 20

4. A Lock instruction is not being executed.• The following pin function are applicable for maximum

mode operation of 8086.• S2, S1, S0 – Status Lines : These are the status lines which

reflect the type of operation, being carried out by the processor. These become activity during T4 of the previous cycle and active during T1 and T2 of the current bus cycles.

1 1

S2 S1 S0 Indication0

1

000

111

1

11

1

1

1

00 0

0

0

000

Interrupt AcknowledgeRead I/O portWrite I/O portHaltCode Access

PassiveWrite memoryRead memory

1 1

Signal Description of 8086 (cont..)

Page 339: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 21

• LOCK : This output pin indicates that other system bus master will be prevented from gaining the system bus, while the LOCK signal is low.

• The LOCK signal is activated by the ‘LOCK’ prefix instruction and remains active until the completion of the next instruction. When the CPU is executing a critical instruction which requires the system bus, the LOCK prefix instruction ensures that other processors connected in the system will not gain the control of the bus.

• The 8086, while executing the prefixed instruction, asserts thebus lock signal output, which may be connected to an external bus controller.

Signal Description of 8086 (cont..)

Page 340: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 22

• QS1, QS0 – Queue Status: These lines give information about the status of the code-prefetch queue. These are active during the CLK cycle after while the queue operation is performed.

• This modification in a simple fetch and execute architecture of a conventional microprocessor offers an added advantage of pipelined processing of the instructions.

• The 8086 architecture has 6-byte instruction prefetch queue. Thus even the largest (6-bytes) instruction can be prefetched from the memory and stored in the prefetch. This results in a faster execution of the instructions.

• In 8085 an instruction is fetched, decoded and executed and only after the execution of this instruction, the next one is fetched.

Signal Description of 8086 (cont..)

Page 341: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 23

• By prefetching the instruction, there is a considerable speedingup in instruction execution in 8086. This is known as instruction pipelining.

• At the starting the CS:IP is loaded with the required address from which the execution is to be started. Initially, the queue will be empty an the microprocessor starts a fetch operation to bring one byte (the first byte) of instruction code, if the CS:IP address is odd or two bytes at a time, if the CS:IP address is even.

• The first byte is a complete opcode in case of some instruction (one byte opcode instruction) and is a part of opcode, in case of some instructions ( two byte opcode instructions), the remaining part of code lie in second byte.

Signal Description of 8086 (cont..)

Page 342: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 24

• But the first byte of an instruction is an opcode. When the first byte from the queue goes for decoding and interpretation, one byte in the queue becomes empty and subsequently the queue is updated.

• The microprocessor does not perform the next fetch operation till at least two bytes of instruction queue are emptied. The instruction execution cycle is never broken for fetch operation.After decoding the first byte, the decoding circuit decides whether the instruction is of single opcode byte or double opcode byte.

• If it is single opcode byte, the next bytes are treated as data bytes depending upon the decoded instruction length, otherwise, the next byte in the queue is treated as the second byte of the instruction opcode.

Signal Description of 8086 (cont..)

Page 343: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 25

• The second byte is then decoded in continuation with the first byte to decide the instruction length and the number of subsequent bytes to be treated as instruction data.

• The queue is updated after every byte is read from the queue but the fetch cycle is initiated by BIU only if at least two bytes of the queue are empty and the EU may be concurrently executing the fetched instructions.

• The next byte after the instruction is completed is again the first opcode byte of the next instruction. A similar procedure is repeated till the complete execution of the program.

Signal Description of 8086 (cont..)

Page 344: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 26

• The fetch operation of the next instruction is overlapped with the execution of the current instruction. As in the architecture, there are two separate units, namely Execution unit and Bus interface unit.

• While the execution unit is busy in executing an instruction, after it is completely decoded, the bus interface unit may be fetching the bytes of the next instruction from memory, depending upon the queue status.

QS1 QS0 Indication0

1 11

10

00

No operationFirst byte of the opcode from the queueEmpty queueSubsequent byte from the queue

Signal Description of 8086 (cont..)

Page 345: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 27

• RQ/GT0, RQ/GT1 – Request/Grant : These pins are used by the other local bus master in maximum mode, to force the processor to release the local bus at the end of the processor current bus cycle.

• Each of the pin is bidirectional with RQ/GT0 having higher priority than RQ/GT1.

• RQ/GT pins have internal pull-up resistors and may be left unconnected.

• Request/Grant sequence is as follows:1. A pulse of one clock wide from another bus master requests

the bus access to 8086.

Signal Description of 8086 (cont..)

Page 346: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 28

2. During T4(current) or T1(next) clock cycle, a pulse one clock wide from 8086 to the requesting master, indicates that the 8086 has allowed the local bus to float and that it will enter the ‘hold acknowledge’ state at next cycle. The CPU bus interface unit is likely to be disconnected from the local bus of the system.

3. A one clock wide pulse from the another master indicates to the 8086 that the hold request is about to end and the 8086 may regain control of the local bus at the next clock cycle. Thus each master to master exchange of the local bus is a sequence of 3 pulses. There must be at least one dead clock cycle after each bus exchange.

Signal Description of 8086 (cont..)

Page 347: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 29

• The request and grant pulses are active low.• For the bus request those are received while 8086 is

performing memory or I/O cycle, the granting of the bus is governed by the rules as in case of HOLD and HLDA in minimum mode.

Signal Description of 8086

Page 348: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 30

General Bus Operation

• The 8086 has a combined address and data bus commonly referred as a time multiplexed address and data bus.

• The main reason behind multiplexing address and data over the same pins is the maximum utilisation of processor pins and it facilitates the use of 40 pin standard DIP package.

• The bus can be demultiplexed using a few latches and transreceivers, when ever required.

• Basically, all the processor bus cycles consist of at least fourclock cycles. These are referred to as T1, T2, T3, T4. The address is transmitted by the processor during T1. It is present on the bus only for one cycle.

Page 349: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 31

• During T2, i.e. the next cycle, the bus is tristated for changing the direction of bus for the following data read cycle. The datatransfer takes place during T3, T4.

• In case, an address device is slow ‘NOT READY’ status the wait status Tw are inserted between T3 and T4. These clock states during wait period are called idle states (Ti), wait states(Tw) or inactive states. The processor used these cycles for internal housekeeping.

• The address latch enable (ALE) signal is emitted during T1 by the processor (minimum mode) or the bus controller (maximum mode) depending upon the status of the MN/MX input.

General Bus Operation ( cont..)

Page 350: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 32

• The negative edge of this ALE pulse is used to separate the address and the data or status information. In maximum mode, the status lines S0, S1 and S2 are used to indicate the type of operation.

• Status bits S3 to S7 are multiplexed with higher order address bits and the BHE signal. Address is valid during T1 while status bits S3 to S7 are valid during T2 through T4.

General Bus Operation ( cont..)

Page 351: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 33

General Bus Operation Cycle in Maximum Mode

CLK

Memory read cycle Memory write cycleT1 T2 T3 Tw T4 T1 T2 T3 Tw T4

ALE

S2 – S0

Add/stat

WR

DEN

DT/R

READY

RD/INTA

Add/data

A19-A16 S3-S7 A19-A16 S3-S7

BHE BHE

A0-A15 D15-D0 A0-A15 D15-D0

Bus reserveData Out D15 – D0

Wait Wait

ReadyReady

Memory access time

for Data In

Page 352: uProccessors

Systems Design & Programming Memory I CMPE 310

1 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory TypesTwo basic types:• ROM: Read-only memory• RAM: Read-Write memory

Four commonly used memories:• ROM• Flash (EEPROM)• Static RAM (SRAM)• Dynamic RAM (DRAM)

Generic pin configuration:

A0 A1 AN

O0 O1 ON

Address connection

Output/Input-output connection

...

...

WEWrite

OE

CS

Read

Select

Page 353: uProccessors

Systems Design & Programming Memory I CMPE 310

2 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory ChipsThe number of address pins is related to the number of memory locations.

Common sizes today are 1K to 256M locations.Therefore, between 10 and 28 address pins are present.

The data pins are typically bi-directional in read-write memories.The number of data pins is related to the size of the memory location.For example, an 8-bit wide (byte-wide) memory device has 8 data pins.Catalog listing of 1K X 8 indicate a byte addressable 8K memory.

Each memory device has at least one chip select (CS) or chip enable (CE) orselect (S) pin that enables the memory device.

This enables read and/or write operations.If more than one are present, then all must be 0 in order to perform aread or write.

Page 354: uProccessors

Systems Design & Programming Memory I CMPE 310

3 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory ChipsEach memory device has at least one control pin.

For ROMs, an output enable (OE) or gate (G) is present.The OE pin enables and disables a set of tristate buffers.

For RAMs, a read-write (R/W) or write enable (WE) and read enable (OE)are present.

For dual control pin devices, it must be hold true that both are not 0at the same time.

ROM:Non-volatile memory: Maintains its state when powered down.There are several forms:ROM: Factory programmed, cannot be changed. Older style.PROM: Programmable Read-Only Memory.

Field programmable but only once. Older style.EPROM: Erasable Programmable Read-Only Memory.

Reprogramming requires up to 20 minutes of high-intensity UV lightexposure.

Page 355: uProccessors

Systems Design & Programming Memory I CMPE 310

4 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory ChipsROMs (cont):

Flash EEPROM: Electrically Erasable Programmable ROM.Also called EAROM (Electrically Alterable ROM) and NOVRAM(NOn-Volatile RAM).

Writing is much slower than a normal RAM.

Used to store setup information, e.g. video card, on computer sys-tems.

Can be used to replace EPROM for BIOS memory.

Page 356: uProccessors

Systems Design & Programming Memory I CMPE 310

5 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

EPROMsIntel 2716 EPROM (2K X 8):

A7 VCC

2K x 8 EPROM

123456789

2019181716151413

10

2716

1112

21222324

A6A5A4A3A2A1A0

GND

O0O1O2

A8A9VPPCSA10PD/PGMO7O6O5O4O3

Pin(s) Function

A0-A10

PD/PGM

CS

O0-O7

AddressPower down/Program

Chip Select

Outputs

Chip SelectPWR DownProg Logic

YDecoder

XDecoder

CSPD/PGM

Add

ress

Inpu

ts

Data Outputs

OutputBuffers

Y-Gating

16,384Cell Matrix

VPP is used to program the deviceby applying 25V and pulsing PGMwhile holding CS high.

Page 357: uProccessors

Systems Design & Programming Memory I CMPE 310

6 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

EPROMs2716 Timing diagram:

Sample of the data sheet for the 2716 A.C. Characteristics.

This EPROM requires a wait state for use with the 8086 (460ns constraint).

Symbol ParameterLimits

Unit Test ConditionMin Typ. Max

tACC1 Addr. to Output Delay 250 450 ns PD/PGM= CS =VIL

tOH Addr. to Output Hold 0 ns PD/PGM= CS =VIL

tDF Chip Deselect to Output Float 0 100 ns PD/PGM=VIL

... ... ... ... ... ... ...

Read Mode (PD/PGM =VIL)

Address

CS

High ZData Out Valid

tACC1

tOH

tDF

Page 358: uProccessors

Systems Design & Programming Memory I CMPE 310

7 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

SRAMsTI TMS 4016 SRAM (2K X 8):

Virtually identical to the EPROM with respect to the pinout.However, access time is faster (250ns).

See the timing diagrams and data sheets in text.SRAMs used for caches have access times as low as 10ns.

A7 VCC

2K x 8 SRAM

123456789

2019181716151413

10

TM

S401

6

1112

21222324

A6A5A4A3A2A1A0

GND

DQ1DQ2DQ3

A8A9WGA10SDQ8DQ7DQ6DQ5DQ4

Pin(s) FunctionA0-A10

DQ0-DQ7

G (OE)

S (CS)

AddressData In/Data Out

Read Enable

Chip Select

W (WE) Write Enable

Page 359: uProccessors

Systems Design & Programming Memory I CMPE 310

8 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

DRAMsDRAM:

SRAMs are limited in size (up to about 128K X 8).DRAMs are available in much larger sizes, e.g., 64M X 1.

DRAMs MUST be refreshed (rewritten) every 2 to 4 msSince they store their value on an integrated capacitor that losescharge over time.

This refresh is performed by a special circuit in the DRAM whichrefreshes the entire memory using 256 reads.

Refresh also occurs on a normal read, write or during a specialrefresh cycle.

More on this later.

The large storage capacity of DRAMs make it impractical to add therequired number of address pins.

Instead, the address pins are multiplexed.

Page 360: uProccessors

Systems Design & Programming Memory I CMPE 310

9 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

DRAMsTI TMS4464 DRAM (64K X 4):

The TMS4464 can store a total of 256K bits of data.

It has 64K addressable locations which means it needs 16 addressinputs, but it has only 8.

The row address (A0 through A7) are placed on the address pins and

strobed into a set of internal latches.The column addres (A8 through A15) is then strobed in using CAS.

A2

VDD

64K x 4 DRAM

123456789

181716151413

10

TM

S446

4

1112

A3A7

WRAS

A6A5A4

VSS

DQ2

DQ1

DQ3

DQ4Pin(s) FunctionA0-A7

DQ0-DQ4

CAS

RAS

AddressData In/Data Out

Column Address Strobe

Row Address Strobe

G Output Enable

G

A1

A0

CAS

W Write Enable

Page 361: uProccessors

Systems Design & Programming Memory I CMPE 310

10 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

DRAMsTI TMS4464 DRAM (64K X 4) Timing Diagram:

CAS also performs the function of the chip select input.

Row

RAS

CAS

Column Dont care

Something is inconsistenthere (see MUX below).

A0 A8 A1 A9 A2 A10 A3 A11 A4 A12A5 A13A6 A14 A7 A15

1A 1B 2A 2B 3A 3B 4A 4B 1A 1B 2A 2B 3A 3B 4A 4BRAS

A0

74157 (2-to-1MUX)

A1 A2 A3 A4 A5 A6 A7

1Y 2Y 3Y 4Y 1Y 2Y 3Y 4Y

Address BUS

Inputs to DRAM

0: latch A to Y1: latch B to Y

S S 74157 (2-to-1MUX)

Page 362: uProccessors

Systems Design & Programming Memory I CMPE 310

11 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

DRAMsLarger DRAMs are available which are organized as 1M X 1, 4M X 1, 16M X1, 64M X 1 (with 256M X 1 available soon).

DRAMs are typically placed on SIMM (Single In-line Memory Modules)boards.

30-pin SIMMs come in 1M X 8, 1M X 9 (parity), 4M X 8, 4M X 9.72-pin SIMMs come in 1/2/3/8/16M X 32 or 1M X 36 (parity).

5 10 15 20 25 30 35 40 45 50 55 60 65 70

NC

++

VSSVCC DQ0-31

Addr0-11 RASCAS

WPD1-4

Page 363: uProccessors

Systems Design & Programming Memory I CMPE 310

12 (Feb. 25, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

DRAMsPentiums have a 64-bit wide data bus.

The 30-pin and 72-pin SIMMs are not used on these systems.Rather, 64-bit DIMMs (Dual In-line Memory Modules) are the standard.

These organize the memory 64-bits wide.The board has DRAMs mounted on both sides and is 168 pins.

Sizes include 2M X 64 (16M), 4M X 64 (32M), 8M X 64 (64M) and 16M X64 (128M).

The DIMM module is available in DRAM, EDO and SDRAM (andNVRAM) with and without an EPROM.

The EPROM provides information abou the size and speed of thememory device for PNP applications.

Page 364: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

1 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory Address DecodingThe processor can usually address a memory space that is much larger than the memory space covered by an individual memory chip.

In order to splice a memory device into the address space of the processor, decoding is necessary.

For example, the 8088 issues 20-bit addresses for a total of 1MB of memory address space.

However, the BIOS on a 2716 EPROM has only 2KB of memory and 11 address pins.

A decoder can be used to decode the additional 9 address pins and allow the EPROM to be placed in any 2KB section of the 1MB address space.

Page 365: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

2 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory Address Decoding

A0A1

A10

O0O1

O7

... ...

CS

RD of 8088/86

2716

IO/M

A19

A18

A17

A16

A15

A14

A13

A12

A11

Address Bus Data Bus

Logic 0 when A11 through A19 are all 1.

Or MRDC bus signal.

(2K X 8)(Book showsOE connectionfor RD butchip definitiondoes NOT have

EPROM

this pin).

Page 366: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

3 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory Address DecodingTo determine the address range that a device is mapped into:

This 2KB memory segment maps into the reset location of the 8086/8088 (FFFF0H).

NAND gate decoders are not often used.Rather the 3-to-8 Line Decoder (74LS138) is more common.

1111 1111 1XXX XXXX XXXX

A19 - A11 A10 - A0

1111 1111 1000 0000 0000 (FF800H)

To

1111 1111 1111 1111 1111 (FFFFFH)

Page 367: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

4 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory Address DecodingThe 3-to-8 Line Decoder (74LS138)

Note that all three Enables (G2A, G2B, and G1) must be active, e.g. low, low and high, respectively.

Each output of the decoder can be attached to an 2764 EPROM (8K X 8).

G2A

G2BG1

ABC

01234567E

nab

leS

elec

t In

pu

ts

Ou

tpu

ts

InputsOutput

Enable Select

G2A G2B G1 C B A 0 1 2 3 4 5 6 7

1 X X X X X 1 1 1 1 1 1 1 1X 1 X X X X 1 1 1 1 1 1 1 1X X 0 X X X 1 1 1 1 1 1 1 10 0 1 0 0 0 0 1 1 1 1 1 1 10 0 1 0 0 1 1 0 1 1 1 1 1 10 0 1 0 1 0 1 1 0 1 1 1 1 10 0 1 0 1 1 1 1 1 0 1 1 1 10 0 1 1 0 0 1 1 1 1 0 1 1 10 0 1 1 0 1 1 1 1 1 1 0 1 10 0 1 1 1 0 1 1 1 1 1 1 0 10 0 1 1 1 1 1 1 1 1 1 1 1 0

Page 368: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

5 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory Address Decoding

The EPROMs cover a 64KB section of memory.

G2A

G2BG1

ABC

01234567

A0

A12O0

O7

......

CS

2764

A16

A17A18A19

A13

A14

A15

CSCS

CSCS

CSCS

CSRD of 8088/86

Data Bus

Address Bus

F2000-F3FFF

F0000-F1FFF

F4000-F5FFF

F6000-F7FFF

F8000-F9FFF

FA000-FBFFF

FC000-FDFFF

FE000-FFFFF

Address spaceF0000H-FFFFFH

A13 through A15 selecta 2764

A16 through A19 enablethe decoder

(8K X 8)

(Not sure about 2764 pinout,text is in error with 2716)

74L

S13

8

EPROM

Page 369: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

6 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory Address DecodingYet a third possibility is a PLD (Programmable Logic Device).PLDs come in three varieties:• PLA (Programmable Logic Array)• PAL (Programmable Array Logic)• GAL (Gated Array Logic)

PLDs have been around since the mid-1970s but have only recently appeared in memory systems (PALs have replaced PROM address decoders).

PALs and PLAs are fuse-programmed (like the PROM).Some are erasable (like the EPROM).

A PAL example (16L8) is shown in the text and is commonly used to decode the memory address, particularly for 32-bit addresses generated by the 80386DX and above.

Page 370: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

7 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory Address DecodingAMD 16L8 PAL decoder.

It has 10 fixed inputs (Pins 1-9, 11), two fixed outputs (Pins 12 and 19) and 6 pins that can be either (Pins 13-18).

AND/NOR device with logic expressions (outputs) with up to 16 ANDed inputs and 7 ORed product terms.

O3

1234567

15

11

2019

16

16L

8 1718

I4I5I6I7

VCC

I3I2

O6

O8I1

O4O5

O7

98

10121314

I8I9

GND

O2O1I10

;pins 1 2 3 4 5 6 7 8 9 10A19 A18 A17 A16 A15 A14 A13 NC NC GND

;pins 11 12 13 14 15 16 17 18 19 20NC O8 O7 O6 O5 O4 O3 O2 O1 VCC

Equations:/O1 = A19 * A18 * A17 * A16 * /A15 * /A14 * /A13/O2 = A19 * A18 * A17 * A16 * /A15 * /A14 * A13/O3 = A19 * A18 * A17 * A16 * /A15 * A14 * /A13/O4 = A19 * A18 * A17 * A16 * /A15 * A14 * A13/O5 = A19 * A18 * A17 * A16 * A15 * /A14 * /A13/O6 = A19 * A18 * A17 * A16 * A15 * /A14 * A13/O7 = A19 * A18 * A17 * A16 * A15 * A14 * /A13/O8 = A19 * A18 * A17 * A16 * A15 * A14 * A13

Programmed to decode address lines A19 - A13 onto 8 outputs.

Page 371: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

8 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

8088 and 80188 (8-bit) Memory InterfaceThe memory systems “sees” the 8088 as a device with:• 20 address connections (A19 to A0).• 8 data bus connections (AD7 to AD0).• 3 control signals, IO/M, RD, and WR.

We’ll look at interfacing the 8088 with:• 32K of EPROM (at addresses F8000H through FFFFFH).• 512K of SRAM (at addresses 00000H through 7FFFFH).

The EPROM interface uses a 74LS138 (3-to-8 line decoder) plus 8 2732 (4K X 8) EPROMs.

The EPROM will also require the generation of a wait state.The EPROM has an access time of 450ns.The 74LS138 requires 12ns to decode.The 8088 runs at 5MHz and only allows 460ns for memory to access data.A wait state adds 200ns of additional time.

Page 372: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

9 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

8088 and 80188 (8-bit) EPROM Memory Interface

The 8088 cold starts execution at FFFF0H. JMP to F8000H occurs here.

G2A

G2BG1

ABC

01234567

A0

A11O0

O7

......

CS

2732

A15

A17A18

A19

A12

A13

A14

CSCS

CSCS

CSCS

CS

RD

Data Bus

Address Bus

Address spaceF8000H-FFFFFH

(4K X 8)

(This is the 2732 pinoutas shown in the text.)

74LS138

OE

A16

WAIT

IO/M

5V

1K

To wait state generator

Page 373: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

10 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

8088 and 80188 (8-bit) RAM Memory Interface

A0

A14

O0

O7

... ...CS

A18

A19

CSCSCSCS

CSCSCS

OE

IO/M

WE

CSCSCSCS

CSCSCS

A0

A14

O0

O7

... ...

CSOEWE

Data Bus

(32K

X 8

)

WR

A15A16A17

1G 2G

74L

S24

4B

uff

er

RD

G

Dir

74L

S24

5B

D B

uff

er

G2AG2B

G1

ABC

01234567

G2AG2B

G1

ABC

01234567

Address Bus

74L

S13

8

A14

A9A10A11A12A13

1G 2G74

LS

244

Bu

ffer

A8

G2AG2B

G1

ABC

01234567

A6A7

A0A1A2A3A4A5

1G 2G

74L

S24

4B

uff

er

6225

6

(32K

X 8

)62

256

3

2

74L

S13

8

74L

S13

8

4

Page 374: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

11 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

8088 and 80188 (8-bit) RAM Memory InterfaceThe 16 62256s on the previous slide are actually SRAMs.

Access times are on order of 10ns.

Flash memory can also be interfaced to the 8088 (see text).However, the write time (400ms !) is too slow to be used as RAM (as shown in the text).

Parity Checking:Parity checking is used to detect single bit errors in the memory.

The current trend is away from parity checking.

Parity checking adds 1 bit for every 8 data bits.• For EVEN parity, the 9th bit is set to yield an even number of 1’s in all 9

bits.• For ODD parity, the 9th bit is set to make this number odd.

For 72-pin SIMMs, the number of data bits is 32 + 4 = 36 (4 parity bits).

Page 375: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

12 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Parity for Memory Error Detection74AS280 Parity Generator/Checker

This circuit generates EVEN or ODD parity for the 9-bit number placed on its inputs.

Typically, for generation, the 9th input bit is set to 0.

This circuit also checks EVEN or ODD parity for the 9-bit number.In this case, the 9th input bit is connected to the 9th bit of memory.For example, if the original byte has an even # of 1’s (with 9th bit at GND), the parity bit is set to 1 (from the EVEN output).

If the EVEN output goes high during the check, then an error occurred.

A

1234567

98

1413

1074

AS2

801112

IEVEN

ODDGND

VCC

NCH

D

FG

BC

E

9-bit parity generator/checker

Number of inputs Athru I that are HIGH

OutputsEVEN ODD

0, 2, 4, 6, 8

1, 3, 5, 7, 9

H L

L H

Page 376: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

13 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Parity for Memory Error Detection

A0

A14

O0

O7

... ...

CS

A18

OE

RESET

WEWR

A15A16A17

RD

G2AG2B

G1

ABC

01234567

74L

S13

8

(32K

X 8

)62

256

A0

A14

O0

O7

... ...

CSOEWE

(32K

X 8

)62

256

6287

(64K

X 1

)

A0

A15

...

CEWE

ABCDEFGHI

ABCDEFGHI

74L

S28

074

LS

280

EVENODD

EVENODD

74L

S74

Q

Q

D

CLK

DODI

Generator

Checker

IO/M

A19

Dat

a B

us

Clear

NMI

Address Bus

Page 377: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

14 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Error DetectionThis parity scheme can only detect a single bit error.• Block-Check Character (BCC) or Checksum.

Can detect multiple bit errors.This is simply the two’s complement sum (the negative of the sum) of the sequence of bytes.

No error occurred if adding the data values and the checksum produces a 0.

For example:

This is not fool proof. If 45 changes to 44 AND 04 changes to 05, the error is missed.

Compute the sum:

Given 4 hex data bytes: 10, 23, 45, 04

102345047C

Invert and add 1

0111 1100 + 11000 0011 + 11000 0100 = 84H

to get checksum byte: 10234504

1 00

Check is made by addingand checking for 00

84

(discard the carry):

Page 378: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

15 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Error Detection• Cyclic Redundancy Check (CRC).

Commonly used to check data transfers in hardware such as harddrives.Treats data as a stream of serial data n-bits long.

The bits are treated as coefficients of a characteristic polynomial, M(X) of the form:

M X( ) bn bn 1– X bn 2– X2

... b1Xn 1–

b0Xn

+ + + + +=

M X( ) 0 0X1

1X2

0X3

0X4

1X5

1X6

0X7

1X8

+ + + + + + + + +=

where b0 is the least significant bit while bn is the most significant bit.

For the 16-bit data stream: 26F0H = 0010 0110 1111 0000

1X9

1X10

1X11

0X12

0X13

0X14

0X15

+ + + + + +

M X( ) 1X2

1X5

1X6

1X8

1X9

1X10

1X11

+ + + + + +=

Page 379: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

16 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Error Detection• Cyclic Redundancy Check (CRC) (cont.)

The CRC is found by applying the following equation.

G(X) is the called the generator polynomial and has special properties.A commonly used polynomial is:

The remainder R(X) is appended to the data block.When the CRC and R(X) is computed by the receiver, R(X) should be zero.

Since G(X) is of power 16, the remainder, R(X), cannot be of order higher than 15.

Therefore, no more than 2 bytes are needed independent of the data block size.

CRCM X( )X

n

G X( )-------------------- Q X( ) R X( )+= =

Q(X) is the quotientR(X) is the remainder

G X( ) X16

X15

X2

1+ + +=

Page 380: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

17 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Error Detection• Cyclic Redundancy Check (CRC)(cont.)

M X( )X16

G X( )------------------------

X27

X26

X25

X24

X22

X21

X18

+ + + + + +

X16

X15

X2

1+ + +-----------------------------------------------------------------------------------------------------------=

X16

X15

X2

1+ + + X27

X26

X25

X24

X22

X21

X18

+ + + + + +

X27

X26

+ X13

X11

++

X25

X24

X22

X21

X18

+ + + +

X25

X24

+ X11

X9

+

X22

X21

X18

+ + X9

+

+

X22

X21

+ X8

X6

++

X18 X

9X

8X

6+ ++

X13+

+ X13

X18

X17

+ X4

X2

+

X17

X13

+

+

X17

X16

+ X3

X+...

X11

X9

X6

X2

X 1+ + + + +

X13

X11

++

X9

X8

X6

X4

X2

+ + + ++

R X( ) X15

X13

X9

X8

X6

X4

X3

X 1+ + + + + + + +=

Final Solution is:

Value appended is the reverse coefficient value 1101 1010 1100 0101 = DAC5H

Page 381: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

18 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Error CorrectionParity, BCC and CRC are only mechanisms for error detection.

The system is halted if an error is found in memory.

Error correction is starting to show up in new systems.SDRAM has ECC (Error Correction Code).

Correction will allow the system can continue operating.If two errors occur, they can be detected but not corrected.Error correction will of course cost more in terms of extra bits.

Error correction is based on Hamming Codes.There is lots of theory here but our focus will be on implementation.The objective is to correct any single bit errors in an 8-bit data byte.

In other words, we need 4 parity bits to correct single bit errors.Note that the parity bits are at bit positions that are powers of 2.

The data bits of the byte are labeled X3, X5, X6, X7, X9, X10, X11 and X12.The parity bits are labeled P1, P2, P4 and P8.

Page 382: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

19 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Error CorrectionHamming Codes (cont).

P1 is generated by computing the parity of X3, X5, X7, X9, X11, X13, X15.

These numbers have a 1 in bit position 1 of the subscript in binary.

0 0 0 00 0 0 10 0 1 00 0 1 10 1 0 00 1 0 10 1 1 00 1 1 11 0 0 01 0 0 11 0 1 01 0 1 11 1 0 01 1 0 11 1 1 01 1 1 1

P1P2

P3

P4

34

210

56789101112131415

1234

P1 is assigned even parity using X3, X5, X7, X9, X11, X13, X15

P2 is assigned even parity using X3, X6, X7, X10, X11, X14, X15

P3 is assigned even parity using X5, X6, X7, X12, X13, X14, X15

P4 is assigned even parity using X9, X10, X11, X12, X13, X14, X15

Note that each data bit is usedin the parity computation of

Given data byte: 11010010

P1 uses blue bits:

Not used since we are correcting byte data.

1 1 0 1 0 0 1 035679101112

P1 even parity is 1.

P2 uses brown bits:

1 1 0 1 0 0 1 035679101112

P2 even parity is 1.

1 1 0 1 0 0 1 0

1 1 0 1 0 0 1 0

at least 2 P bits.

P3 uses cyan bits:

P3 even parity is 0.

P4 uses purple bits:

P4 even parity is 1.

Page 383: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

20 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Error CorrectionHamming Codes (cont).

110110010011Parity encoded data:

If X10 flips from 0 -> 1, then the check gives the location of the bit error as:

1 1 1 1 1 0 0 1 035679101112

P1 even parity is 0. 1 1 1 1 1 0 0 1 0 P2 even parity is now 1. 0 1 1 1 1 0 0 1 0

1 1 1 1 1 0 0 1 0

P3 even parity is 0. P4 even parity is now 1.

Flipped

P

The position of the bit flip is given by:

Since these are NOT 0,there was an error.

P4P3P2P1 is 1010 or 10 decimal.

Page 384: uProccessors

Systems Programming 8086/88 Memory Interface II CMPE 310

21 (April 10, 2000 12:36 pm)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Parity for Memory Error CorrectionThe 74LS636 corrects errors by storing 5 parity bits with each byte of data.

The pinout consists of:• 8 data I/O pins• 5 check bit I/O pins• 2 control pins• 2 error outputs

Single error flag (SEF)Double error flag (DEF).

See the text for an example of its use in a circuit.

CB2

1234567

15

11

2019

16

74L

S636 17

18DB2DB3DB4DB5

VCC

DB1DB0

S0

SEFDEF

CB1CB0

S1

98

10121314

DB6DB7

GND

CB3NCCB4

Page 385: uProccessors

Systems Design & Programming Memory III CMPE 310

1 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

8086 - 80386SX 16-bit Memory InterfaceThese machines differ from the 8088/80188 in several ways:• The data bus is 16-bits wide.• The IO/M pin is replaced with M/IO (8086/80186) and MRDC and MWTC

for 80286 and 80386SX.• BHE, Bus High Enable, control signal is added.• Address pin A0 (or BLE, Bus Low Enable) is used differently.

The 16-bit data bus presents a new problem:The microprocessor must be able to read and write data to any 16-bitlocation in addition to any 8-bit location.

The data bus and memory are divided into banks:

FFFFFFFFFFFD

000003000001

8 MB

8 bitsD15-D8

FFFFFEFFFFFC

000002000000

8 MB

8 bits D7-D0

High bank Low bank

Odd bytes Even bytesBHE selects BLE selects

Page 386: uProccessors

Systems Design & Programming Memory III CMPE 310

2 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

8086 - 80386SX 16-bit Memory InterfaceBHE and BLE are used to select one or both:

Bank selection can be accomplished in two ways: Separate write decoders for each bank (which drive CS). A separate write signal (strobe) to each bank (which drive WE).

Note that 8-bit read requests in this scheme are handled by the micropro-cessor (it selects the bits it wants to read from the 16-bits on the bus).

There does not seem to be a big difference between these methods althoughthe book claims that there is.

Note in either method that A0 does not connect to memory and bus wire A1

connects to memory pin A0, A2 to A1, etc.

BHE BLE Function0 0 Both banks enabled for 16-bit transfer0 1 High bank enabled for an 8-bit transfer1 0 Low bank enabled for an 8-bit transfer1 1 No banks selected

Page 387: uProccessors

Systems Design & Programming Memory III CMPE 310

3 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

80386SX 16-bit Memory Interface (Separate Decoders)

A0

A15

O0

O7

... ...

CS

A20

CSCSCSCS

CSCSCS

M/IO

CSCSCSCS

CSCSCS

A0

A15

O0

O7... ...

CS

BHE

A17

BLE

G2AG2B

G1

ABC

01234567

74LS

138

G2AG2B

G1

ABC

01234567

(64K X 8)62512

374

LS13

8A18A19

A21A22

A23

Dat

a B

us

D0 to D7

D8 to D15

8038

6SX

Sepa

rate

Dec

oder

s

(64K X 8)62512

WE

OE

MWTC

OE

WE

Address BusA1 to A16

G2AG2B

G1

ABC

01234567

74LS

138

MRDC

Page 388: uProccessors

Systems Design & Programming Memory III CMPE 310

4 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory InterfacesSee text for Separate Write Strobe scheme plus some examples of the integra-tion of EPROM and SRAM in a complete system.

It is just an application of what we’ve been covering.

80386DX and 80486 have 32-bit data buses and therefore 4 banks of memory.32-bit, 16-bit and 8-bit transfers are accomplished by different combina-tions of the bank selection signals BE3, BE2, BE1, BE0.

The Address bits A0 and A1 are used within the microprocessor to gener-

ate these signals.They are don’t cares in the decoding of the 32-bit address outside thechip (using a PLD such as the PAL 16L8).

The high clock rates of these processors usually require wait states formemory access.

We will come back to this later.

Page 389: uProccessors

Systems Design & Programming Memory III CMPE 310

5 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Pentium Memory InterfaceThe Pentium, Pentium Pro, Pentium II and III contain a 64-bit data bus.

Therefore, 8 decoders or 8 write strobes are needed as well as 8 memorybanks.

The write strobes are obtained by combining the bank enable signals(BEx) with the MWTC signal.

MWTC is generated by combining the M/IO and W/R signals.BE7

BE6

BE5

BE4MWTC

BE3

BE2

BE1

BE0

WR7

WR6

WR5

WR4

WR3

WR2

WR1

WR0

W/R

M/IO

Page 390: uProccessors

Systems Design & Programming Memory III CMPE 310

6 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Pentium Memory Interface

I1I2I3I4I5I6I7I8I9I10

16L8

O1O2O3O4O5O6O7O8

A29A30A31

I1I2I3I4I5I6I7I8I9I10

16L8

O1O2O3O4O5O6O7O8

A19A20A21A22A23A24A25A26A27A28

A0

A15

O0

O7

... ...

CEOE

2751

2

D0-

D7

D8-

D15

D15

-D23

D24

-D31

D56

-D63

D48

-D55

D40

-D47

D32

-D39

A3-A18

MRDC

A0

A15

O0

O7

... ...

CEOE

2751

2

A0

A15

O0

O7

... ...CEOE

2751

2

A0

A15

O0

O7

... ...

CEOE

2751

2

A0

A15

O0

O7

... ...

CEOE

2751

2

A0

A15

O0

O7... ...

CEOE

2751

2

A0

A15

O0

O7

... ...

CEOE

2751

2

A0

A15

O0

O7

... ...

CEOE

2751

2

(64K

X 8

)

WE WE WE WE

WEWEWEWE

WR

0

WR

1

WR

2

WR

3W

R7

WR

6

WR

5

WR

4

Page 391: uProccessors

Systems Design & Programming Memory III CMPE 310

7 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Pentium Memory InterfaceIn order to map previous memory into addr. space FFF80000H-FFFFFFFFH

Use a 16L8 to do the WR0 - WR7 decoding using MWTC and BE0 - BE7.See the text -- Figure 10-35.

;pins 1 2 3 4 5 6 7 8 9 10A29 A30 A31 NC NC NC NC NC NC GND

;pins 11 12 13 14 15 16 17 18 19 20U2 CE NC NC NC NC NC NC NC VCC

Equations:/CE = /U2 * A29 * A30 * A31

I1I2I3I4I5I6I7I8I9I10

16L8

O1O2O3O4O5O6O7O8

A29A30A31

I1I2I3I4I5I6I7I8I9I10

16L8

O1O2O3O4O5O6O7O8

A19A20A21A22A23A24A25A26A27A28

;pins 1 2 3 4 5 6 7 8 9 10A19 A20 A21 A22 A23 A24 A25 A26 A27 GND

;pins 11 12 13 14 15 16 17 18 19 20A28 U2 NC NC NC NC NC NC NC VCC

Equations:/U2 = A19 * A20 * A21 * A22 * A23 * A24 * A25 *

A26 * A27 * A28

Page 392: uProccessors

Systems Design & Programming Memory III CMPE 310

8 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory ArchitectureIn order to build an N-word memory where each word is M bits wide (typi-cally 1, 4 or 8 bits), a straightforward approach is to stack memory:

This approach is not practical.What can we do?

S0

S1

S2

SN-2

SN-1

N w

ords

Word 0

Word 1Word 2 Storage cell

Word N-2Word N-1

Input-Output(M bits)

A word is selected by setting exactlyone of the select bits, Sx, high.

This approach works well for smallmemories but has problems for large

For example, to build a 1Mword

memories.

(where word = 8 bits) memory, requires1M select lines, provided by someoff-chip device.

Page 393: uProccessors

Systems Design & Programming Memory III CMPE 310

9 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory ArchitectureAdd a decoder to solve the package problem:

This does not address the memory aspect ratio problem:

The memory is 128,000 time higher than wide (220/23) !Besides the bizarre shape factor, the design is extremely slow since the ver-tical wires are VERY long (delay is at least linear to length).

S0

S1

S2

SN-2SN-1

Word 0Word 1Word 2 Storage cell

Word N-2Word N-1

Input-Output(M bits)

Dec

oder

A0A1

A2

AK-1

K = log2N

one-hot

Bina

ry e

ncod

ed a

ddre

ss

This reduces thenumber of externaladdress pins from1M to 20.

Page 394: uProccessors

Systems Design & Programming Memory III CMPE 310

10 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory ArchitectureThe vertical and horizontal dimensions are usually very similar, for an aspectratio of unity.

Multiple words are stored in each row and selected simultaneously:S0

S1

S2

SN-2SN-1

Storage cell

Input-Output(M bits)

AKAK+1

AK+2

AL-1

Column address =A0

AK-1

Bit line

Word line

A0 to AK-1

Row address =AK to AL-1

A column decoder is added toselect the desired word from a row.

Column decoder

Row

Dec

oder

Sense ampsand driversnot shown

Page 395: uProccessors

Systems Design & Programming Memory III CMPE 310

11 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Memory ArchitectureThis strategy works well for memories up to 64 Kbits to 256 Kbits.Larger memories start to suffer excess delay along bit and word lines.A third dimension is added to the address space to solve this problem:

Global Data bus

RowAddress

ColumnAddressBlockAddress

Block 0 Block i Block P-1

Globalamplifier/driver

I/O

Address: [Row][Block][Col]

Block selector

Page 396: uProccessors

Systems Design & Programming Memory III CMPE 310

12 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Dynamic RAMDRAM requires refreshing every 2 to 4 ms.

Refreshing occurs automatically during a read or write.Internal circuitry takes care of refreshing cells that are not accessed overthis interval.

This special refresh occurs transparently while other memory componentsoperate and is called transparent refresh or cycle stealing.

A RAS-only cycle strobes a row address into the DRAM, obtained by 7- or 8-bit binary counter.

The capacitors are recharged for the selected row by reading the bits outinternally and then writing them back.

For a 256K X 1 DRAM with 256 rows, a refresh must occur every 15.6us(4ms/256).

For the 8086, a read or write occurs every 800ns.This allows 19 memory reads/writes per refresh or 5% of the time.

Page 397: uProccessors

Systems Design & Programming Memory III CMPE 310

13 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

Dynamic RAM

A0A1A2A3A4A5A6A7A8RAS

CAS

Dec

oder

Row

Lat

ches

Col

umn

Latc

hes

8

WE

DINDOUT

MU

X

DirA9(A0 from input pin on RAS)A8

S1S0

MUX256-to-1

MUX256-to-1

MUX256-to-1

MUX256-to-1

64K array(256 X 256)

255254

10

64K array(256 X 256)

64K array(256 X 256)

64K array(256 X 256)

256K X 1 DRAM

A0-A7

A10-A17

Block 0Block 1Block 2Block 3

These signals provide the block address.

Page 398: uProccessors

Systems Design & Programming Memory III CMPE 310

14 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

EDO and SDRAM MemoryExtended Data Output memory:

Any memory access in an EDO memory (including a refresh) stores the256 bits in a set of latches.

Any subsequent access to bytes in this set are immediately available(without the decode time and therefore wait states).

This works well because of the principle of spatial locality, and improvessystem performance by 15 to 25 % !

Synchronous Dynamic RAM:Access times are 10ns (for use with 66MHz bus) and 8ns (for use with100MHz bus).

Standard DRAM access times are 60ns.

However, these access times only apply to the 2nd, 3rd and 4th 64-bitreads -- the first takes the same time as a standard DRAM.

Page 399: uProccessors

Systems Design & Programming Memory III CMPE 310

15 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

EDO and SDRAM MemorySynchronous Dynamic RAM:

However, this improves performance again, particularly for reads intocache block sizes of 256 bits.

For example, 256 bit transfer takes three bus cycles for the first read andthree for the next three 64-bit words, for a total of 7 bus cycles.

This contrasts with the 3*4 or 12 bus cycles for DRAM or EDO.

Measurements show about a 10% increase in performance.

DRAM Controllers:A DRAM controller is usually responsible for address multiplexing andgeneration of the DRAM control signals.

These devices tend to get very complex.We will focus on a simpler device, the Intel 82C08, which can control twobanks of 256K X 16 DRAM memories for a total of 1 MB.

Page 400: uProccessors

Systems Design & Programming Memory III CMPE 310

16 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

DRAM Controllers:Intel 82C08:

Microprocessor bits A1 through A18 (18 bits) drive the 9 Address Low

(AL) and 9 Address High (AH) bits of the 82C08.9 of each of these are strobed onto the address wires A0 through A8 to

the memories.

Either RAS0/CAS0 or RAS1/CAS1 are strobed depending on theaddress.

This drives a 16-bit word onto the High and Low data buses (if WE islow) or writes an 8 or 16 bit word into the memory otherwise.

WE (from the 82C08), BHE and A0 are used to determine if a write is to

be performed and which byte(s) (low or high or both) is to be written.

Address bit A20 through A23 along with M/IO enable these memories to

map onto 1 MByte range (000000H-0FFFFFH).

Page 401: uProccessors

Systems Design & Programming Memory III CMPE 310

17 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

DRAM Controllers

A0

A8

O0

O7... ...

RASCAS 41

256A

8

WE

(256K X 8)

Low

Dat

a B

usA0

A8

O0

O7

... ...

RASCAS 41

256A

8

WE

A0

A8

O0

O7

... ...

RASCAS 41

256A

8

WE

Hig

h D

ata

BusA0

A8

O0

O7

... ...

RASCAS 41

256A

8WE

I1I2I3I4I5I6I7I8I9I10

16L8

O1O2O3O4O5O6O7O8

A0A20

R1A0

A8

...

AL0

AL8

...

AH0

AH8

...

WRRESETCLKPCTL

RD

PEBSRFRQPD1

RAS0CAS0RAS1CAS1

AA/XAWE

A1

A18

S0S1

A21A22A23

M/IO

A19

R2

WAIT

82C

08

BHE

Page 402: uProccessors

Systems Design & Programming Memory III CMPE 310

18 (Mar. 6, 2002)UMBCU M B C

UN

IVE

RSI

TY

OF

MARYLAND BALTIM

OR

E C

OU

NTY

1 9 6 6

DRAM Controllers:16L8 Programming:

;pins 1 2 3 4 5 6 7 8 9 10WE BHE A0 A20 A21 A22 A23 NC NC GND

;pins 11 12 13 14 15 16 17 18 19 20MIO CE NC NC NC NC LWR HWR PE VCC

Equations:

/HWR = /BHE * /WE

I1I2I3I4I5I6I7I8I9I10

16L8

O1O2O3O4O5O6O7O8

A0A20A21A22A23

M/IO/LWR = /A0 * /WE

/PE = /A20 * /A21 * /A22 * /A23 * MIO

WEPEHWRLWR

Page 403: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 1

Pin Diagram of 8085

20

19181716

1514

13

1211

1

2345678

910

21

2223

242526272829

30

403938373635343332

31

8085 A

VSS

AD7

AD6

AD5

X1X2

OUTSODSIDTRAPRST 7.5RST 6.5RST 5.5INTR_____

INTAAD0

AD1

AD2

AD3

AD4

RESET

A8

VccHOLDHLDACLK ( OUT) _________________

RESET IN

S1___

RD

ALES0

READY __

IO / M

___

WR

A9

A10

A11

A15

A14

A13

A12

Serial i/p, o/p signals

DMA

Page 404: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 2

Signal Groups of 8085

Multiplexed address / data bus

GND

VssVcc

+ 5 V

X1 X2

XTAL

4

5

SOD

SID

RESET OUT CLK OUT

____

WR

____

RD

___

IO / M

S0

S1

ALE

A8

A15High order Address bus

AD0

AD7

HLDA______

INTA

READYHOLD ______________

RESET IN

INTRRESET 5.5RESET 6.5RESET 7.5

TRAP

Page 405: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 3

GND

+5V

X1

X2

TIMING AND CONTROLCLK

GEN

CLK OUT READY

CONTROL

RD

ALE

S0 S1 RESET OUT

IO / M HOLD HLDA

DMASTATUS

RESET IN

ARITHEMETIC LOGIC UNIT ( ALU)

(8)

ACCUMULATOR TEMP REG(8)

(8)

FLAG ( 5)

FLIP FLOPS

INTERRUPT CONTROL SERIAL I / O CONTROL

SID SIOTRAP

INTR

INTA RES

5 . 5

RES

6 . 5

RES

7 . 5

8 BIT INTERNAL DATA BUS

INSTRUCTION REGISTER ( 8 )

MULTIPLXER

R

E

G.

S

E

L

E

C

T

ADDRESS BUFFER ( 8 )

DATA / ADDRESS BUFFER ( 8 )

INSTRUCTION DECODER AND MACHINE ENCODING

W ( 8 )

TEMP . REG.B REG ( 8 )

D REG ( 8 )H REG ( 8 )

STACK POINTERPROGRAM COUNTER ( 16 )INCREAMENT / DECREAMENT

ADDRESS LATCH ( 16 )

( 16 )

AD7 – AD0 ADDRESS / BUFFER BUS

A 15 – A8 ADDRESS BUS

C REG ( 8 )

E REG ( 8 )L REG ( 8 )

WR

Page 406: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 4

CYPACS Z

D0D1D2D3D4D5D6D7

Flag Registers

General Purpose RegistersINDIVIDUAL

COMBININATON

B, C, D, E, H, L

B & C, D & E, H & L

Page 407: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 5

AH AL

BH BL

CH CL

DH DL

SP

BP

SI

DI

ES

CS

SS

DS

IP

1

∑ADDRESS BUS

( 20 ) BITS

DATA BUS

( 16 ) BITS

BUS

CONTROL LOGIC

8

0

8

6

BUS

2 3 4 65

INSTRUCTION QUEUE

8 BIT

Q BUS

EU CONTROL SYSTEM

ALU DATA BUS

16 BITS

TEMPORARY REGISTERS

ALU

FLAGS

GENERAL REGISTERS

EXECUTION UNIT ( EU )

BUS INTERFACE UNIT ( BIU)

Fig:

Page 408: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 6

20

19181716

1514

13

1211

1

2345678

910

21

2223

242526272829

30

403938373635343332

31

8086

CPU

GND

CLK

INTR

NMI

GNDAD14

AD13

AD12

AD11

AD10

AD9AD8AD7

AD6

AD5

AD4

AD3

AD2

AD1

AD0

RESET

VCC

AD15

A16 / S3

A17 / S4

____

MN/MX___

RD

_______

LOCK

A19/S6

___

(WR)

READY

______

TEST

QS1

____

S2___

S1 _____

(DEN)(ALE)

A18 / S5

_____

BHE / S7

_____ _____

RQ / GT0 ( HOLD)___ _____

RQ / GT1 ( HLDA)____

(M / IO )___

(DT / R)___

S0 QS0 ________

(INTA)

Pin Diagram of 8086

Page 409: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 7

CLK

GNDVCC

8086

MPU

INTR_____

INTA

______

TEST

NMI

RESET

HOLD

HLDA

VCC

____

MN / MX

INTERRUPT

INTERFACE

DMA

INTERFACE

MODE SELECT READY

_____

DEN

_____

WR

____

RD

__

DT / R

__

M / IO

ALE___

BHE / S7

MEMORY I / O

CONTROLS

D0 - D15

A0 - A15, A16 / S3 – A19/S6

ADDRESS / DATA BUS

Page 410: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 8

Signal Description of 8086

• The Microprocessor 8086 is a 16-bit CPU available in different clock rates and packaged in a 40 pin CERDIP or plastic package.

• The 8086 operates in single processor or multiprocessor configuration to achieve high performance. The pins serve a particular function in minimum mode (single processor mode ) and other function in maximum mode configuration (multiprocessor mode ).

• The 8086 signals can be categorised in three groups. The first are the signal having common functions in minimum as well as maximum mode.

Page 411: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 9

• The second are the signals which have special functions for minimum mode and third are the signals having special functions for maximum mode.

• The following signal descriptions are common for both modes.• AD15-AD0 : These are the time multiplexed memory I/O

address and data lines.• Address remains on the lines during T1 state, while the data is

available on the data bus during T2, T3, Tw and T4.• These lines are active high and float to a tristate during

interrupt acknowledge and local bus hold acknowledge cycles.

Signal Description of 8086 (cont..)

Page 412: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 10

• A19/S6,A18/S5,A17/S4,A16/S3 : These are the time multiplexed address and status lines.

• During T1 these are the most significant address lines for memory operations.

• During I/O operations, these lines are low. During memory or I/O operations, status information is available on those lines for T2,T3,Tw and T4.

• The status of the interrupt enable flag bit is updated at the beginning of each clock cycle.

Signal Description of 8086 (cont..)

Page 413: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 11

• The S4 and S3 combinedly indicate which segment register is presently being used for memory accesses as in below fig.

• These lines float to tri-state off during the local bus hold acknowledge. The status line S6 is always low .

• The address bit are separated from the status bit using latches controlled by the ALE signal.

Alternate DataStack

Code or noneData

Indication S4 S3

0011

0

01

1

Signal Description of 8086 (cont..)

Page 414: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 12

• BHE/S7 : The bus high enable is used to indicate the transfer of data over the higher order ( D15-D8 ) data bus as shown in table. It goes low for the data transfer over D15-D8 and is used to derive chip selects of odd address memory bank or peripherals. BHE is low during T1 for read, write and interrupt acknowledge cycles, whenever a byte is to be transferred on higher byte of data bus. The status information is available during T2, T3 and T4. The signal is active low and tristated during hold. It is low during T1 for the first pulse of the interrupt acknowledge cycle.

Upper byte from or to odd addressWhole word0

01

0

01

Lower byte from or to even addressUpper byte from or to even address

None

Indication BHE A0

1 1

Signal Description of 8086 (cont..)

Page 415: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 13

• RD – Read : This signal on low indicates the peripheral that the processor is performing s memory or I/O read operation. RD is active low and shows the state for T2, T3, Tw of any read cycle. The signal remains tristated during the hold acknowledge.

• READY : This is the acknowledgement from the slow device or memory that they have completed the data transfer. The signal made available by the devices is synchronized by the 8284A clock generator to provide ready input to the 8086. the signal is active high.

Signal Description of 8086 (cont..)

Page 416: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 14

• INTR-Interrupt Request : This is a triggered input. This is sampled during the last clock cycles of each instruction to determine the availability of the request. If any interrupt request is pending, the processor enters the interrupt acknowledge cycle.

• This can be internally masked by resulting the interrupt enable flag. This signal is active high and internally synchronized.

• TEST : This input is examined by a ‘WAIT’ instruction. If the TEST pin goes low, execution will continue, else the processor remains in an idle state. The input is synchronized internally during each clock cycle on leading edge of clock.

Signal Description of 8086 (cont..)

Page 417: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 15

• NMI- Nonmaskable interrupt : This is an edge triggered input which causes a Type 2 interrupt. The NMI is not maskable internally by software. A transition from low to high initiates the interrupt response at the end of the current instruction. This input is internally synchronized.

• RESET : This input causes the processor to terminate the current activity and start execution from FFF0H. The signal is active high and must be active for at least four clock cycles. It restarts execution when the RESET returns low. RESET is also internally synchronized.

• Vcc +5V power supply for the operation of the internal circuit.• GND ground for internal circuit.

Signal Description of 8086 (cont..)

Page 418: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 16

• CLK- Clock Input : The clock input provides the basic timing for processor operation and bus control activity. Its an asymmetric square wave with 33% duty cycle.

• MN/MX : The logic level at this pin decides whether the processor is to operate in either minimum or maximum mode.

• The following pin functions are for the minimum modeoperation of 8086.

• M/IO – Memory/IO : This is a status line logically equivalent to S2 in maximum mode. When it is low, it indicates the CPU is having an I/O operation, and when it is high, it indicates that the CPU is having a memory operation. This line becomes active high in the previous T4 and remains active till final T4 of the current cycle. It is tristated during local bus “hold acknowledge “.

Signal Description of 8086 (cont..)

Page 419: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 17

• INTA – Interrupt Acknowledge : This signal is used as a read strobe for interrupt acknowledge cycles. i.e. when it goes low, the processor has accepted the interrupt.

• ALE – Address Latch Enable : This output signal indicates the availability of the valid address on the address/data lines,and is connected to latch enable input of latches. This signal is active high and is never tristated.

• DT/R – Data Transmit/Receive: This output is used to decide the direction of data flow through the transreceivers (bidirectional buffers). When the processor sends out data, thissignal is high and when the processor is receiving data, this signal is low.

Signal Description of 8086 (cont..)

Page 420: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 18

• DEN – Data Enable : This signal indicates the availability of valid data over the address/data lines. It is used to enable thetransreceivers ( bidirectional buffers ) to separate the data from the multiplexed address/data signal. It is active from the middle of T2 until the middle of T4. This is tristated during ‘hold acknowledge’ cycle.

• HOLD, HLDA- Acknowledge : When the HOLD line goes high, it indicates to the processor that another master is requesting the bus access.

• The processor, after receiving the HOLD request, issues the hold acknowledge signal on HLDA pin, in the middle of the next clock cycle after completing the current bus cycle.

Signal Description of 8086 (cont..)

Page 421: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 19

• At the same time, the processor floats the local bus and control lines. When the processor detects the HOLD line low, it lowers the HLDA signal. HOLD is an asynchronous input, and is should be externally synchronized.

• If the DMA request is made while the CPU is performing a memory or I/O cycle, it will release the local bus during T4provided :

1. The request occurs on or before T2 state of the current cycle.2. The current cycle is not operating over the lower byte of a

word. 3. The current cycle is not the first acknowledge of an interrupt

acknowledge sequence.

Signal Description of 8086 (cont..)

Page 422: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 20

4. A Lock instruction is not being executed.• The following pin function are applicable for maximum

mode operation of 8086.• S2, S1, S0 – Status Lines : These are the status lines which

reflect the type of operation, being carried out by the processor. These become activity during T4 of the previous cycle and active during T1 and T2 of the current bus cycles.

1 1

S2 S1 S0 Indication0

1

000

111

1

11

1

1

1

00 0

0

0

000

Interrupt AcknowledgeRead I/O portWrite I/O portHaltCode Access

PassiveWrite memoryRead memory

1 1

Signal Description of 8086 (cont..)

Page 423: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 21

• LOCK : This output pin indicates that other system bus master will be prevented from gaining the system bus, while the LOCK signal is low.

• The LOCK signal is activated by the ‘LOCK’ prefix instruction and remains active until the completion of the next instruction. When the CPU is executing a critical instruction which requires the system bus, the LOCK prefix instruction ensures that other processors connected in the system will not gain the control of the bus.

• The 8086, while executing the prefixed instruction, asserts thebus lock signal output, which may be connected to an external bus controller.

Signal Description of 8086 (cont..)

Page 424: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 22

• QS1, QS0 – Queue Status: These lines give information about the status of the code-prefetch queue. These are active during the CLK cycle after while the queue operation is performed.

• This modification in a simple fetch and execute architecture of a conventional microprocessor offers an added advantage of pipelined processing of the instructions.

• The 8086 architecture has 6-byte instruction prefetch queue. Thus even the largest (6-bytes) instruction can be prefetched from the memory and stored in the prefetch. This results in a faster execution of the instructions.

• In 8085 an instruction is fetched, decoded and executed and only after the execution of this instruction, the next one is fetched.

Signal Description of 8086 (cont..)

Page 425: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 23

• By prefetching the instruction, there is a considerable speedingup in instruction execution in 8086. This is known as instruction pipelining.

• At the starting the CS:IP is loaded with the required address from which the execution is to be started. Initially, the queue will be empty an the microprocessor starts a fetch operation to bring one byte (the first byte) of instruction code, if the CS:IP address is odd or two bytes at a time, if the CS:IP address is even.

• The first byte is a complete opcode in case of some instruction (one byte opcode instruction) and is a part of opcode, in case of some instructions ( two byte opcode instructions), the remaining part of code lie in second byte.

Signal Description of 8086 (cont..)

Page 426: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 24

• But the first byte of an instruction is an opcode. When the first byte from the queue goes for decoding and interpretation, one byte in the queue becomes empty and subsequently the queue is updated.

• The microprocessor does not perform the next fetch operation till at least two bytes of instruction queue are emptied. The instruction execution cycle is never broken for fetch operation.After decoding the first byte, the decoding circuit decides whether the instruction is of single opcode byte or double opcode byte.

• If it is single opcode byte, the next bytes are treated as data bytes depending upon the decoded instruction length, otherwise, the next byte in the queue is treated as the second byte of the instruction opcode.

Signal Description of 8086 (cont..)

Page 427: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 25

• The second byte is then decoded in continuation with the first byte to decide the instruction length and the number of subsequent bytes to be treated as instruction data.

• The queue is updated after every byte is read from the queue but the fetch cycle is initiated by BIU only if at least two bytes of the queue are empty and the EU may be concurrently executing the fetched instructions.

• The next byte after the instruction is completed is again the first opcode byte of the next instruction. A similar procedure is repeated till the complete execution of the program.

Signal Description of 8086 (cont..)

Page 428: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 26

• The fetch operation of the next instruction is overlapped with the execution of the current instruction. As in the architecture, there are two separate units, namely Execution unit and Bus interface unit.

• While the execution unit is busy in executing an instruction, after it is completely decoded, the bus interface unit may be fetching the bytes of the next instruction from memory, depending upon the queue status.

QS1 QS0 Indication0

1 11

10

00

No operationFirst byte of the opcode from the queueEmpty queueSubsequent byte from the queue

Signal Description of 8086 (cont..)

Page 429: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 27

• RQ/GT0, RQ/GT1 – Request/Grant : These pins are used by the other local bus master in maximum mode, to force the processor to release the local bus at the end of the processor current bus cycle.

• Each of the pin is bidirectional with RQ/GT0 having higher priority than RQ/GT1.

• RQ/GT pins have internal pull-up resistors and may be left unconnected.

• Request/Grant sequence is as follows:1. A pulse of one clock wide from another bus master requests

the bus access to 8086.

Signal Description of 8086 (cont..)

Page 430: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 28

2. During T4(current) or T1(next) clock cycle, a pulse one clock wide from 8086 to the requesting master, indicates that the 8086 has allowed the local bus to float and that it will enter the ‘hold acknowledge’ state at next cycle. The CPU bus interface unit is likely to be disconnected from the local bus of the system.

3. A one clock wide pulse from the another master indicates to the 8086 that the hold request is about to end and the 8086 may regain control of the local bus at the next clock cycle. Thus each master to master exchange of the local bus is a sequence of 3 pulses. There must be at least one dead clock cycle after each bus exchange.

Signal Description of 8086 (cont..)

Page 431: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 29

• The request and grant pulses are active low.• For the bus request those are received while 8086 is

performing memory or I/O cycle, the granting of the bus is governed by the rules as in case of HOLD and HLDA in minimum mode.

Signal Description of 8086

Page 432: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 30

General Bus Operation

• The 8086 has a combined address and data bus commonly referred as a time multiplexed address and data bus.

• The main reason behind multiplexing address and data over the same pins is the maximum utilisation of processor pins and it facilitates the use of 40 pin standard DIP package.

• The bus can be demultiplexed using a few latches and transreceivers, when ever required.

• Basically, all the processor bus cycles consist of at least fourclock cycles. These are referred to as T1, T2, T3, T4. The address is transmitted by the processor during T1. It is present on the bus only for one cycle.

Page 433: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 31

• During T2, i.e. the next cycle, the bus is tristated for changing the direction of bus for the following data read cycle. The datatransfer takes place during T3, T4.

• In case, an address device is slow ‘NOT READY’ status the wait status Tw are inserted between T3 and T4. These clock states during wait period are called idle states (Ti), wait states(Tw) or inactive states. The processor used these cycles for internal housekeeping.

• The address latch enable (ALE) signal is emitted during T1 by the processor (minimum mode) or the bus controller (maximum mode) depending upon the status of the MN/MX input.

General Bus Operation ( cont..)

Page 434: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 32

• The negative edge of this ALE pulse is used to separate the address and the data or status information. In maximum mode, the status lines S0, S1 and S2 are used to indicate the type of operation.

• Status bits S3 to S7 are multiplexed with higher order address bits and the BHE signal. Address is valid during T1 while status bits S3 to S7 are valid during T2 through T4.

General Bus Operation ( cont..)

Page 435: uProccessors

M. Krishna Kumar MAM/M1/LU4/V1/2004 33

General Bus Operation Cycle in Maximum Mode

CLK

Memory read cycle Memory write cycleT1 T2 T3 Tw T4 T1 T2 T3 Tw T4

ALE

S2 – S0

Add/stat

WR

DEN

DT/R

READY

RD/INTA

Add/data

A19-A16 S3-S7 A19-A16 S3-S7

BHE BHE

A0-A15 D15-D0 A0-A15 D15-D0

Bus reserveData Out D15 – D0

Wait Wait

ReadyReady

Memory access time

for Data In

Page 436: uProccessors

September 1990 Order Number: 231455-005

808616-BIT HMOS MICROPROCESSOR

8086/8086-2/8086-1

Y Direct Addressing Capability 1 MByteof Memory

Y Architecture Designed for PowerfulAssembly Language and Efficient HighLevel Languages

Y 14 Word, by 16-Bit Register Set withSymmetrical Operations

Y 24 Operand Addressing Modes

Y Bit, Byte, Word, and Block Operations

Y 8 and 16-Bit Signed and UnsignedArithmetic in Binary or DecimalIncluding Multiply and Divide

Y Range of Clock Rates:5 MHz for 8086,8 MHz for 8086-2,

10 MHz for 8086-1

Y MULTIBUS System CompatibleInterface

Y Available in EXPRESSÐ Standard Temperature RangeÐ Extended Temperature Range

Y Available in 40-Lead Cerdip and PlasticPackage(See Packaging Spec. Order Ý231369)

The Intel 8086 high performance 16-bit CPU is available in three clock rates: 5, 8 and 10 MHz. The CPU isimplemented in N-Channel, depletion load, silicon gate technology (HMOS-III), and packaged in a 40-pinCERDIP or plastic package. The 8086 operates in both single processor and multiple processor configurationsto achieve high performance levels.

231455–1Figure 1. 8086 CPU Block Diagram

231455–2

40 Lead

Figure 2. 8086 Pin

Configuration

Page 437: uProccessors

8086

Table 1. Pin Description

The following pin function descriptions are for 8086 systems in either minimum or maximum mode. The ‘‘LocalBus’’ in these descriptions is the direct multiplexed bus interface connection to the 8086 (without regard toadditional bus buffers).

Symbol Pin No. Type Name and Function

AD15–AD0 2–16, 39 I/O ADDRESS DATA BUS: These lines constitute the time multiplexedmemory/IO address (T1), and data (T2, T3, TW, T4) bus. A0 isanalogous to BHE for the lower byte of the data bus, pins D7–D0. It isLOW during T1 when a byte is to be transferred on the lower portionof the bus in memory or I/O operations. Eight-bit oriented devices tiedto the lower half would normally use A0 to condition chip selectfunctions. (See BHE.) These lines are active HIGH and float to 3-stateOFF during interrupt acknowledge and local bus ‘‘hold acknowledge’’.

A19/S6, 35–38 O ADDRESS/STATUS: During T1 these are the four most significantaddress lines for memory operations. During I/O operations theseA18/S5,lines are LOW. During memory and I/O operations, status informationA17/S4,is available on these lines during T2, T3, TW, T4. The status of theA16/S3interrupt enable FLAG bit (S5) is updated at the beginning of eachCLK cycle. A17/S4 and A16/S3 are encoded as shown.

This information indicates which relocation register is presently beingused for data accessing.

These lines float to 3-state OFF during local bus ‘‘hold acknowledge.’’

A17/S4 A16/S3 Characteristics

0 (LOW) 0 Alternate Data

0 1 Stack

1 (HIGH) 0 Code or None

1 1 Data

S6 is 0

(LOW)

BHE/S7 34 O BUS HIGH ENABLE/STATUS: During T1 the bus high enable signal(BHE) should be used to enable data onto the most significant half ofthe data bus, pins D15–D8. Eight-bit oriented devices tied to the upperhalf of the bus would normally use BHE to condition chip selectfunctions. BHE is LOW during T1 for read, write, and interruptacknowledge cycles when a byte is to be transferred on the highportion of the bus. The S7 status information is available during T2,T3, and T4. The signal is active LOW, and floats to 3-state OFF in‘‘hold’’. It is LOW during T1 for the first interrupt acknowledge cycle.

BHE A0 Characteristics

0 0 Whole word

0 1 Upper byte from/to odd address

1 0 Lower byte from/to even address

1 1 None

RD 32 O READ: Read strobe indicates that the processor is performing amemory or I/O read cycle, depending on the state of the S2 pin. Thissignal is used to read devices which reside on the 8086 local bus. RDis active LOW during T2, T3 and TW of any read cycle, and isguaranteed to remain HIGH in T2 until the 8086 local bus has floated.

This signal floats to 3-state OFF in ‘‘hold acknowledge’’.

2

Page 438: uProccessors

8086

Table 1. Pin Description (Continued)

Symbol Pin No. Type Name and Function

READY 22 I READY: is the acknowledgement from the addressed memory or I/Odevice that it will complete the data transfer. The READY signal frommemory/IO is synchronized by the 8284A Clock Generator to formREADY. This signal is active HIGH. The 8086 READY input is notsynchronized. Correct operation is not guaranteed if the setup and holdtimes are not met.

INTR 18 I INTERRUPT REQUEST: is a level triggered input which is sampledduring the last clock cycle of each instruction to determine if theprocessor should enter into an interrupt acknowledge operation. Asubroutine is vectored to via an interrupt vector lookup table located insystem memory. It can be internally masked by software resetting theinterrupt enable bit. INTR is internally synchronized. This signal isactive HIGH.

TEST 23 I TEST: input is examined by the ‘‘Wait’’ instruction. If the TEST input isLOW execution continues, otherwise the processor waits in an ‘‘Idle’’state. This input is synchronized internally during each clock cycle onthe leading edge of CLK.

NMI 17 I NON-MASKABLE INTERRUPT: an edge triggered input which causesa type 2 interrupt. A subroutine is vectored to via an interrupt vectorlookup table located in system memory. NMI is not maskable internallyby software. A transition from LOW to HIGH initiates the interrupt at theend of the current instruction. This input is internally synchronized.

RESET 21 I RESET: causes the processor to immediately terminate its presentactivity. The signal must be active HIGH for at least four clock cycles. Itrestarts execution, as described in the Instruction Set description, whenRESET returns LOW. RESET is internally synchronized.

CLK 19 I CLOCK: provides the basic timing for the processor and bus controller.It is asymmetric with a 33% duty cycle to provide optimized internaltiming.

VCC 40 VCC: a5V power supply pin.

GND 1, 20 GROUND

MN/MX 33 I MINIMUM/MAXIMUM: indicates what mode the processor is tooperate in. The two modes are discussed in the following sections.

The following pin function descriptions are for the 8086/8288 system in maximum mode (i.e., MN/MX e VSS).Only the pin functions which are unique to maximum mode are described; all other pin functions are asdescribed above.

S2, S1, S0 26–28 O STATUS: active during T4, T1, and T2 and is returned to the passive state(1, 1, 1) during T3 or during TW when READY is HIGH. This status is usedby the 8288 Bus Controller to generate all memory and I/O access controlsignals. Any change by S2, S1, or S0 during T4 is used to indicate thebeginning of a bus cycle, and the return to the passive state in T3 or TW isused to indicate the end of a bus cycle.

3

Page 439: uProccessors

8086

Table 1. Pin Description (Continued)

Symbol Pin No. Type Name and Function

S2, S1, S0 26–28 O These signals float to 3-state OFF in ‘‘hold acknowledge’’. These statuslines are encoded as shown.(Continued)

S2 S1 S0 Characteristics

0 (LOW) 0 0 Interrupt Acknowledge

0 0 1 Read I/O Port

0 1 0 Write I/O Port

0 1 1 Halt

1 (HIGH) 0 0 Code Access

1 0 1 Read Memory

1 1 0 Write Memory

1 1 1 Passive

RQ/GT0, 30, 31 I/O REQUEST/GRANT: pins are used by other local bus masters to forcethe processor to release the local bus at the end of the processor’sRQ/GT1current bus cycle. Each pin is bidirectional with RQ/GT0 having higherpriority than RQ/GT1. RQ/GT pins have internal pull-up resistors andmay be left unconnected. The request/grant sequence is as follows(see Page 2-24):

1. A pulse of 1 CLK wide from another local bus master indicates a localbus request (‘‘hold’’) to the 8086 (pulse 1).

2. During a T4 or T1 clock cycle, a pulse 1 CLK wide from the 8086 tothe requesting master (pulse 2), indicates that the 8086 has allowed thelocal bus to float and that it will enter the ‘‘hold acknowledge’’ state atthe next CLK. The CPU’s bus interface unit is disconnected logicallyfrom the local bus during ‘‘hold acknowledge’’.

3. A pulse 1 CLK wide from the requesting master indicates to the 8086(pulse 3) that the ‘‘hold’’ request is about to end and that the 8086 canreclaim the local bus at the next CLK.

Each master-master exchange of the local bus is a sequence of 3pulses. There must be one dead CLK cycle after each bus exchange.Pulses are active LOW.

If the request is made while the CPU is performing a memory cycle, itwill release the local bus during T4 of the cycle when all the followingconditions are met:

1. Request occurs on or before T2.

2. Current cycle is not the low byte of a word (on an odd address).

3. Current cycle is not the first acknowledge of an interrupt acknowledgesequence.

4. A locked instruction is not currently executing.

If the local bus is idle when the request is made the two possible eventswill follow:

1. Local bus will be released during the next clock.

2. A memory cycle will start within 3 clocks. Now the four rules for acurrently active memory cycle apply with condition number 1 alreadysatisfied.

LOCK 29 O LOCK: output indicates that other system bus masters are not to gaincontrol of the system bus while LOCK is active LOW. The LOCK signalis activated by the ‘‘LOCK’’ prefix instruction and remains active until thecompletion of the next instruction. This signal is active LOW, and floatsto 3-state OFF in ‘‘hold acknowledge’’.

4

Page 440: uProccessors

8086

Table 1. Pin Description (Continued)

Symbol Pin No. Type Name and Function

QS1, QS0 24, 25 O QUEUE STATUS: The queue status is valid during the CLK cycle afterwhich the queue operation is performed.

QS1 and QS0 provide status to allow external tracking of the internal8086 instruction queue.

QS1 QS0 Characteristics

0 (LOW) 0 No Operation

0 1 First Byte of Op Code from Queue

1 (HIGH) 0 Empty the Queue

1 1 Subsequent Byte from Queue

The following pin function descriptions are for the 8086 in minimum mode (i.e., MN/MX e VCC). Only the pinfunctions which are unique to minimum mode are described; all other pin functions are as described above.

M/IO 28 O STATUS LINE: logically equivalent to S2 in the maximum mode. It is used todistinguish a memory access from an I/O access. M/IO becomes valid inthe T4 preceding a bus cycle and remains valid until the final T4 of the cycle(M e HIGH, IO e LOW). M/IO floats to 3-state OFF in local bus ‘‘holdacknowledge’’.

WR 29 O WRITE: indicates that the processor is performing a write memory or writeI/O cycle, depending on the state of the M/IO signal. WR is active for T2, T3and TW of any write cycle. It is active LOW, and floats to 3-state OFF inlocal bus ‘‘hold acknowledge’’.

INTA 24 O INTA: is used as a read strobe for interrupt acknowledge cycles. It is activeLOW during T2, T3 and TW of each interrupt acknowledge cycle.

ALE 25 O ADDRESS LATCH ENABLE: provided by the processor to latch theaddress into the 8282/8283 address latch. It is a HIGH pulse active duringT1 of any bus cycle. Note that ALE is never floated.

DT/R 27 O DATA TRANSMIT/RECEIVE: needed in minimum system that desires touse an 8286/8287 data bus transceiver. It is used to control the direction ofdata flow through the transceiver. Logically DT/R is equivalent to S1 in themaximum mode, and its timing is the same as for M/IO. (T e HIGH, R e

LOW.) This signal floats to 3-state OFF in local bus ‘‘hold acknowledge’’.

DEN 26 O DATA ENABLE: provided as an output enable for the 8286/8287 in aminimum system which uses the transceiver. DEN is active LOW duringeach memory and I/O access and for INTA cycles. For a read or INTA cycleit is active from the middle of T2 until the middle of T4, while for a write cycleit is active from the beginning of T2 until the middle of T4. DEN floats to 3-state OFF in local bus ‘‘hold acknowledge’’.

HOLD, 31, 30 I/O HOLD: indicates that another master is requesting a local bus ‘‘hold.’’ To beacknowledged, HOLD must be active HIGH. The processor receiving theHLDA‘‘hold’’ request will issue HLDA (HIGH) as an acknowledgement in themiddle of a T4 or Ti clock cycle. Simultaneous with the issuance of HLDAthe processor will float the local bus and control lines. After HOLD isdetected as being LOW, the processor will LOWer the HLDA, and when theprocessor needs to run another cycle, it will again drive the local bus andcontrol lines. Hold acknowledge (HLDA) and HOLD have internal pull-upresistors.

The same rules as for RQ/GT apply regarding when the local bus will bereleased.

HOLD is not an asynchronous input. External synchronization should beprovided if the system cannot otherwise guarantee the setup time.

5

Page 441: uProccessors

8086

FUNCTIONAL DESCRIPTION

General Operation

The internal functions of the 8086 processor arepartitioned logically into two processing units. Thefirst is the Bus Interface Unit (BIU) and the second isthe Execution Unit (EU) as shown in the block dia-gram of Figure 1.

These units can interact directly but for the mostpart perform as separate asynchronous operationalprocessors. The bus interface unit provides the func-tions related to instruction fetching and queuing, op-erand fetch and store, and address relocation. Thisunit also provides the basic bus control. The overlapof instruction pre-fetching provided by this unitserves to increase processor performance throughimproved bus bandwidth utilization. Up to 6 bytes ofthe instruction stream can be queued while waitingfor decoding and execution.

The instruction stream queuing mechanism allowsthe BIU to keep the memory utilized very efficiently.Whenever there is space for at least 2 bytes in thequeue, the BIU will attempt a word fetch memorycycle. This greatly reduces ‘‘dead time’’ on thememory bus. The queue acts as a First-In-First-Out(FIFO) buffer, from which the EU extracts instructionbytes as required. If the queue is empty (following abranch instruction, for example), the first byte intothe queue immediately becomes available to the EU.

The execution unit receives pre-fetched instructionsfrom the BIU queue and provides un-relocated oper-and addresses to the BIU. Memory operands arepassed through the BIU for processing by the EU,which passes results to the BIU for storage. See theInstruction Set description for further register setand architectural descriptions.

MEMORY ORGANIZATION

The processor provides a 20-bit address to memorywhich locates the byte being referenced. The memo-ry is organized as a linear array of up to 1 million

bytes, addressed as 00000(H) to FFFFF(H). Thememory is logically divided into code, data, extradata, and stack segments of up to 64K bytes each,with each segment falling on 16-byte boundaries.(See Figure 3a.)

All memory references are made relative to base ad-dresses contained in high speed segment registers.The segment types were chosen based on the ad-dressing needs of programs. The segment registerto be selected is automatically chosen according tothe rules of the following table. All information in onesegment type share the same logical attributes (e.g.code or data). By structuring memory into relocat-able areas of similar characteristics and by automati-cally selecting segment registers, programs areshorter, faster, and more structured.

Word (16-bit) operands can be located on even orodd address boundaries and are thus not con-strained to even boundaries as is the case in many16-bit computers. For address and data operands,the least significant byte of the word is stored in thelower valued address location and the most signifi-cant byte in the next higher address location. TheBIU automatically performs the proper number ofmemory accesses, one if the word operand is on aneven byte boundary and two if it is on an odd byteboundary. Except for the performance penalty, thisdouble access is transparent to the software. Thisperformance penalty does not occur for instructionfetches, only word operands.

Physically, the memory is organized as a high bank(D15–D8) and a low bank (D7–D0) of 512K 8-bitbytes addressed in parallel by the processor’s ad-dress lines A19–A1. Byte data with even addressesis transferred on the D7–D0 bus lines while odd ad-dressed byte data (A0 HIGH) is transferred on theD15–D8 bus lines. The processor provides two en-able signals, BHE and A0, to selectively allow read-ing from or writing into either an odd byte location,even byte location, or both. The instruction stream isfetched from memory as words and is addressedinternally by the processor to the byte level as nec-essary.

Memory Segment Register Segment

Reference Need Used Selection Rule

Instructions CODE (CS) Automatic with all instruction prefetch.

Stack STACK (SS) All stack pushes and pops. Memory references relative to BP

base register except data references.

Local Data DATA (DS) Data references when: relative to stack, destination of string

operation, or explicitly overridden.

External (Global) Data EXTRA (ES) Destination of string operations: explicitly selected using a

segment override.

6

Page 442: uProccessors

8086

231455–3

Figure 3a. Memory Organization

In referencing word data the BIU requires one or twomemory cycles depending on whether or not thestarting byte of the word is on an even or odd ad-dress, respectively. Consequently, in referencingword operands performance can be optimized by lo-cating data on even address boundaries. This is anespecially useful technique for using the stack, sinceodd address references to the stack may adverselyaffect the context switching time for interrupt pro-cessing or task multiplexing.

231455–4

Figure 3b. Reserved Memory Locations

Certain locations in memory are reserved for specificCPU operations (see Figure 3b). Locations from

address FFFF0H through FFFFFH are reserved foroperations including a jump to the initial programloading routine. Following RESET, the CPU will al-ways begin execution at location FFFF0H where thejump must be. Locations 00000H through 003FFHare reserved for interrupt operations. Each of the256 possible interrupt types has its service routinepointed to by a 4-byte pointer element consisting ofa 16-bit segment address and a 16-bit offset ad-dress. The pointer elements are assumed to havebeen stored at the respective places in reservedmemory prior to occurrence of interrupts.

MINIMUM AND MAXIMUM MODES

The requirements for supporting minimum and maxi-mum 8086 systems are sufficiently different thatthey cannot be done efficiently with 40 uniquely de-fined pins. Consequently, the 8086 is equipped witha strap pin (MN/MX) which defines the system con-figuration. The definition of a certain subset of thepins changes dependent on the condition of thestrap pin. When MN/MX pin is strapped to GND, the8086 treats pins 24 through 31 in maximum mode.An 8288 bus controller interprets status informationcoded into S0, S2, S2 to generate bus timing andcontrol signals compatible with the MULTIBUS ar-chitecture. When the MN/MX pin is strapped to VCC,the 8086 generates bus control signals itself on pins24 through 31, as shown in parentheses in Figure 2.Examples of minimum mode and maximum modesystems are shown in Figure 4.

BUS OPERATION

The 8086 has a combined address and data buscommonly referred to as a time multiplexed bus.This technique provides the most efficient use ofpins on the processor while permitting the use of astandard 40-lead package. This ‘‘local bus’’ can bebuffered directly and used throughout the systemwith address latching provided on memory and I/Omodules. In addition, the bus can also be demulti-plexed at the processor with a single set of addresslatches if a standard non-multiplexed bus is desiredfor the system.

Each processor bus cycle consists of at least fourCLK cycles. These are referred to as T1, T2, T3 andT4 (see Figure 5). The address is emitted from theprocessor during T1 and data transfer occurs on thebus during T3 and T4. T2 is used primarily for chang-ing the direction of the bus during read operations. Inthe event that a ‘‘NOT READY’’ indication is givenby the addressed device, ‘‘Wait’’ states (TW) are in-serted between T3 and T4. Each inserted ‘‘Wait’’state is of the same duration as a CLK cycle. Periods

7

Page 443: uProccessors

8086

231455–5

Figure 4a. Minimum Mode 8086 Typical Configuration

231455–6

Figure 4b. Maximum Mode 8086 Typical Configuration

8

Page 444: uProccessors

8086

can occur between 8086 bus cycles. These are re-ferred to as ‘‘Idle’’ states (Ti) or inactive CLK cycles.The processor uses these cycles for internal house-keeping.

During T1 of any bus cycle the ALE (Address LatchEnable) signal is emitted (by either the processor orthe 8288 bus controller, depending on the MN/MXstrap). At the trailing edge of this pulse, a valid ad-dress and certain status information for the cyclemay be latched.

Status bits S0, S1, and S2 are used, in maximummode, by the bus controller to identify the type ofbus transaction according to the following table:

S2 S1 S0 Characteristics

0 (LOW) 0 0 Interrupt Acknowledge

0 0 1 Read I/O

0 1 0 Write I/O

0 1 1 Halt

1 (HIGH) 0 0 Instruction Fetch

1 0 1 Read Data from Memory

1 1 0 Write Data to Memory

1 1 1 Passive (no bus cycle)

231455–8

Figure 5. Basic System Timing

9

Page 445: uProccessors

8086

Status bits S3 through S7 are multiplexed with high-order address bits and the BHE signal, and aretherefore valid during T2 through T4. S3 and S4 indi-cate which segment register (see Instruction Set de-scription) was used for this bus cycle in forming theaddress, according to the following table:

S4 S3 Characteristics

0 (LOW) 0 Alternate Data (extra segment)

0 1 Stack

1 (HIGH) 0 Code or None

1 1 Data

S5 is a reflection of the PSW interrupt enable bit.S6 e 0 and S7 is a spare status bit.

I/O ADDRESSING

In the 8086, I/O operations can address up to amaximum of 64K I/O byte registers or 32K I/O wordregisters. The I/O address appears in the same for-mat as the memory address on bus lines A15–A0.The address lines A19–A16 are zero in I/O opera-tions. The variable I/O instructions which use regis-ter DX as a pointer have full address capability whilethe direct I/O instructions directly address one ortwo of the 256 I/O byte locations in page 0 of theI/O address space.

I/O ports are addressed in the same manner asmemory locations. Even addressed bytes are trans-ferred on the D7–D0 bus lines and odd addressedbytes on D15–D8. Care must be taken to assure thateach register within an 8-bit peripheral located onthe lower portion of the bus be addressed as even.

External Interface

PROCESSOR RESET AND INITIALIZATION

Processor initialization or start up is accomplishedwith activation (HIGH) of the RESET pin. The 8086RESET is required to be HIGH for greater than 4CLK cycles. The 8086 will terminate operations onthe high-going edge of RESET and will remain dor-mant as long as RESET is HIGH. The low-goingtransition of RESET triggers an internal reset se-quence for approximately 10 CLK cycles. After thisinterval the 8086 operates normally beginning withthe instruction in absolute location FFFF0H (see Fig-ure 3b). The details of this operation are specified inthe Instruction Set description of the MCS-86 FamilyUser’s Manual. The RESET input is internally syn-chronized to the processor clock. At initialization theHIGH-to-LOW transition of RESET must occur nosooner than 50 ms after power-up, to allow completeinitialization of the 8086.

NMI asserted prior to the 2nd clock after the end ofRESET will not be honored. If NMI is asserted afterthat point and during the internal reset sequence,the processor may execute one instruction beforeresponding to the interrupt. A hold request activeimmediately after RESET will be honored before thefirst instruction fetch.

All 3-state outputs float to 3-state OFF duringRESET. Status is active in the idle state for the firstclock after RESET becomes active and then floatsto 3-state OFF. ALE and HLDA are driven low.

INTERRUPT OPERATIONS

Interrupt operations fall into two classes; software orhardware initiated. The software initiated interruptsand software aspects of hardware interrupts arespecified in the Instruction Set description. Hard-ware interrupts can be classified as non-maskable ormaskable.

Interrupts result in a transfer of control to a new pro-gram location. A 256-element table containing ad-dress pointers to the interrupt service program loca-tions resides in absolute locations 0 through 3FFH(see Figure 3b), which are reserved for this purpose.Each element in the table is 4 bytes in size andcorresponds to an interrupt ‘‘type’’. An interruptingdevice supplies an 8-bit type number, during the in-terrupt acknowledge sequence, which is used to‘‘vector’’ through the appropriate element to the newinterrupt service program location.

NON-MASKABLE INTERRUPT (NMI)

The processor provides a single non-maskable inter-rupt pin (NMI) which has higher priority than themaskable interrupt request pin (INTR). A typical usewould be to activate a power failure routine. TheNMI is edge-triggered on a LOW-to-HIGH transition.The activation of this pin causes a type 2 interrupt.(See Instruction Set description.)

NMI is required to have a duration in the HIGH stateof greater than two CLK cycles, but is not required tobe synchronized to the clock. Any high-going tran-sition of NMI is latched on-chip and will be servicedat the end of the current instruction or betweenwhole moves of a block-type instruction. Worst caseresponse to NMI would be for multiply, divide, andvariable shift instructions. There is no specificationon the occurrence of the low-going edge; it may oc-cur before, during, or after the servicing of NMI. An-other high-going edge triggers another response if itoccurs after the start of the NMI procedure. The sig-nal must be free of logical spikes in general and befree of bounces on the low-going edge to avoid trig-gering extraneous responses.

10

Page 446: uProccessors

8086

MASKABLE INTERRUPT (INTR)

The 8086 provides a single interrupt request input(INTR) which can be masked internally by softwarewith the resetting of the interrupt enable FLAGstatus bit. The interrupt request signal is level trig-gered. It is internally synchronized during each clockcycle on the high-going edge of CLK. To be re-sponded to, INTR must be present (HIGH) duringthe clock period preceding the end of the currentinstruction or the end of a whole move for a block-type instruction. During the interrupt response se-quence further interrupts are disabled. The enablebit is reset as part of the response to any interrupt(INTR, NMI, software interrupt or single-step), al-though the FLAGS register which is automaticallypushed onto the stack reflects the state of the proc-essor prior to the interrupt. Until the old FLAGS reg-ister is restored the enable bit will be zero unlessspecifically set by an instruction.

During the response sequence (Figure 6) the proc-essor executes two successive (back-to-back) inter-rupt acknowledge cycles. The 8086 emits the LOCKsignal from T2 of the first bus cycle until T2 of thesecond. A local bus ‘‘hold’’ request will not be hon-ored until the end of the second bus cycle. In thesecond bus cycle a byte is fetched from the externalinterrupt system (e.g., 8259A PIC) which identifiesthe source (type) of the interrupt. This byte is multi-plied by four and used as a pointer into the interruptvector lookup table. An INTR signal left HIGH will becontinually responded to within the limitations of theenable bit and sample period. The INTERRUPT RE-TURN instruction includes a FLAGS pop which re-turns the status of the original interrupt enable bitwhen it restores the FLAGS.

HALT

When a software ‘‘HALT’’ instruction is executed theprocessor indicates that it is entering the ‘‘HALT’’state in one of two ways depending upon whichmode is strapped. In minimum mode, the processorissues one ALE with no qualifying bus control sig-nals. In maximum mode, the processor issues ap-propriate HALT status on S2, S1, and S0; and the8288 bus controller issues one ALE. The 8086 willnot leave the ‘‘HALT’’ state when a local bus ‘‘hold’’is entered while in ‘‘HALT’’. In this case, the proces-sor reissues the HALT indicator. An interrupt requestor RESET will force the 8086 out of the ‘‘HALT’’state.

READ/MODIFY/WRITE (SEMAPHORE)OPERATIONS VIA LOCK

The LOCK status information is provided by theprocessor when directly consecutive bus cycles arerequired during the execution of an instruc-tion. This provides the processor with the capabilityof performing read/modify/write operations onmemory (via the Exchange Register With Memoryinstruction, for example) without the possibility of an-other system bus master receiving intervening mem-ory cycles. This is useful in multi-processor systemconfigurations to accomplish ‘‘test and set lock’’ op-erations. The LOCK signal is activated (forced LOW)in the clock cycle following the one in which the soft-ware ‘‘LOCK’’ prefix instruction is decoded by theEU. It is deactivated at the end of the last bus cycleof the instruction following the ‘‘LOCK’’ prefix in-struction. While LOCK is active a request on a RQ/GT pin will be recorded and then honored at the endof the LOCK.

231455–9

Figure 6. Interrupt Acknowledge Sequence

11

Page 447: uProccessors

8086

EXTERNAL SYNCHRONIZATION VIA TEST

As an alternative to the interrupts and general I/Ocapabilities, the 8086 provides a single software-testable input known as the TEST signal. At any timethe program may execute a WAIT instruction. If atthat time the TEST signal is inactive (HIGH), pro-gram execution becomes suspended while the proc-essor waits for TEST to become active. It mustremain active for at least 5 CLK cycles. The WAITinstruction is re-executed repeatedly until that time.This activity does not consume bus cycles. Theprocessor remains in an idle state while waiting. All8086 drivers go to 3-state OFF if bus ‘‘Hold’’ is en-tered. If interrupts are enabled, they may occur whilethe processor is waiting. When this occurs the proc-essor fetches the WAIT instruction one extra time,processes the interrupt, and then re-fetches and re-executes the WAIT instruction upon returning fromthe interrupt.

Basic System Timing

Typical system configurations for the processor op-erating in minimum mode and in maximum mode areshown in Figures 4a and 4b, respectively. In mini-mum mode, the MN/MX pin is strapped to VCC andthe processor emits bus control signals in a mannersimilar to the 8085. In maximum mode, the MN/MXpin is strapped to VSS and the processor emits cod-ed status information which the 8288 bus controlleruses to generate MULTIBUS compatible bus controlsignals. Figure 5 illustrates the signal timing relation-ships.

231455–10

Figure 7. 8086 Register Model

SYSTEM TIMINGÐMINIMUM SYSTEM

The read cycle begins in T1 with the assertion of theAddress Latch Enable (ALE) signal. The trailing (low-going) edge of this signal is used to latch the ad-dress information, which is valid on the local bus atthis time, into the address latch. The BHE and A0signals address the low, high, or both bytes. From T1to T4 the M/IO signal indicates a memory or I/Ooperation. At T2 the address is removed from thelocal bus and the bus goes to a high impedancestate. The read control signal is also asserted at T2.The read (RD) signal causes the addressed deviceto enable its data bus drivers to the local bus. Sometime later valid data will be available on the bus andthe addressed device will drive the READY lineHIGH. When the processor returns the read signal toa HIGH level, the addressed device will again 3-state its bus drivers. If a transceiver is required tobuffer the 8086 local bus, signals DT/R and DENare provided by the 8086.

A write cycle also begins with the assertion of ALEand the emission of the address. The M/IO signal isagain asserted to indicate a memory or I/O writeoperation. In the T2 immediately following the ad-dress emission the processor emits the data to bewritten into the addressed location. This data re-mains valid until the middle of T4. During T2, T3, andTW the processor asserts the write control signal.The write (WR) signal becomes active at the begin-ning of T2 as opposed to the read which is delayedsomewhat into T2 to provide time for the bus to float.

The BHE and A0 signals are used to select the prop-er byte(s) of the memory/IO word to be read or writ-ten according to the following table:

BHE A0 Characteristics

0 0 Whole word

0 1 Upper byte from/to

odd address

1 0 Lower byte from/to

even address

1 1 None

I/O ports are addressed in the same manner asmemory location. Even addressed bytes are trans-ferred on the D7–D0 bus lines and odd addressedbytes on D15–D8.

The basic difference between the interrupt acknowl-edge cycle and a read cycle is that the interrupt ac-knowledge signal (INTA) is asserted in place of theread (RD) signal and the address bus is floated.(See Figure 6.) In the second of two successiveINTA cycles, a byte of information is read from bus

12

Page 448: uProccessors

8086

lines D7–D0 as supplied by the inerrupt system logic(i.e., 8259A Priority Interrupt Controller). This byteidentifies the source (type) of the interrupt. It is multi-plied by four and used as a pointer into an interruptvector lookup table, as described earlier.

BUS TIMINGÐMEDIUM SIZE SYSTEMS

For medium size systems the MN/MX pin is con-nected to VSS and the 8288 Bus Controller is addedto the system as well as a latch for latching the sys-tem address, and a transceiver to allow for bus load-ing greater than the 8086 is capable of handling.Signals ALE, DEN, and DT/R are generated by the8288 instead of the processor in this configurationalthough their timing remains relatively the same.The 8086 status outputs (S2, S1, and S0) providetype-of-cycle information and become 8288 inputs.This bus cycle information specifies read (code,data, or I/O), write (data or I/O), interrupt

acknowledge, or software halt. The 8288 thus issuescontrol signals specifying memory read or write, I/Oread or write, or interrupt acknowledge. The 8288provides two types of write strobes, normal and ad-vanced, to be applied as required. The normal writestrobes have data valid at the leading edge of write.The advanced write strobes have the same timingas read strobes, and hence data isn’t valid at theleading edge of write. The transceiver receives theusual DIR and G inputs from the 8288’s DT/R andDEN.

The pointer into the interrupt vector table, which ispassed during the second INTA cycle, can derivefrom an 8259A located on either the local bus or thesystem bus. If the master 8259A Priority InterruptController is positioned on the local bus, a TTL gateis required to disable the transceiver when readingfrom the master 8259A during the interrupt acknowl-edge sequence and software ‘‘poll’’.

13

Page 449: uProccessors

8086

ABSOLUTE MAXIMUM RATINGS*

Ambient Temperature Under Bias ÀÀÀÀÀÀ0§C to 70§CStorage Temperature ÀÀÀÀÀÀÀÀÀÀb65§C to a150§CVoltage on Any Pin with

Respect to GroundÀÀÀÀÀÀÀÀÀÀÀÀÀÀb1.0V to a7V

Power DissipationÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀÀ2.5W

NOTICE: This is a production data sheet. The specifi-cations are subject to change without notice.

*WARNING: Stressing the device beyond the ‘‘AbsoluteMaximum Ratings’’ may cause permanent damage.These are stress ratings only. Operation beyond the‘‘Operating Conditions’’ is not recommended and ex-tended exposure beyond the ‘‘Operating Conditions’’may affect device reliability.

D.C. CHARACTERISTICS (8086: TA e 0§C to 70§C, VCC e 5V g10%)

(8086-1: TA e 0§C to 70§C, VCC e 5V g5%)

(8086-2: TA e 0§C to 70§C, VCC e 5V g5%)

Symbol Parameter Min Max Units Test Conditions

VIL Input Low Voltage b0.5 a0.8 V (Note 1)

VIH Input High Voltage 2.0 VCC a 0.5 V (Notes 1, 2)

VOL Output Low Voltage 0.45 V IOL e 2.5 mA

VOH Output High Voltage 2.4 V IOH e b 400 mA

ICC Power Supply Current: 8086 340

8086-1 360 mA TA e 25§C8086-2 350

ILI Input Leakage Current g10 mA 0V s VIN s VCC (Note 3)

ILO Output Leakage Current g10 mA 0.45V s VOUT s VCC

VCL Clock Input Low Voltage b0.5 a0.6 V

VCH Clock Input High Voltage 3.9 VCC a 1.0 V

CIN Capacitance of Input Buffer 15 pF fc e 1 MHz

(All input except

AD0–AD15, RQ/GT)

CIO Capacitance of I/O Buffer 15 pF fc e 1 MHz

(AD0–AD15, RQ/GT)

NOTES:1. VIL tested with MN/MX Pin e 0V. VIH tested with MN/MX Pin e 5V. MN/MX Pin is a Strap Pin.2. Not applicable to RQ/GT0 and RQ/GT1 (Pins 30 and 31).3. HOLD and HLDA ILI min e 30 mA, max e 500 mA.

14

Page 450: uProccessors

8086

A.C. CHARACTERISTICS (8086: TA e 0§C to 70§C, VCC e 5V g 10%)

(8086-1: TA e 0§C to 70§C, VCC e 5V g 5%)

(8086-2: TA e 0§C to 70§C, VCC e 5V g 5%)

MINIMUM COMPLEXITY SYSTEM TIMING REQUIREMENTS

Symbol Parameter8086 8086-1 8086-2

Units Test ConditionsMin Max Min Max Min Max

TCLCL CLK Cycle Period 200 500 100 500 125 500 ns

TCLCH CLK Low Time 118 53 68 ns

TCHCL CLK High Time 69 39 44 ns

TCH1CH2 CLK Rise Time 10 10 10 ns From 1.0V to 3.5V

TCL2CL1 CLK Fall Time 10 10 10 ns From 3.5V to 1.0V

TDVCL Data in Setup Time 30 5 20 ns

TCLDX Data in Hold Time 10 10 10 ns

TR1VCL RDY Setup Time 35 35 35 ns

into 8284A (See

Notes 1, 2)

TCLR1X RDY Hold Time 0 0 0 ns

into 8284A (See

Notes 1, 2)

TRYHCH READY Setup 118 53 68 ns

Time into 8086

TCHRYX READY Hold Time 30 20 20 ns

into 8086

TRYLCL READY Inactive to b8 b10 b8 ns

CLK (See Note 3)

THVCH HOLD Setup Time 35 20 20 ns

TINVCH INTR, NMI, TEST 30 15 15 ns

Setup Time (See

Note 2)

TILIH Input Rise Time 20 20 20 ns From 0.8V to 2.0V

(Except CLK)

TIHIL Input Fall Time 12 12 12 ns From 2.0V to 0.8V

(Except CLK)

15

Page 451: uProccessors

8086

A.C. CHARACTERISTICS (Continued)

TIMING RESPONSES

Symbol Parameter8086 8086-1 8086-2

Units Test

Min Max Min Max Min Max Conditions

TCLAV Address Valid Delay 10 110 10 50 10 60 ns

TCLAX Address Hold Time 10 10 10 ns

TCLAZ Address Float TCLAX 80 10 40 TCLAX 50 ns

Delay

TLHLL ALE Width TCLCH-20 TCLCH-10 TCLCH-10 ns

TCLLH ALE Active Delay 80 40 50 ns

TCHLL ALE Inactive Delay 85 45 55 ns

TLLAX Address Hold Time TCHCL-10 TCHCL-10 TCHCL-10 ns

TCLDV Data Valid Delay 10 110 10 50 10 60 ns *CL e 20–100 pFfor all 8086

TCHDX Data Hold Time 10 10 10 nsOutputs (Inaddition to 8086TWHDX Data Hold Time TCLCH-30 TCLCH-25 TCLCH-30 nsselfload)After WR

TCVCTV Control Active 10 110 10 50 10 70 ns

Delay 1

TCHCTV Control Active 10 110 10 45 10 60 ns

Delay 2

TCVCTX Control Inactive 10 110 10 50 10 70 ns

Delay

TAZRL Address Float to 0 0 0 ns

READ Active

TCLRL RD Active Delay 10 165 10 70 10 100 ns

TCLRH RD Inactive Delay 10 150 10 60 10 80 ns

TRHAV RD Inactive to Next TCLCL-45 TCLCL-35 TCLCL-40 ns

Address Active

TCLHAV HLDA Valid Delay 10 160 10 60 10 100 ns

TRLRH RD Width 2TCLCL-75 2TCLCL-40 2TCLCL-50 ns

TWLWH WR Width 2TCLCL-60 2TCLCL-35 2TCLCL-40 ns

TAVAL Address Valid to TCLCH-60 TCLCH-35 TCLCH-40 ns

ALE Low

TOLOH Output Rise Time 20 20 20 ns From 0.8V to 2.0V

TOHOL Output Fall Time 12 12 12 ns From 2.0V to 0.8V

NOTES:1. Signal at 8284A shown for reference only.2. Setup requirement for asynchronous signal only to guarantee recognition at next CLK.3. Applies only to T2 state. (8 ns into T3).

16

Page 452: uProccessors

8086

A.C. TESTING INPUT, OUTPUT WAVEFORM

231455-11

A.C. Testing: Inputs are driven at 2.4V for a Logic ‘‘1’’ and 0.45Vfor a Logic ‘‘0’’. Timing measurements are made at 1.5V for botha Logic ‘‘1’’ and ‘‘0’’.

A.C. TESTING LOAD CIRCUIT

231455–12

CL Includes Jig Capacitance

WAVEFORMS

MINIMUM MODE

231455–13

17

Page 453: uProccessors

8086

WAVEFORMS (Continued)

MINIMUM MODE (Continued)

231455–14SOFTWARE HALTÐRD, WR, INTA e VOHDT/R e INDETERMINATE

NOTES:1. All signals switch between VOH and VOL unless otherwise specified.2. RDY is sampled near the end of T2, T3, TW to determine if TW machines states are to be inserted.3. Two INTA cycles run back-to-back. The 8086 LOCAL ADDR/DATA BUS is floating during both INTA cycles. Controlsignals shown for second INTA cycle.4. Signals at 8284A are shown for reference only.5. All timing measurements are made at 1.5V unless otherwise noted.

18

Page 454: uProccessors

8086

A.C. CHARACTERISTICS

MAX MODE SYSTEM (USING 8288 BUS CONTROLLER)TIMING REQUIREMENTS

Symbol Parameter8086 8086-1 8086-2

Units Test

Min Max Min Max Min Max Conditions

TCLCL CLK Cycle Period 200 500 100 500 125 500 ns

TCLCH CLK Low Time 118 53 68 ns

TCHCL CLK High Time 69 39 44 ns

TCH1CH2 CLK Rise Time 10 10 10 ns From 1.0V to 3.5V

TCL2CL1 CLK Fall Time 10 10 10 ns From 3.5V to 1.0V

TDVCL Data in Setup Time 30 5 20 ns

TCLDX Data in Hold Time 10 10 10 ns

TR1VCL RDY Setup Time 35 35 35 ns

into 8284A

(Notes 1, 2)

TCLR1X RDY Hold Time 0 0 0 ns

into 8284A

(Notes 1, 2)

TRYHCH READY Setup 118 53 68 ns

Time into 8086

TCHRYX READY Hold Time 30 20 20 ns

into 8086

TRYLCL READY Inactive to b8 b10 b8 ns

CLK (Note 4)

TINVCH Setup Time for 30 15 15 ns

Recognition (INTR,

NMI, TEST)

(Note 2)

TGVCH RQ/GT Setup Time 30 15 15 ns

(Note 5)

TCHGX RQ Hold Time into 40 20 30 ns

8086

TILIH Input Rise Time 20 20 20 ns From 0.8V to 2.0V

(Except CLK)

TIHIL Input Fall Time 12 12 12 ns From 2.0V to 0.8V

(Except CLK)

19

Page 455: uProccessors

8086

A.C. CHARACTERISTICS (Continued)

TIMING RESPONSES

Symbol Parameter8086 8086-1 8086-2

Units Test

Min Max Min Max Min Max Conditions

TCLML Command Active 10 35 10 35 10 35 ns

Delay (See Note 1)

TCLMH Command Inactive 10 35 10 35 10 35 ns

Delay (See Note 1)

TRYHSH READY Active to 110 45 65 ns

Status Passive (See

Note 3)

TCHSV Status Active Delay 10 110 10 45 10 60 ns

TCLSH Status Inactive 10 130 10 55 10 70 ns

Delay

TCLAV Address Valid Delay 10 110 10 50 10 60 ns

TCLAX Address Hold Time 10 10 10 ns

TCLAZ Address Float Delay TCLAX 80 10 40 TCLAX 50 ns

TSVLH Status Valid to ALE 15 15 15 ns

High (See Note 1)

TSVMCH Status Valid to 15 15 15 ns

MCE High (See

Note 1)

TCLLH CLK Low to ALE 15 15 15 ns CL e 20–100 pFfor all 8086Valid (See Note 1)Outputs (In

TCLMCH CLK Low to MCE 15 15 15 ns addition to 8086High (See Note 1) self-load)

TCHLL ALE Inactive Delay 15 15 15 ns

(See Note 1)

TCLMCL MCE Inactive Delay 15 15 15 ns

(See Note 1)

TCLDV Data Valid Delay 10 110 10 50 10 60 ns

TCHDX Data Hold Time 10 10 10 ns

TCVNV Control Active 5 45 5 45 5 45 ns

Delay (See Note 1)

TCVNX Control Inactive 10 45 10 45 10 45 ns

Delay (See Note 1)

TAZRL Address Float to 0 0 0 ns

READ Active

TCLRL RD Active Delay 10 165 10 70 10 100 ns

TCLRH RD Inactive Delay 10 150 10 60 10 80 ns

20

Page 456: uProccessors

8086

A.C. CHARACTERISTICS (Continued)

TIMING RESPONSES (Continued)

Symbol Parameter8086 8086-1 8086-2

Units Test

Min Max Min Max Min Max Conditions

TRHAV RD Inactive to Next TCLCL-45 TCLCL-35 TCLCL-40 ns

Address Active

TCHDTL Direction Control 50 50 50 ns CL e 20–100 pFfor all 8086Active DelayOutputs (In(Note 1)addition to 8086

TCHDTH Direction Control 30 30 30 ns self-load)Inactive Delay

(Note 1)

TCLGL GT Active Delay 0 85 0 38 0 50 ns

TCLGH GT Inactive Delay 0 85 0 45 0 50 ns

TRLRH RD Width 2TCLCL-75 2TCLCL-40 2TCLCL-50 ns

TOLOH Output Rise Time 20 20 20 ns From 0.8V to 2.0V

TOHOL Output Fall Time 12 12 12 ns From 2.0V to 0.8V

NOTES:1. Signal at 8284A or 8288 shown for reference only.2. Setup requirement for asynchronous signal only to guarantee recognition at next CLK.3. Applies only to T3 and wait states.4. Applies only to T2 state (8 ns into T3).

21

Page 457: uProccessors

8086

WAVEFORMS

MAXIMUM MODE

231455–15

22

Page 458: uProccessors

8086

WAVEFORMS (Continued)

MAXIMUM MODE (Continued)

231455–16

NOTES:1. All signals switch between VOH and VOL unless otherwise specified.2. RDY is sampled near the end of T2, T3, TW to determine if TW machines states are to be inserted.3. Cascade address is valid between first and second INTA cycle.4. Two INTA cycles run back-to-back. The 8086 LOCAL ADDR/DATA BUS is floating during both INTA cycles. Control forpointer address is shown for second INTA cycle.5. Signals at 8284A or 8288 are shown for reference only.6. The issuance of the 8288 command and control signals (MRDC, MWTC, AMWC, IORC, IOWC, AIOWC, INTA and DEN)lags the active high 8288 CEN.7. All timing measurements are made at 1.5V unless otherwise noted.8. Status inactive in state just prior to T4.

23

Page 459: uProccessors

8086

WAVEFORMS (Continued)

ASYNCHRONOUS SIGNAL RECOGNITION

231455–17

NOTE:1. Setup requirements for asynchronous signals only to guarantee recognition at next CLK.

BUS LOCK SIGNAL TIMING (MAXIMUM MODEONLY)

231455–18

RESET TIMING

231455–19

REQUEST/GRANT SEQUENCE TIMING (MAXIMUM MODE ONLY)

231455–20

NOTE:The coprocessor may not drive the buses outside the region shown without risking contention.

24

Page 460: uProccessors

8086

WAVEFORMS (Continued)

HOLD/HOLD ACKNOWLEDGE TIMING (MINIMUM MODE ONLY)

231455–21

25

Page 461: uProccessors

8086

Table 2. Instruction Set Summary

Mnemonic andInstruction Code

Description

DATA TRANSFER

MOV e Move: 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0

Register/Memory to/from Register 1 0 0 0 1 0 d w mod reg r/m

Immediate to Register/Memory 1 1 0 0 0 1 1 w mod 0 0 0 r/m data data if w e 1

Immediate to Register 1 0 1 1 w reg data data if w e 1

Memory to Accumulator 1 0 1 0 0 0 0 w addr-low addr-high

Accumulator to Memory 1 0 1 0 0 0 1 w addr-low addr-high

Register/Memory to Segment Register 1 0 0 0 1 1 1 0 mod 0 reg r/m

Segment Register to Register/Memory 1 0 0 0 1 1 0 0 mod 0 reg r/m

PUSH e Push:

Register/Memory 1 1 1 1 1 1 1 1 mod 1 1 0 r/m

Register 0 1 0 1 0 reg

Segment Register 0 0 0 reg 1 1 0

POP e Pop:

Register/Memory 1 0 0 0 1 1 1 1 mod 0 0 0 r/m

Register 0 1 0 1 1 reg

Segment Register 0 0 0 reg 1 1 1

XCHG e Exchange:

Register/Memory with Register 1 0 0 0 0 1 1 w mod reg r/m

Register with Accumulator 1 0 0 1 0 reg

IN e Input from:

Fixed Port 1 1 1 0 0 1 0 w port

Variable Port 1 1 1 0 1 1 0 w

OUT e Output to:

Fixed Port 1 1 1 0 0 1 1 w port

Variable Port 1 1 1 0 1 1 1 w

XLAT e Translate Byte to AL 1 1 0 1 0 1 1 1

LEA e Load EA to Register 1 0 0 0 1 1 0 1 mod reg r/m

LDS e Load Pointer to DS 1 1 0 0 0 1 0 1 mod reg r/m

LES e Load Pointer to ES 1 1 0 0 0 1 0 0 mod reg r/m

LAHF e Load AH with Flags 1 0 0 1 1 1 1 1

SAHF e Store AH into Flags 1 0 0 1 1 1 1 0

PUSHF e Push Flags 1 0 0 1 1 1 0 0

POPF e Pop Flags 1 0 0 1 1 1 0 1

Mnemonics © Intel, 1978

26

Page 462: uProccessors

8086

Table 2. Instruction Set Summary (Continued)

Mnemonic andInstruction Code

Description

ARITHMETIC 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0

ADD e Add:

Reg./Memory with Register to Either 0 0 0 0 0 0 d w mod reg r/m

Immediate to Register/Memory 1 0 0 0 0 0 s w mod 0 0 0 r/m data data if s: w e 01

Immediate to Accumulator 0 0 0 0 0 1 0 w data data if w e 1

ADC e Add with Carry:

Reg./Memory with Register to Either 0 0 0 1 0 0 d w mod reg r/m

Immediate to Register/Memory 1 0 0 0 0 0 s w mod 0 1 0 r/m data data if s: w e 01

Immediate to Accumulator 0 0 0 1 0 1 0 w data data if w e 1

INC e Increment:

Register/Memory 1 1 1 1 1 1 1 w mod 0 0 0 r/m

Register 0 1 0 0 0 reg

AAA e ASCII Adjust for Add 0 0 1 1 0 1 1 1

BAA e Decimal Adjust for Add 0 0 1 0 0 1 1 1

SUB e Subtract:

Reg./Memory and Register to Either 0 0 1 0 1 0 d w mod reg r/m

Immediate from Register/Memory 1 0 0 0 0 0 s w mod 1 0 1 r/m data data if s w e 01

Immediate from Accumulator 0 0 1 0 1 1 0 w data data if w e 1

SSB e Subtract with Borrow

Reg./Memory and Register to Either 0 0 0 1 1 0 d w mod reg r/m

Immediate from Register/Memory 1 0 0 0 0 0 s w mod 0 1 1 r/m data data if s w e 01

Immediate from Accumulator 0 0 0 1 1 1 w data data if w e 1

DEC e Decrement:

Register/memory 1 1 1 1 1 1 1 w mod 0 0 1 r/m

Register 0 1 0 0 1 reg

NEG e Change sign 1 1 1 1 0 1 1 w mod 0 1 1 r/m

CMP e Compare:

Register/Memory and Register 0 0 1 1 1 0 d w mod reg r/m

Immediate with Register/Memory 1 0 0 0 0 0 s w mod 1 1 1 r/m data data if s w e 01

Immediate with Accumulator 0 0 1 1 1 1 0 w data data if w e 1

AAS e ASCII Adjust for Subtract 0 0 1 1 1 1 1 1

DAS e Decimal Adjust for Subtract 0 0 1 0 1 1 1 1

MUL e Multiply (Unsigned) 1 1 1 1 0 1 1 w mod 1 0 0 r/m

IMUL e Integer Multiply (Signed) 1 1 1 1 0 1 1 w mod 1 0 1 r/m

AAM e ASCII Adjust for Multiply 1 1 0 1 0 1 0 0 0 0 0 0 1 0 1 0

DIV e Divide (Unsigned) 1 1 1 1 0 1 1 w mod 1 1 0 r/m

IDIV e Integer Divide (Signed) 1 1 1 1 0 1 1 w mod 1 1 1 r/m

AAD e ASCII Adjust for Divide 1 1 0 1 0 1 0 1 0 0 0 0 1 0 1 0

CBW e Convert Byte to Word 1 0 0 1 1 0 0 0

CWD e Convert Word to Double Word 1 0 0 1 1 0 0 1

Mnemonics © Intel, 1978

27

Page 463: uProccessors

8086

Table 2. Instruction Set Summary (Continued)

Mnemonic andInstruction Code

Description

LOGIC 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0

NOT e Invert 1 1 1 1 0 1 1 w mod 0 1 0 r/m

SHL/SAL e Shift Logical/Arithmetic Left 1 1 0 1 0 0 v w mod 1 0 0 r/m

SHR e Shift Logical Right 1 1 0 1 0 0 v w mod 1 0 1 r/m

SAR e Shift Arithmetic Right 1 1 0 1 0 0 v w mod 1 1 1 r/m

ROL e Rotate Left 1 1 0 1 0 0 v w mod 0 0 0 r/m

ROR e Rotate Right 1 1 0 1 0 0 v w mod 0 0 1 r/m

RCL e Rotate Through Carry Flag Left 1 1 0 1 0 0 v w mod 0 1 0 r/m

RCR e Rotate Through Carry Right 1 1 0 1 0 0 v w mod 0 1 1 r/m

AND e And:

Reg./Memory and Register to Either 0 0 1 0 0 0 d w mod reg r/m

Immediate to Register/Memory 1 0 0 0 0 0 0 w mod 1 0 0 r/m data data if w e 1

Immediate to Accumulator 0 0 1 0 0 1 0 w data data if w e 1

TEST e And Function to Flags, No Result:

Register/Memory and Register 1 0 0 0 0 1 0 w mod reg r/m

Immediate Data and Register/Memory 1 1 1 1 0 1 1 w mod 0 0 0 r/m data data if w e 1

Immediate Data and Accumulator 1 0 1 0 1 0 0 w data data if w e 1

OR e Or:

Reg./Memory and Register to Either 0 0 0 0 1 0 d w mod reg r/m

Immediate to Register/Memory 1 0 0 0 0 0 0 w mod 0 0 1 r/m data data if w e 1

Immediate to Accumulator 0 0 0 0 1 1 0 w data data if w e 1

XOR e Exclusive or:

Reg./Memory and Register to Either 0 0 1 1 0 0 d w mod reg r/m

Immediate to Register/Memory 1 0 0 0 0 0 0 w mod 1 1 0 r/m data data if w e 1

Immediate to Accumulator 0 0 1 1 0 1 0 w data data if w e 1

STRING MANIPULATION

REP e Repeat 1 1 1 1 0 0 1 z

MOVS e Move Byte/Word 1 0 1 0 0 1 0 w

CMPS e Compare Byte/Word 1 0 1 0 0 1 1 w

SCAS e Scan Byte/Word 1 0 1 0 1 1 1 w

LODS e Load Byte/Wd to AL/AX 1 0 1 0 1 1 0 w

STOS e Stor Byte/Wd from AL/A 1 0 1 0 1 0 1 w

CONTROL TRANSFER

CALL e Call:

Direct within Segment 1 1 1 0 1 0 0 0 disp-low disp-high

Indirect within Segment 1 1 1 1 1 1 1 1 mod 0 1 0 r/m

Direct Intersegment 1 0 0 1 1 0 1 0 offset-low offset-high

seg-low seg-high

Indirect Intersegment 1 1 1 1 1 1 1 1 mod 0 1 1 r/m

Mnemonics © Intel, 1978

28

Page 464: uProccessors

8086

Table 2. Instruction Set Summary (Continued)

Mnemonic andInstruction Code

Description

JMP e Unconditional Jump: 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0

Direct within Segment 1 1 1 0 1 0 0 1 disp-low disp-high

Direct within Segment-Short 1 1 1 0 1 0 1 1 disp

Indirect within Segment 1 1 1 1 1 1 1 1 mod 1 0 0 r/m

Direct Intersegment 1 1 1 0 1 0 1 0 offset-low offset-high

seg-low seg-high

Indirect Intersegment 1 1 1 1 1 1 1 1 mod 1 0 1 r/m

RET e Return from CALL:

Within Segment 1 1 0 0 0 0 1 1

Within Seg Adding Immed to SP 1 1 0 0 0 0 1 0 data-low data-high

Intersegment 1 1 0 0 1 0 1 1

Intersegment Adding Immediate to SP 1 1 0 0 1 0 1 0 data-low data-high

JE/JZ e Jump on Equal/Zero 0 1 1 1 0 1 0 0 disp

JL/JNGE e Jump on Less/Not Greater 0 1 1 1 1 1 0 0 dispor Equal

JLE/JNG e Jump on Less or Equal/ 0 1 1 1 1 1 1 0 dispNot Greater

JB/JNAE e Jump on Below/Not Above 0 1 1 1 0 0 1 0 dispor Equal

JBE/JNA e Jump on Below or Equal/ 0 1 1 1 0 1 1 0 dispNot Above

JP/JPE e Jump on Parity/Parity Even 0 1 1 1 1 0 1 0 disp

JO e Jump on Overflow 0 1 1 1 0 0 0 0 disp

JS e Jump on Sign 0 1 1 1 1 0 0 0 disp

JNE/JNZ e Jump on Not Equal/Not Zero 0 1 1 1 0 1 0 1 disp

JNL/JGE e Jump on Not Less/Greater 0 1 1 1 1 1 0 1 dispor Equal

JNLE/JG e Jump on Not Less or Equal/ 0 1 1 1 1 1 1 1 dispGreater

JNB/JAE e Jump on Not Below/Above 0 1 1 1 0 0 1 1 dispor Equal

JNBE/JA e Jump on Not Below or 0 1 1 1 0 1 1 1 dispEqual/Above

JNP/JPO e Jump on Not Par/Par Odd 0 1 1 1 1 0 1 1 disp

JNO e Jump on Not Overflow 0 1 1 1 0 0 0 1 disp

JNS e Jump on Not Sign 0 1 1 1 1 0 0 1 disp

LOOP e Loop CX Times 1 1 1 0 0 0 1 0 disp

LOOPZ/LOOPE e Loop While Zero/Equal 1 1 1 0 0 0 0 1 disp

LOOPNZ/LOOPNE e Loop While Not 1 1 1 0 0 0 0 0 dispZero/Equal

JCXZ e Jump on CX Zero 1 1 1 0 0 0 1 1 disp

INT e Interrupt

Type Specified 1 1 0 0 1 1 0 1 type

Type 3 1 1 0 0 1 1 0 0

INTO e Interrupt on Overflow 1 1 0 0 1 1 1 0

IRET e Interrupt Return 1 1 0 0 1 1 1 1

29

Page 465: uProccessors

8086

Table 2. Instruction Set Summary (Continued)

Mnemonic andInstruction Code

Description

7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0

PROCESSOR CONTROL

CLC e Clear Carry 1 1 1 1 1 0 0 0

CMC e Complement Carry 1 1 1 1 0 1 0 1

STC e Set Carry 1 1 1 1 1 0 0 1

CLD e Clear Direction 1 1 1 1 1 1 0 0

STD e Set Direction 1 1 1 1 1 1 0 1

CLI e Clear Interrupt 1 1 1 1 1 0 1 0

STI e Set Interrupt 1 1 1 1 1 0 1 1

HLT e Halt 1 1 1 1 0 1 0 0

WAIT e Wait 1 0 0 1 1 0 1 1

ESC e Escape (to External Device) 1 1 0 1 1 x x x mod x x x r/m

LOCK e Bus Lock Prefix 1 1 1 1 0 0 0 0

NOTES:AL e 8-bit accumulatorAX e 16-bit accumulatorCX e Count registerDS e Data segmentES e Extra segmentAbove/below refers to unsigned valueGreater e more positive;Less e less positive (more negative) signed valuesif d e 1 then ‘‘to’’ reg; if d e 0 then ‘‘from’’ regif w e 1 then word instruction; if w e 0 then byte instruc-

tionif mod e 11 then r/m is treated as a REG fieldif mod e 00 then DISP e 0*, disp-low and disp-high are

absentif mod e 01 then DISP e disp-low sign-extended to

16 bits, disp-high is absentif mod e 10 then DISP e disp-high; disp-lowif r/m e 000 then EA e (BX) a (SI) a DISPif r/m e 001 then EA e (BX) a (DI) a DISPif r/m e 010 then EA e (BP) a (SI) a DISPif r/m e 011 then EA e (BP) a (DI) a DISPif r/m e 100 then EA e (SI) a DISPif r/m e 101 then EA e (DI) a DISPif r/m e 110 then EA e (BP) a DISP*if r/m e 111 then EA e (BX) a DISPDISP follows 2nd byte of instruction (before data if re-

quired)*except if mod e 00 and r/m e 110 then EA e disp-high;

disp-low.

Mnemonics © Intel, 1978

if s w e 01 then 16 bits of immediate data form the oper-and

if s w e 11 then an immediate data byte is sign extendedto form the 16-bit operand

if v e 0 then ‘‘count’’ e 1; if v e 1 then ‘‘count’’ in (CL)x e don’t carez is used for string primitives for comparison with ZF FLAG

SEGMENT OVERRIDE PREFIX

0 0 1 reg 1 1 0

REG is assigned according to the following table:

16-Bit (w e 1) 8-Bit (w e 0) Segment

000 AX 000 AL 00 ES

001 CX 001 CL 01 CS

010 DX 010 DL 10 SS

011 BX 011 BL 11 DS

100 SP 100 AH

101 BP 101 CH

110 SI 110 DH

111 DI 111 BH

Instructions which reference the flag register file as a 16-bitobject use the symbol FLAGS to represent the file:FLAGS e X:X:X:X:(OF):(DF):(IF):(TF):(SF):(ZF):X:(AF):X:(PF):X:(CF)

DATA SHEET REVISION REVIEW

The following list represents key differences between this and the -004 data sheet. Please review this summa-ry carefully.

1. The Intel 8086 implementation technology (HMOS) has been changed to (HMOS-III).

2. Delete all ‘‘changes from 1985 Handbook Specification’’ sentences.

30

Page 466: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

1(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8086

/88

Dev

ice

Spec

ifica

tion

sBo

th a

re p

acka

ged

in D

IP (D

ual I

n-Li

ne P

acka

ges)

.•

8086

: 16-

bit m

icro

proc

esso

r w

ith

a16

-bit

dat

a bu

s•

8088

: 16-

bit m

icro

proc

esso

r w

ith

an8-

bit d

ata

bus.

Both

are

5V

par

ts:

• 80

86: D

raw

s a

max

imum

sup

ply

curr

ent o

f 360

mA

.•

8086

: Dra

ws

a m

axim

um s

uppl

y cu

rren

t of 3

40m

A.

• 80

C86

/80C

88: C

MO

S ve

rsio

n dr

aws

10m

A w

ith

tem

p sp

ec -4

0 to

225

degF

.

Inpu

t/O

utpu

t cur

rent

leve

ls:

Yiel

dsa

350m

Vno

ise

imm

unit

yfo

rlog

ic0

(Out

putm

axca

nbe

ashi

ghas

450m

V w

hile

inpu

t max

can

be

no h

ighe

r th

an 8

00m

V).

This

lim

its

the

load

ing

on th

e ou

tput

s.

Logi

c le

vel

Volt

age

Cur

rent

00.

8V m

ax+/

- 10u

A m

ax1

2.0V

min

+/- 1

0uA

max

Logi

c le

vel

Volt

age

Cur

rent

00.

45V

max

+2m

A m

ax1

2.4V

min

- 400

uA m

ax

INPU

TO

UTP

UT

Page 467: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

2(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8086

/88

Pin

out

GN

DC

LK

INT

RN

MI

AD

0A

D1

AD

2A

D3

AD

4A

D5

AD

6A

D7

AD

8A

D9

AD

10A

D11

AD

12A

D13

AD

14G

ND

RE

SET

RE

AD

YT

EST

(QS1

)(Q

S0)

( S0)

( S1)

(S2)

( LO

CK

)( R

Q/G

T1)

( RQ

/GT

0)R

DM

N/M

XB

HE

/S7

A19

/S6

A18

/S5

A17

/S4

A16

/S3

AD

15V

CC

WR

HL

DA

Hol

d

M/I

OD

T/R

DE

NA

LE

INT

A

MIN

MO

DE

(M

AX

MO

DE

)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21

8086

CPU

Page 468: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

3(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8086

/88

Pin

out

Pin

func

tion

s: A

D15

-AD

0M

ulti

plex

ed a

ddre

ss(A

LE=1

)/da

ta b

us(A

LE=0

). A

19/S

6-A

16/S

3 (m

ulti

plex

ed)

Hig

h or

der

4 bi

ts o

f the

20-

bit a

ddre

ss O

R s

tatu

s bi

ts S

6-S3

. M

/IO

Indi

cate

s if

add

ress

is a

Mem

ory

or IO

add

ress

.R

D Whe

n 0,

dat

a bu

s is

dri

ven

by m

emor

y or

an

I/O

dev

ice.

WR M

icro

proc

esso

ris

driv

ing

data

bus

tom

emor

yor

anI/

Ode

vice

.Whe

n0,

data

bus

con

tain

s va

lid d

ata.

ALE

(Add

ress

latc

h en

able

)W

hen

1, a

ddre

ss d

ata

bus

cont

ains

a m

emor

y or

I/O

add

ress

. D

T/R

(Dat

a Tr

ansm

it/R

ecei

ve)

Dat

a bu

s is

tran

smit

ting

/rec

eivi

ng d

ata.

DEN

(Dat

a bu

s En

able

)A

ctiv

ates

ext

erna

l dat

a bu

s bu

ffer

s.

Page 469: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

4(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8086

/88

Pin

out

Pin

func

tion

s: S

7, S

6, S

5, S

4, S

3,S2

,S1,

S0S7

: Log

ic 1

, S6:

Log

ic 0

.S5

: Ind

icat

es c

ondi

tion

of I

F fla

g bi

ts.

S4-S

3: In

dica

te w

hich

seg

men

t is

acce

ssed

dur

ing

curr

ent b

us c

ycle

:

S2,S

1,S0

: Ind

icat

e fu

ncti

on o

f cur

rent

bus

cyc

le (d

ecod

ed b

y 82

88).

S4S3

Func

tion

00

Extr

a se

gmen

t0

1St

ack

segm

ent

10

11

Cod

e or

no

segm

ent

Dat

a se

gmen

t

S2S1

Func

tion

00

Inte

rrup

t Ack

01

I/O

Rea

d1

01

1I/

O W

rite

Hal

t

S00 0 0 0

S2S1

Func

tion

00

Opc

ode

Fetc

h0

1M

emor

y R

ead

10

11

Mem

ory

Wri

tePa

ssiv

e

S01 1 1 1

Page 470: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

5(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8086

/88

Pin

out

Pin

func

tion

s: IN

TR

Whe

n 1

and

IF=1

, mic

ropr

oces

sor

prep

ares

to s

ervi

ce in

terr

upt.

INTA

beco

mes

act

ive

afte

r cu

rren

t ins

truc

tion

com

plet

es.

INTA In

terr

uptA

ckno

wle

dge

gene

rate

dby

the

mic

ropr

oces

sor

inre

spon

seto

INTR

. Cau

ses

the

inte

rrup

t vec

tor

to b

e pu

t ont

o th

e da

ta b

us.

NM

IN

on-m

aska

ble

inte

rrup

t. Si

mila

r to

INTR

exc

ept I

F fla

g bi

t is

not c

on-

sult

ed a

nd in

terr

upt i

s ve

ctor

2.

CLK C

lock

inpu

t mus

t hav

e a

duty

cyc

le o

f 33%

(hig

h fo

r 1/

3 an

d lo

w fo

r 2/

3s)

VC

C/G

ND

Pow

er s

uppl

y (5

V) a

nd G

ND

(0V

).

Page 471: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

6(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8086

/88

Pin

out

Pin

func

tion

s: M

N/M

XSe

lect

min

imum

(5V

) or

max

imum

mod

e (0

V) o

f ope

rati

on.

BHE Bu

s H

igh

Enab

le. E

nabl

es th

e m

ost s

igni

fican

t dat

a bu

s bi

ts (D

15-D

8)

duri

ng a

rea

d or

wri

te o

pera

tion

.

REA

DY

Use

d to

inse

rt w

ait s

tate

s (c

ontr

olle

d by

mem

ory

and

IO fo

r re

ads/

wri

tes)

into

the

mic

ropr

oces

sor.

RES

ETM

icro

proc

esso

r re

sets

if th

is p

in is

hel

d hi

gh fo

r 4

cloc

k pe

riod

s.In

stru

ctio

n ex

ecut

ion

begi

ns a

t FFF

F0H

and

IF fl

ag is

cle

ared

.

TEST A

n in

put t

hat i

s te

sted

by

the

WA

IT in

stru

ctio

n.C

omm

only

con

nect

ed to

the

8087

cop

roce

ssor

.

Page 472: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

7(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8086

/88

Pin

out

Pin

func

tion

s: H

OLD Req

uest

s a

dire

ct m

emor

y ac

cess

(DM

A).

Whe

n 1,

mic

ropr

oces

sor

stop

san

d pl

aces

add

ress

, dat

a an

d co

ntro

l bus

in h

igh-

impe

danc

e st

ate.

HLD

A (H

old

Ack

now

ledg

e)In

dica

tes

that

the

mic

ropr

oces

sor

has

ente

red

the

hold

sta

te.

RO

/GT1

and

RO

/GT0

Req

uest

/gra

nt p

ins

requ

est/

gran

t dir

ect m

emor

y ac

cess

es (D

MA

) dur

-in

g m

axim

um m

ode

oper

atio

n.

LOC

KLo

ck o

utpu

t is

used

to lo

ck p

erip

hera

ls o

ff th

e sy

stem

. Act

ivat

ed b

yus

ing

the

LOC

K: p

refix

on

any

inst

ruct

ion.

QS1

and

QS0

The

que

ue s

tatu

s bi

ts s

how

sta

tus

of in

tern

al in

stru

ctio

n qu

eue.

Pro

-vi

ded

for

acce

ss b

y th

e nu

mer

ic c

opro

cess

or (8

087)

.

Page 473: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

8(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8284

A C

lock

Gen

erat

orBa

sic

func

tion

s: C

lock

gen

erat

ion.

RES

ET s

ynch

roni

zati

on.

REA

DY

syn

chro

niza

tion

. P

erip

hera

l clo

ck s

igna

l.

Con

nect

ion

of th

e 82

84 a

nd th

e 80

86.

1 2 3 4 5 6 7 8 9

18 17 16 15 14 13 12 11 10

8284AC

LK

CSY

NC

RE

SET

F/C

X2

X1

�������

Cry

stal

OSC

15M

Hz

8086

CL

KR

ESE

T

Page 474: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

9(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8284

A C

lock

Gen

erat

or

GN

DC

LK

AE

N2

RD

Y2

RE

AD

YR

DY

1A

EN

1P

CL

KC

SYN

C

RE

SET

RE

SO

SCF

/ CE

FI

ASY

NC

X2

X1

VC

C1 2 3 4 5 6 7 8 9

18 17 16 15 14 13 12 11 108284A

DQ

RES

ETR

ES

OSC

XTA

LO

SC

X1

X2

+2PC

LK

F/C

EFI

+3

CSY

NC

CLK

DQ

REA

DY

DQ

RD

Y1

AEN

1

AEN

2

RD

Y2

ASY

NC

Schm

itt

trig

ger

(EFI

inpu

tto

oth

er82

84A

s)

div-

by-3

cnte

r

div-

by-2

cnte

r2-

to-1

mux

Page 475: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

10(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8284

A C

lock

Gen

erat

orC

lock

gen

erat

ion:

Cry

stal

is c

onne

cted

to X

1 an

d X

2.X

TAL

OSC

gen

erat

es s

quar

e w

ave

sign

al a

t cry

stal

’s fr

eque

ncy

whi

chfe

eds:

An

inve

rtin

g bu

ffer

(out

put O

SC) w

hich

is u

sed

to d

rive

the

EFI i

nput

of o

ther

828

4As.

2-t

o-1

MU

XF/

C s

elec

ts X

TAL

or E

FI e

xter

nal i

nput

.

The

MU

X d

rive

s a

divi

de-b

y-3

coun

ter

(15M

Hz

to 5

MH

z).

This

dri

ves:

The

REA

DY

flip

flop

(REA

DY

syn

chro

niza

tion

). A

sec

ond

divi

de-b

y-2

coun

ter

(2.5

MH

z cl

k fo

r pe

riph

eral

com

pone

nts)

. T

heR

ESET

flip

flop.

CLK

whi

ch d

rive

s th

e 80

86 C

LK in

put.

Page 476: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

11(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8284

A C

lock

Gen

erat

orR

ESET

:N

egat

ive

edge

-tri

gger

edflip

flop

appl

ies

the

RES

ETsi

gnal

toth

e80

86on

the

falli

ng e

dge.

The

808

6 sa

mpl

es th

e R

ESET

pin

on

the

risi

ng e

dge.

Cor

rect

rese

ttim

ing

requ

ires

that

the

RES

ETin

putt

oth

em

icro

proc

esso

rbe

com

es a

logi

c 1

NO

LA

TER

than

4 c

lock

s af

ter

pow

er u

p an

d st

ayhi

gh fo

r at

leas

t 50u

s.

1 2 3 4 5 6 7 8 9

18 17 16 15 14 13 12 11 108284A

CL

K

CSY

NC

RE

SET

RE

S

F/C

X2

X1

���������������������

Cry

stal

OSC

15M

Hz

10uF

10K

+5V

Res

etsw

itch

8086

CL

KR

ESE

TR

C =

10K

*10u

F ~=

100

mse

c

CSY

NC

: Use

d w

ith

mul

tipl

e pr

oces

sors

.

Page 477: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

12(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

BU

S B

uffe

ring

and

Lat

chin

gD

emul

tipl

exin

g th

e Bu

ses:

Com

pute

r sy

stem

s ha

ve th

ree

buse

s: A

ddre

ss D

ata

Con

trol

The

Add

ress

and

Dat

a bu

s ar

e m

ulti

plex

ed (s

hare

d) d

ue to

pin

lim

ita-

tion

s on

the

8086

.Th

e A

LE p

in c

ontr

ols

a se

t of l

atch

es.

All

sign

als

MU

ST b

e bu

ffer

ed.

Latc

hes

buff

er fo

r A

0-A

15.

Con

trol

and

A16

-A19

+BH

E ar

e bu

ffer

ed s

epar

atel

y.

Dat

a bu

s bu

ffer

s m

ust b

e bi

-dir

ecti

onal

buf

fers

(BB)

.

BHE:

Sel

ects

the

high

-ord

er m

emor

y ba

nk.

Page 478: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

13(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

BU

S B

uffe

ring

and

Lat

chin

g

8086 CPU

GN

DC

LK

INT

RN

MI

AD

0A

D1

AD

2A

D3

AD

4A

D5

AD

6A

D7

AD

8A

D9

AD

10A

D11

AD

12A

D13

AD

14G

ND

RE

SET

RE

AD

YT

EST

RD

MN

/MX

BH

E/S

7A

19/S

6A

18/S

5A

17/S

4A

16/S

3A

D15

VC

C

WR

HL

DA

Hol

d

M/I

OD

T/ R

DE

NA

LE

INT

A

GG

Latc

hes

D15

D0

D7

D8

Con

trol

A0

A7

A8

A15

A19

BHE

A16

Latc

hes

Data Bus

Address Bus

Buff

er Buff

er

GD

GD

BB BB

Page 479: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

14(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

BU

S T

imin

gW

riti

ng:

Dum

p ad

dres

s on

add

ress

bus

. D

ump

data

on

data

bus

. Is

sue

a w

rite

(WR

) and

set

M/I

O to

1.

T1

T 2T

3T 4

Val

id A

ddre

ss

Dat

a w

ritt

en to

mem

ory

Add

ress

WR

Add

ress

/Dat

a

Add

ress

CLK

Sim

plifi

ed 8

086

Wri

te B

us C

ycle

One

Bus

Cyc

le

Page 480: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

15(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

BU

S T

imin

gR

eadi

ng:

Dum

p ad

dres

s on

add

ress

bus

. Is

sue

a re

ad (R

D) a

nd s

et M

/IO

to 1

. W

ait f

or m

emor

y ac

cess

cyc

le.

T1

T 2T

3T 4

Val

id A

ddre

ss

Dat

a fr

om m

emor

yA

ddre

ss

RD

Add

ress

/Dat

a

Add

ress

CLK

Sim

plifi

ed 8

086

Rea

d B

us C

ycle

One

Bus

Cyc

le

Page 481: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

16(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

BU

S T

imin

gBu

s Ti

min

g:

T 1T

2T 3

T4

RD

M/I

O

CLK

Bus

Tim

ing

for

a R

ead

Ope

rati

on

A19

-A16

/S6-

S 3A

19-A

16S 7

-S3

AD

15-A

D0

Floa

tD

ata

InFl

oat

T w

AD

15-A

D0

ALE

DT/

R

DEN

REA

DY

800n

s20

0ns

Dat

aSe

tup

Add

ress

set

up

Page 482: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

17(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

BU

S T

imin

gD

urin

g T 1

:

The

add

ress

is p

lace

d on

the

Add

ress

/Dat

a bu

s.C

ontr

olsi

gnal

sM

/IO

,ALE

and

DT/

Rsp

ecif

ym

emor

yor

I/O

,lat

chth

ead

dres

s on

to th

e ad

dres

s bu

s an

d se

t the

dir

ecti

on o

f dat

a tr

ansf

er o

nda

ta b

us.

Dur

ing

T 2:

808

6 is

sues

the

RD

or

WR

sig

nal,

DEN

, and

, for

a w

rite

, the

dat

a.D

ENen

able

sth

em

emor

yor

I/O

devi

ceto

rece

ive

the

data

forw

rite

san

d th

e 80

86 to

rec

eive

the

data

for

read

s.D

urin

g T 3

:

Thi

s cy

cle

is p

rovi

ded

to a

llow

mem

ory

to a

cces

s da

ta.

REA

DY

is s

ampl

ed a

t the

end

of T

2.

If lo

w, T

3 be

com

es a

wai

t sta

te.

Oth

erw

ise,

the

data

bus

is s

ampl

ed a

t the

end

of T

3.

Dur

ing

T 4:

All

bus

sign

als

are

deac

tiva

ted,

in p

repa

rati

on fo

r ne

xt b

us c

ycle

. D

ata

is s

ampl

ed fo

r re

ads,

wri

tes

occu

r fo

r w

rite

s.

Page 483: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

18(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

BU

S T

imin

gTi

min

g: Each

BU

S C

YC

LE o

n th

e 80

86 e

qual

sfo

ursy

stem

clo

ckin

g pe

riod

s (T

stat

es).

The

clo

ck r

ate

is5M

Hz,

ther

efor

e on

e Bu

s C

ycle

is80

0ns.

The

tran

sfer

rat

e is

1.25

MH

z.

Mem

ory

spec

s (m

emor

y ac

cess

tim

e) m

ust m

atch

con

stra

ints

of s

yste

mti

min

g.

For

exam

ple,

bus

tim

ing

for

a re

ad o

pera

tion

sho

ws

alm

ost6

00ns

are

need

ed to

rea

d da

ta.

How

ever

, mem

ory

mus

t acc

ess

fast

er d

ue to

set

up ti

mes

, e.g

.A

ddre

ss s

etup

and

dat

a se

tup.

This

sub

trac

ts o

ff a

bout

150n

s.Th

eref

ore,

mem

ory

mus

t acc

ess

in a

t lea

st45

0ns

min

us a

noth

er30

-40

ns g

uard

ban

d fo

r bu

ffer

s an

d de

code

rs.

420n

s D

RA

M r

equi

red

for

the

8086

.

Page 484: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

19(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

BU

S T

imin

gR

EAD

Y:A

n in

put t

o th

e 80

86 th

at c

ause

s w

ait s

tate

s fo

r sl

ower

mem

ory

and

I/O

com

pone

nts.

A w

ait s

tate

(TW

) is

an e

xtra

clo

ck p

erio

d in

sert

ed b

etw

een

T2

and

T3

to

leng

then

the

bus

cycl

e.Fo

r ex

ampl

e, th

is e

xten

ds a

460n

s bu

s cy

cle

(at 5

MH

z cl

ock)

to66

0ns.

Text

dis

cuss

es r

ole

of 8

284A

and

tim

ing

requ

irem

ents

for

the

8086

.

T 1T

2T 3

T4

CLK

Wai

t Sta

te ti

min

g

AD

15-A

D0

Floa

tD

ata

InFl

oat

T w

AD

15-A

D0

REA

DY

800n

s20

0ns

OK

Fail

REA

DY

Dat

a In

Sam

pled

aga

in

Page 485: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

20(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

MIN

and

MA

X M

ode

Con

trol

led

thro

ugh

the

MN

/ MX

pin

.M

inim

um m

ode

is c

heap

er s

ince

all

cont

rol s

igna

ls fo

r m

emor

y an

d I/

O a

re g

ener

ated

by

the

mic

ropr

oces

sor.

Max

imum

mod

e is

des

igne

d to

be

used

whe

n a

copr

oces

sor

(808

7)ex

ists

in th

e sy

stem

.

Som

e of

the

cont

rol s

igna

ls m

ust b

e ge

nera

ted

exte

rnal

ly, d

ue to

red

efini

tion

of c

erta

in c

ontr

ol p

ins

on th

e 80

86.

The

follo

win

g pi

ns a

re lo

st w

hen

the

8086

ope

rate

s in

Max

imum

mod

e. A

LEW

R IO

/M D

T/R

DEN

INTA

This

req

uire

s an

ext

erna

l bus

con

trol

ler:

The

8288

Bus

Con

trol

ler.

Page 486: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

21(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

8288

Bus

Con

trol

ler

Sepa

rate

sig

nals

are

use

d fo

r I/

O ( I

OR

C a

ndIO

WC

) and

mem

ory

(MR

DC

and

MW

TC).

Als

o pr

ovid

ed a

re a

dvan

ced

mem

ory

(AIO

WC

) and

I/O

(AIO

WC

) wri

test

robe

s pl

usIN

TA.

IOB

CL

KS1 D

T/R

AL

EA

EN

MR

DC

AM

WC

MW

TC

GN

D

VC

C S0 S2M

CE

/PD

ND

EN

CE

NIN

TA

IOR

CA

IOW

CIO

WC

8288

8086

Stat

us

S0 S1 S2 CL

K

AE

N

CE

N

IOB

MR

DC

MW

TC

AM

WC

IOR

CIO

WC

AIO

WC

INT

A

DT

/RD

T/R

DE

NM

CE

/PD

EN

AL

E

Con

trol

Inpu

t

Stat

usD

ecod

erC

omm

and

Sign

alG

ener

-at

or

Con

trol

Sign

alG

ener

-at

or

Con

trol

Log

ic

Page 487: uProccessors

Syst

ems

Des

ign

& P

rogr

amm

ing

8086

/88

Chi

p Se

tC

MPE

310

22(F

eb. 2

0, 2

002)

UM

BC

U M

B C

UNIVERSITY OF M

AR

YL

AN

D B

ALTIM

ORE COUNTY

1 9

6 6

MA

X M

ode

8086

Sys

tem

GN

D

VC

C RES

CLK

REA

DY

RES

ET

S0 S1 S2

8086

8288

CL

K

DEN

DT/

RA

LEC

PU

AD

0-A

D15

S0 S1 S2

Latc

hes

STB 82

86Tr

ansc

eive

r

T OE

8259

AIn

terr

upt

Con

trol

ler

RA

M

MR

DC

MW

TC

IOR

CIO

WC

INTA

Add

ress

Dat

aIN

T

RD

WR

IRQ

0-7

8284

A