69
Lecture 5, THE HARDWARE STRUCTURE OF 8086 IT09 406: Microprocessor Based Design

Lecture-5-The Hardware Structure of 8086

Embed Size (px)

Citation preview

Page 1: Lecture-5-The Hardware Structure of 8086

Lecture 5, THE HARDWARE STRUCTURE OF 8086

IT09 406: Microprocessor Based Design

Page 2: Lecture-5-The Hardware Structure of 8086

2

Differences between 8086 and 8088

Page 3: Lecture-5-The Hardware Structure of 8086

3

8088 CPU pin diagram

Page 4: Lecture-5-The Hardware Structure of 8086

4

8086 CPU pin diagram

Page 5: Lecture-5-The Hardware Structure of 8086

5

Modes of 8086● Minimum mode – when used in

uniprocessor configuration● Maximum mode – when used in

multiprocessor configuration

Page 6: Lecture-5-The Hardware Structure of 8086

6

8086 pins in the minimum mode

Page 7: Lecture-5-The Hardware Structure of 8086

7

De-multiplexing the Address/Data Bus● The 8086 chip is a 40 pin DIP● The 8086 has 16 data lines and 20 address

lines ● Data and address lines are multiplexed – i.e.,

the lower address lines are carried by the data lines in the beginning

● The action of separating address and data is called

de-multiplexing

Page 8: Lecture-5-The Hardware Structure of 8086

8

Block diagram of the de-multiplexed address/data bus

Page 9: Lecture-5-The Hardware Structure of 8086

9

Latching the address lines● The lower address lines are to be latched,

and the use of the latch IC 74LS373 is sought● The ALE (Address Latch Enable) outputted by

the processor is used as a clock for the latch

Page 10: Lecture-5-The Hardware Structure of 8086

10

Pin diagram of the octal latch IC 74LS373

Page 11: Lecture-5-The Hardware Structure of 8086

11

The buffered and de-multiplexed address bus

Page 12: Lecture-5-The Hardware Structure of 8086

12

Data bus and control pins● The data bus is bidirectional ● It may sometimes not have sufficient driving

capacity to provide current• Hence it is usually buffered by a tri-state bi-

directional chip 74LS 245•The control signals for read and write are

unidirectional•For buffering the control signal, the IC 74LS244

is used, which is a unidirectional tri-state buffer

Page 13: Lecture-5-The Hardware Structure of 8086

13

Buffered data bus and control pins

.

Page 14: Lecture-5-The Hardware Structure of 8086

14

Pin diagram of the octal tri-state bidirectional buffer 74LS245

Page 15: Lecture-5-The Hardware Structure of 8086

15

Memory and I/O● The 8086 generates control signals for reading

and writing, but does not distinguish between memory and I/O operations

● For this, additional logic is used

Page 16: Lecture-5-The Hardware Structure of 8086

16

Generation of memory and I/O read/write signals

Page 17: Lecture-5-The Hardware Structure of 8086

17

Clock Generation● One cycle of the clock is called a T state, and

all timings and delays are multiples of this T state duration

● There is no circuitry inside the processor for

this, and so an external clock generator IC is used

● Intel has provided the clock generator IC 8284A which is compatible with 8086/8088

Page 18: Lecture-5-The Hardware Structure of 8086

18

Pin configuration of the clock generator 8284A

Page 19: Lecture-5-The Hardware Structure of 8086

19

Clock generator IC● The clock generator IC performs a few more

functions than just supplying the clock frequency to the processor

. ● The crystal is connected between the X1 and

X2 pins.

● The READY output pin of 8284A is connected to the READY input pin of 8086.

● This pin is used to overcome the timing inconsistencies that are possible when a slow peripheral/memory device is connected to the processor

Page 20: Lecture-5-The Hardware Structure of 8086

20

Connections of the clock generator IC to 8086

Page 21: Lecture-5-The Hardware Structure of 8086

21

Reset● An active low reset signal from the control

bus is sent to the 8284 which synchronizes it with the trailing edge of the clock

● Most systems include a line that goes to all system components and is possibly controlled by an operator push button (or just after power on), which causes a low signal on the RESET pin of the clock generator

Page 22: Lecture-5-The Hardware Structure of 8086

22

Reset Timings and reset vector

● The RESET line of 8086 must remain high for at least 4 clock periods

● The 8086 will terminate operations on the high-going edge of RESET and will remain dormant as long as RESET is HIGH

● A high on the RESET pin of the processor causes all system components to be reset, and inside it, the instruction queue, PSW, DS, SS, ES and IP are cleared

● CS gets a value of FFFFH and with IP = 0000, the first instruction will be executed from the location FFFF0H

Page 23: Lecture-5-The Hardware Structure of 8086

23

‘Power on reset’ circuit

Page 24: Lecture-5-The Hardware Structure of 8086

24

Charging of the capacitor and generation of reset pulse

Page 25: Lecture-5-The Hardware Structure of 8086

25

