Unit 1 8086 Architecture

56
Microprocessor and Interfacing Techniques Prof. Rajendra Khope Department of Computer MIT College of Engineering, Pune, India

description

Unit 1 8086 Architecture

Transcript of Unit 1 8086 Architecture

Page 1: Unit 1 8086 Architecture

Microprocessor and Interfacing Techniques

Prof. Rajendra KhopeDepartment of ComputerMIT College of Engineering, Pune, India

Page 2: Unit 1 8086 Architecture

Syllabus210249: Microprocessor and Interfacing

Techniques

2

Page 3: Unit 1 8086 Architecture

Syllabus

3

Page 4: Unit 1 8086 Architecture

Syllabus

4

Page 5: Unit 1 8086 Architecture

Syllabus

5

Page 6: Unit 1 8086 Architecture

Syllabus

6

Page 7: Unit 1 8086 Architecture

Features of 8086

8086 is a 16 bit microprocessor, It can perform read & write operation on both 8 or 16 bit data..

8086 has 16 bit data bus & 20 bit address bus.

7

Page 8: Unit 1 8086 Architecture

Features of 8086 ( continued)

20 bit address lines capable of addressing 1MB memory location

16 bit data are stored in 2 consecutive memory locations

8086 can generate 16 bit I/O address , 216 = 65536 I/O ports

8

Page 9: Unit 1 8086 Architecture

Features of 8086 ( continued)

8086 has fourteen 16 bit registers

8086 has multiplexed address & data bus

8086 operates in 2 modes , minimum( single processor ) & maximum( multi processor) modes

8086 has 6 byte pr-efetch instruction Queue

9

Page 10: Unit 1 8086 Architecture

Registers Organisation 16-Bit General Purpose Registers

– can access all 16-bits at once– can access just high (H) byte, or low (L) byte

10

only the GeneralPurpose registersallow access as8-bit High/Lowsub-registers

Page 11: Unit 1 8086 Architecture

Registers Organisation (continued)

Register Set16-Bit Segment Addressing Registers

CS Code SegmentDS Data SegmentSS Stack SegmentES Extra Segment

11

Page 12: Unit 1 8086 Architecture

Registers Organisation (continued)

16-Bit Offset Addressing RegistersSP Stack PointerBP Base PointerSI Source IndexDI Destination Index

12

Page 13: Unit 1 8086 Architecture

Registers Organisation (continued)

16-Bit Control/Status Registers- IP Instruction Pointer (Program Counter

for execution control)- FLAGS 16-bit register• It is not a 16-bit value but it is a

collection of 9 bit-flags (six are unused)• Flag is set when it is equal to 1• Flag is clear when it is equal to 0

13

Page 14: Unit 1 8086 Architecture

Architecture

14

Page 15: Unit 1 8086 Architecture

Architecture (continued)

The 8086 has two parts, the Bus Interface Unit (BIU) and the Execution Unit (EU).

The BIU fetches instructions, reads and writes data, and computes the 20-bit address

The EU decodes and executes the instructions using the 16-bit ALU.

15

Page 16: Unit 1 8086 Architecture

Architecture (continued)

The BIU contains the following registers- IP - the Instruction Pointer

- CS - the Code Segment Register- DS - the Data Segment Register- SS - the Stack Segment Register- ES - the Extra Segment Register

16

Page 17: Unit 1 8086 Architecture

Architecture (continued)

The BIU fetches instructions using the CS and IP, written CS:IP, to construct the 20-bit address.

Data is fetched using a segment register (usually the DS) and an effective address (EA) computed by the EU depending on the addressing mode

17

Page 18: Unit 1 8086 Architecture

Architecture (continued)

The EU contains the following 16-bit general purpose registers:

» AX - the Accumulator» BX - the Base Register» CX - the Count Register» DX - the Data Register» SP - the Stack Pointer \ defaults to» BP - the Base Pointer / Stack segment» SI - the Source Index Register» DI - the Destination Register

18

Page 19: Unit 1 8086 Architecture

Architecture (continued)

HIGH BYTE GP REGISTERS LOW BYTE

AHBHCHDH

AXBXCXDX

ALBLCLDL

19

8 BIT 16 BIT 8 BIT

Page 20: Unit 1 8086 Architecture

Architecture (continued)

20

CSSSDSIP

AHBHCHDH

ALBLCLDL

SPBPSIDI

FLAGS

AXBXCXDX

Extra SegmentCode SegmentStack SegmentData SegmentInstruction Pointer

AccumulatorBase RegisterCount RegisterData RegisterStack PointerBase PointerSource Index RegisterDestination Index Register

BIU registers

(20 bit adder)

EU registers

16 bit arithmetic

ES

Page 21: Unit 1 8086 Architecture

General purpose Registers

AX Accumulator Register Preferred register to use in arithmetic, logic

and data transfer instructions because it generates the shortest Machine Language Code

Must be used in multiplication and division operations

Must also be used in I/O operations

21

Page 22: Unit 1 8086 Architecture

General purpose Registers (conti..)

BX Base Register Also serves as an address register Used in array operations Used in Table Lookup operations (XLAT )

22

Page 23: Unit 1 8086 Architecture

General purpose Registers (conti..)

CX Count register Used as a loop counter Used in shift and rotate operations

DX Data register Used in multiplication and division Also used in I/O operations

23

Page 24: Unit 1 8086 Architecture

Pointer & Index Registers

Contain the offset addresses of memory locations

Can also be used in arithmetic and other operations

SP: Stack pointer Used with SS to access the stack segment

24

Page 25: Unit 1 8086 Architecture

Pointer & Index Registers (continued)

BP: Base Pointer Primarily used to access data on the stack Can be used to access data in other