The generation of the reset pulse using a Schmitt trigger (inside the 8284 IC)

Page 26: Lecture-5-The Hardware Structure of 8086

26

Meeting the reset pulse specifications

Page 27: Lecture-5-The Hardware Structure of 8086

27

Machine/Bus cycles● Any read or write cycle is called a bus cycle.

For 8086, a bus cycle takes four T states, where one T state is defined as the ‘period’ of the clock

● If the clock frequency is 10 MHz, one T state = 0.1 usecs or 100 nsecs

● A bus cycle is also called a machine cycle● During a machine cycle, a specific operation –

say, reading or writing is accomplished.

Page 28: Lecture-5-The Hardware Structure of 8086

28

Typical machine cycles● Memory Read● Memory Write● I / O Read● I / O Write● Interrupt Acknowledge

Page 29: Lecture-5-The Hardware Structure of 8086

29

Read Machine Cycle● Place on the address bus, the address of the

location whose content is to be read. This action is performed by the processor.

● Assert the read control signal which is part of the control bus.

● Wait until the content of the addressed location appears on the data bus.

● Transfer the data on the data bus to the processor.

• De-activate the read control signal. The read operation is over and the address on the address bus is not relevant anymore.

Page 30: Lecture-5-The Hardware Structure of 8086

30

Read machine cycle timing diagram

Page 31: Lecture-5-The Hardware Structure of 8086

31

Wait Cycles● If the access time for a device is longer than

that permitted by 8086 timing, extra clock cycles termed ‘wait states’ have to be inserted in the bus cycle

● Sample the READY line at the end of T2. If the READY signal is found low, an extra T state is inserted into the bus cycle, between T3 and T4, which is designated as TW

● All signals on the bus remain unchanged during this extra wait state (TW)

● In the middle of TW, once again the READY signal is checked. If it is at logic 1, the next T state will be T4 – otherwise, another wait state TW will be inserted

Page 32: Lecture-5-The Hardware Structure of 8086

32

Sampling the READY signal and inserting wait states

Page 33: Lecture-5-The Hardware Structure of 8086

33

Insertion of a wait state generator to add wait states

Page 34: Lecture-5-The Hardware Structure of 8086

34

● What is the duration of the bus-cycle in an 8086 based microcomputer, if the clock frequency is 12 MHz and three wait states are inserted?

Example 6.1

Page 35: Lecture-5-The Hardware Structure of 8086

35

Example 6.1 Solution

● The period of a 12 MHz microprocessor is T = 1/f = 83 ns.

● Thus, the duration of the bus-cycle, without any wait-states is given by: Tbus-cycles = 4* T = 4* 83 ns = 332 ns

● Duration of the wait-states is, Tw = 3* T = 249 ns

● So the extended bus-cycle Tbus-cycle+ Tw = 332 + 249

= 581 ns

Page 36: Lecture-5-The Hardware Structure of 8086

36

Simplified write machine cycle timing

Page 37: Lecture-5-The Hardware Structure of 8086

37

Other Processor Activities

● Interrupt Lines● It has an INTR line and an NMI (Nonmaskable

Interrupt) line for external interrupts

Page 38: Lecture-5-The Hardware Structure of 8086

38

DIRECT MEMORY ACCESS(DMA)

● This is the method of transferring data between the memory and a peripheral without involving the processor

● During the time of DMA, the buses of the processor are tri-stated

•The pins HOLD and HLDA are devoted to DMA operation

Page 39: Lecture-5-The Hardware Structure of 8086

39

Concept of direct memory access

Page 40: Lecture-5-The Hardware Structure of 8086

40

Timing of the HOLD and HLDA signals

Page 41: Lecture-5-The Hardware Structure of 8086

41

TEST and BHE pins● Both these pins are active low● The TEST pin is used to synchronize the

activities of the 8086 with an arithmetic co-processor 8087(refer Chapter 13)

● The BHE (Bus High Enable) is used to enable high bank of memory (refer Chapter 7)

Page 42: Lecture-5-The Hardware Structure of 8086

42

Halt Machine Cycle● Another machine cycle is the HALT machine

cycle. The processor enters this machine cycle in response to a HLT (Halt) instruction

● To bring the processor out of this state, an interrupt or

a RESET signal must be issued

Page 43: Lecture-5-The Hardware Structure of 8086

43

8086 in the minimum mode configuration

Page 44: Lecture-5-The Hardware Structure of 8086

44

Maximum Mode● In this mode, which is used for multi

processing ,the processor needs a lot more pins

● Some pin designations are changed● The pins that are lost are retrieved by

generating them by using a bus controller IC 8288

Page 45: Lecture-5-The Hardware Structure of 8086

45

Maximum mode pins of 8086

Page 46: Lecture-5-The Hardware Structure of 8086

46

Control Signals Generated by the Bus Controller

Page 47: Lecture-5-The Hardware Structure of 8086

47

Pin diagram of the bus controller IC 8288

Page 48: Lecture-5-The Hardware Structure of 8086

48

Connection between the 8086 and 8288

Page 49: Lecture-5-The Hardware Structure of 8086

49

REQUEST/GRANT pins● These are two bi-directional, active low pins,

on which other processors in a multi processing system can place their bus requests

Page 50: Lecture-5-The Hardware Structure of 8086

50

Page 51: Lecture-5-The Hardware Structure of 8086

51

Queue Status pins QS0, QS1

● These pins are inputs to the 8086● It becomes useful when an arithmetic

coprocessor is the second processor in the system

● Since the co-processor is expected to work in step with 8086, the co-processor can interrogate the 8086 about its queue status, on these lines, and decide its course of action accordingly

● More details are given in Chapter 13

Page 52: Lecture-5-The Hardware Structure of 8086

52

The LOCK signal● The active low LOCK signal can be used to

prevent other bus masters from acquiring the bus of the 8086

● For example, if the 8086 wants to retain the bus until a string transfer is completed fully, it can use the instruction (say) LOCK REP MOVSB

● So the processor does not have to relinquish the bus after one bus cycle, as may be the case if the LOCK prefix is not used

● Instead, the bus is retained until the complete string

operation is over

Page 53: Lecture-5-The Hardware Structure of 8086

53

Maximum mode configuration of the 8086

Page 54: Lecture-5-The Hardware Structure of 8086

54

Instruction Cycle

● The time taken by the processor to execute an instruction is called an instruction cycle, and it is specified in terms of the number of clock cycles needed to do it

● The operation of the CPU is just ‘fetch, decode and execute’

● Once an instruction is fetched and is ready for execution, it will be decoded immediately, and after that, execution can be set in motion

Page 55: Lecture-5-The Hardware Structure of 8086

55

FETCH – EXECUTE CYCLE

● The fetch-execute cycle can be decomposed into 6 stages:

FI – Fetch instruction

DI – Decode instruction

CO – Calculate operand addresses

FO – Fetch operands

EI – Execute instruction

WO – Write or store result in memory

Page 56: Lecture-5-The Hardware Structure of 8086

56

● The time for all these activities should constitute the ‘instruction cycle’

● Because of pre-fetching, the fetch time is usually not a part of the instruction cycle

● But calculation of the effective address does take time

Page 57: Lecture-5-The Hardware Structure of 8086

57

Execution Times of Some Sample Instructions

Page 58: Lecture-5-The Hardware Structure of 8086

58

Table 6.4 | Number of Cycles Expended in Calculating the ‘Effective Address

Page 59: Lecture-5-The Hardware Structure of 8086

59

Delay Loops● MOV CX, 100 ;4 cycles

HERE: LOOP HERE ;17 / 5 cycles

Delay cycles: 4 + (17 × 100) −12 = 1692 cycles

For a system with 12 MHz, one clock period is 0.083 usecs

Total delay = 140 usecs

Page 60: Lecture-5-The Hardware Structure of 8086

60

Example 6.2● Write a program to create a delay of 1 msec.

Page 61: Lecture-5-The Hardware Structure of 8086

61

Example 6.2 – Solution

Page 62: Lecture-5-The Hardware Structure of 8086

62

Example 6.2 – Calculation

Page 63: Lecture-5-The Hardware Structure of 8086

63

Example 6.3

● Write a delay loop with appropriate values of the count to get a delay of 1 second

Page 64: Lecture-5-The Hardware Structure of 8086

64

Example 6.3 – Solution

Page 65: Lecture-5-The Hardware Structure of 8086

65

Example 6.3 – Calculation● The inner loop is that which corresponds to the

LOOP instruction. It repeats N2 times, which is the count in the CX register

● The LOOP instruction plus a few overheads (caused by the instructions MOV CX, N2 and DEC BX) repeat N1 times, which is the count of the outer loop

Page 66: Lecture-5-The Hardware Structure of 8086

66

Calculation – Contd.● Thus a large delay can be obtained. To calculate N1 and N2, the

best way would be to make N2 = FFFFH and then get a corresponding value for N1

● For a total delay of 1 second,

Total cycles = N1 × [17 × N2 + 4 + 2 + 16] = N1 [22 + 17 N2]● If N2 = FFFFH i.e., 65,535 the calculation comes to

1114117 × N1 × .083 = 1000 000 usecs

92471.711 × N1 = 1000000● N1 = 10.81● Thus, a value of 11 (0BH) can be used in the place of N1 in the

program

Page 67: Lecture-5-The Hardware Structure of 8086

67

Why Delay Loops?● Generating delays in this manner is called

‘software delay’. One can generate a square wave using a software delay

● Delay loops can also be used to generate events spaced intime

Page 68: Lecture-5-The Hardware Structure of 8086

68

Example 6.4

● Generate a square wave of frequency 1 KHz at the output port with address 78H

Page 69: Lecture-5-The Hardware Structure of 8086

69

Example 6.4 – Solution