segments SI: Source Index register

is required for some string operations When string operations are performed, the SI

register points to memory locations in the data segment which is addressed by the DS register. Thus, SI is associated with the DS in string operations.

25

Page 26: Unit 1 8086 Architecture

Pointer & Index Registers (continued)

DI: Destination Index register is also required for some string operations. When string operations are performed, the DI

register points to memory locations in the data segment which is addressed by the ES register. Thus, DI is associated with the ES in string operations.

The SI and the DI registers may also be used to access data stored in arrays

26

Page 27: Unit 1 8086 Architecture

Segment Registers

Are Address registers Store the memory addresses of instructions

and data Memory Organization

Each byte in memory has a 20 bit address starting with 0 to 220-1 or 1 meg of addressable memory

27

Page 28: Unit 1 8086 Architecture

Segment Registers (continued)

Addresses are expressed as 5 hex digits from 00000 - FFFFF

Problem: But 20 bit addresses are TOO BIG to fit in 16 bit registers!

Solution: Memory Segment• Block of 64K (65,536) consecutive memory

bytes• A segment number is a 16 bit number

28

Page 29: Unit 1 8086 Architecture

Segment Registers (continued)

Segment numbers range from 0000 to FFFF

Within a segment, a particular memory location is specified with an offset

An offset also ranges from 0000 to FFFF

29

Page 30: Unit 1 8086 Architecture

Segment Registers (continued)

If the segment address is for example, 2915, then the addresses in this segment start at 2915:0000 and go up to 2915:FFFF, which is the highest address in this particular segment.

This range expressed in terms of absolute or physical addresses is from 29150 through 3914F. The relationship between a segment and the register which defines it is shown below.

30

Page 31: Unit 1 8086 Architecture

Segment Registers (continued)

31Memory Model for 20-bit Address Space

Page 32: Unit 1 8086 Architecture

Memory Segmentation

32

Page 33: Unit 1 8086 Architecture

Memory Segmentation

33

Page 34: Unit 1 8086 Architecture

Memory Address Generation

34

Physical Address (20 Bits)

Adder

Segment Register (16 bits) 0 0 0 0

Offset Value (16 bits)

Page 35: Unit 1 8086 Architecture

Memory Address Generation

to calculate physical memory address

35

Page 36: Unit 1 8086 Architecture

Flag Register

36

Carry flag

Parity flag

Auxiliary flag

Zero

Overflow

Direction

Interrupt enable

Trap

Sign6 are status flags3 are control flag

Page 37: Unit 1 8086 Architecture

Pinout Diagram

37

Page 38: Unit 1 8086 Architecture

Minimum mode operation

38

Ground

Power Supply5V 10%

ClockDuty cycle: 33%

ResetRegisters, seg regs,

flagsCS: FFFFH, IP: 0000H If high for minimum 4

clks

Page 39: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

39

Address/Data Bus:Contains address bits A15-A0 when ALE is 1 & data bits D15 – D0 when ALE is 0.

Address Latch Enable:When high, multiplexed address/data bus contains address information.

Page 40: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

40

INTERRUPT

Non-maskable interrupt

Interrupt acknowledgeInterrupt request

Page 41: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

41

Direct Memory Access

Hold acknowledge

Hold

Page 42: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

42

Address/Status BusAddress bits A19 – A16 & Status bits S6 – S3

S6: Logic 0.

S5: Indicates condition of IF flag bits.

S4-S3: Indicate which segment is accessed during current bus cycle:

Page 43: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

43

Bus High Enable/S7Enables most significant data bits D15 – D8 during read or write operation.S7: Always 1.

BHE#, A0:0, 0: Whole word (16-bits)

0,1: High byte to/from odd address

1,0: Low byte to/from even address

1,1: No selection

Page 44: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

44

Min/Max modeMinimum Mode: +5VMaximum Mode: 0V

Min mode pins

Page 45: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

45

Page 46: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

46

Page 47: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

47

Page 48: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

48

Read Signal

Write Signal

Memory or I/0

Data Bus EnableUsed by external data bus buffers

Page 49: Unit 1 8086 Architecture

Maximum mode operation

49

Page 50: Unit 1 8086 Architecture

Maximum mode operation ( Conti..)

50

Page 51: Unit 1 8086 Architecture

Maximum mode operation ( Conti..)

51

Status SignalInputs to 8288 to generate eliminated signals due to max mode.

S2 S1 S0 000: INTA001: read I/O port010: write I/O port011: halt100: code access101: read memory110: write memory111: none -passive

Page 52: Unit 1 8086 Architecture

Maximum mode operation ( Conti..)

52

DMA Request/Gra

nt

Page 53: Unit 1 8086 Architecture

Maximum mode operation ( Conti..)

53

Lock Output

Lock OutputUsed to lock peripherals off the systemActivated by using the LOCK: prefix on any instruction

Page 54: Unit 1 8086 Architecture

Maximum mode operation ( Conti..)

54

Queue StatusUsed by numeric coprocessor (8087)

QS1 QS000: Queue is idle01: First byte of opcode10: Queue is empty11: Subsequent byte of opcode

Page 55: Unit 1 8086 Architecture

Address Decoding

I/O: Memory mapped I/O & I/O Mapped I/O

Memory mapped IO Uses the same address bus to address both

memory and I/O devices, and the CPU instructions used to access the memory are also used for accessing devices

55

Page 56: Unit 1 8086 Architecture

Minimum mode operation ( Conti..)

I/O mapped IO, PORT mapped IO, Peripheral IO Uses a special class of CPU instructions

specifically for performing I/O. Specifically the IN and OUT instructions which can read and write one to four bytes to an I/O device. I/O devices have a separate address space from general memory

56