Module 1
Module 1
AIM
.
A microprocessor is a computer processor which incorporates the
functions of a computer's central processing unit (CPU) on a single
integrated circuit (IC).
The integration of a whole CPU onto a single chip or on a few chips greatly
reduced the cost of processing power
•In 1974, Intel launched the first general purpose 8-bit microprocessor 8008
•This microprocessor was used on the world's first personal computer, named
Altair.
•Main limitation of 8-bit processor was low speed, low memory addressing
capability, limited number of general purpose registers, and less powerful
instruction set
Architecture
SP
BH BL
BX
SI
CH CL
DI
CX
DH DL
DX Segment
CS
Flags DS
IP ES
Registers
Contain results of
ALU computations
Architecture
The BIU fetches instructions, reads and writes data, and computes the 20-bit address.
Opcode is fetched by the BIU
The EU decodes and executes the instructions using the 16-bit ALU.
BIU along with EU thus forms a pipeline.
ES Extra Segment
BIU registers
(20 bit adder) CS Code Segment
SS Stack Segment
DS Data Segment
IP Instruction Pointer
EU registers AX AH AL Accumulator
BX BH BL Base Register
CX CH CL Count Register
DX DH DL Data Register
SP Stack Pointer
BP Base Pointer
SI Source Index Register
DI Destination Index Register
FLAGS
While the fetched instruction is executed internally, the
external bus is used to fetch the machine code of the
next instruction and arrange it in a queue called as
predecoded instruction byte queue.
This is a 6 byte long queue, works in first-in first-out
policy.
While the opcode is fetched by the bus interface unit
(BIU), the execution unit (EU) executes the previously
decoded instruction concurrently.
The CPU 8086 is able to address 1
Mbytes of physical memory.
The compete 1 Mbytes memory can
be divided into 16 segments, each of
64 Kbytes size.
The addresses of the segment may
be assigned as 0000H to F000H
respectively.
The offset values are from 0000H to
FFFFH.
If the segmentation is done as per
above mentioned way, the segments
are called non-overlapping segments.
In some cases segment may overlap
also. Suppose a segment starts at a
particular address and its maximum
size can go up to 64 Kbytes. But if
another segment starts before this
64 Kbytes location of the first
segment, the two segments are said
to be overlapping segment.
The area of memory from the start of
the second segment to the possible
end of the first segment is called as
overlapped segment.
FLAG REGISTER
FLAG REGISTER
Signal Description of 8086
8086 is a 16 bit CPU
40 pin package
AD15 – AD0:
Address/Data bus lines. These are multiplexed lines.
Address remains in lines during T1 state
Data remains in lines during T2,T3,Tw,T4 states
A19/S6 – A16/S3:
Address/Status bus bits are multiplexed to provide
address signals A19-A16 and status bits S6-S3.
S6 – always remains 0
S5 – indicates the condition of the interrupt flag
S4 and S3 – Indicate the segment being accessed
during current bus cycle.
34
RD:
When this read signal pin is at logic 0, the data bus is
receptive to data from memory or I/O devices.
READY:
This pin is used to enforce a waiting state.
READY pin at 0 – the microprocessor goes into idle
state.
READY pin at 1 – the microprocessor does normal
operation.
35
INTR:
Interrupt request pin is used to request a
hardware interrupt.
INTA becomes active when interrupt is being
serviced.
TEST:
Test pin is an input that is tested by the WAIT instruction.
If the test pin is at logic 0, execution will continue.
If the test pin is at logic 1, processor remains in an idle state
36
NMI:
Non-maskable interrupt input is similar to
INTR expect that the NMI interrupt does not
check priority.
RESET:
If this reset pin is held high the microprocessor
terminate the current activity and It begins execution
from memory location FFFF0H.
CLK:
The clock pin is used to connect a clock generator
37
Vcc:
The power supply. +5V should be
connected to this pin.
GND:
The ground connection for the microprocessor.
MN/MX:
The minimum/maximum mode pin selects
the mode for the processor.
Minimum- single processor
Maximum - multiprocessor
38
BHE/S7:
The bus high enable pin is used in the 8086 to
enable the Most significant data bus bits(D15-D8)
during a read or write operation.
S7 is not currently used
BHE A0 Indication
0 0 Whole word
0 1 Upper byte from or to odd address
1 0 Lower byte from or to even address
1 1 None
39
Pin Connections ( Minimum)
IO/M
This pin indicates whether the address bus
contains a memory address or an I/O port
address.
WR:
The write line is used when the
microprocessor is writing data to memory
and the memory bus contains a valid
address.
40
INTA:
Interrupt acknowledgement signals is a response to INTR input pin.
ALE:
Address Latch enable shows whether the multiplexed AD lines carry address
or data.
DT/R:
Data transmit/receive shows that the microprocessor data bus is
transmitting(1) or receiving(0) data. This is used to control buffers.
41
DEN:
Data Enable bus indicates the availability of valid data on the address/data
lines.
HOLD,HLDA:
HOLD pin is used to input request DMA.
Hold set to 1 microprocessor gives up control of buses to DMA controller.
The processor issues the hold acknowledge signal on HLDA pin
42
Maximum Mode Pins
S2 S1 S0 Indication
0 0 0 Interrupt Acknowledge
0 0 1 Read I/O port
0 1 0 Write I/O port
0 1 1 Halt
1 0 0 Code Access
1 0 1 Read Memory
1 1 0 Write Memory
1 1 1 Passive 43
Maximum Mode Pins
LOCK:
Lock output is used to lock peripherals off the system.
BHE A0 Indication
0 0 Whole word
0 1 Upper byte from or to odd address
1 0 Lower byte from or to even address
1 1 None
45
Addressing Modes of 8086
Immediate
the data is provided in the instruction
MOV AX,[5000H]
Effective address: 10*DS+5000
Register
operand is in a register
MOV BX, AX
indirect
instruction specifies a register containing an
address, where data is located.
Offset address is in SI, DI, or BX.
Segments are DS or ES
MOV AX,[SI]
Here data is available at an offset address stored in SI in
DS. The effective address is computed as 10 *DS+SI
Register Relative
Effective address is formed by adding an 8-
bit or 16-bit displacement with registers
BX,BP,SI,DI in the default segment DS or ES
MOV AX,50H[BX]
Effective address: 10*DS+50H+[BX]
Based Indexed
Offset of the operand is obtained by adding the
contents of a base register (BX or BP) to the
contents of an index register SI or DI
MOV AX,[BX],[SI]
Effective address: 10*DS+[BX]+[SI]
Relative Based Indexed
Offset of the operand is obtained by adding
8-bit or 16-bit displacement to the contents of
a base register (BX or BP) and any one of
the index registers(SI or DI)
JMP [BX]
Intersegment Direct Mode
CS and IP of the destination address to which
control is transferred appears directly in the
instruction
JMP 5000H:2000H
Intersegment Indirect Mode
address to which control is transferred is
passed to the instruction as contents of a
memory block containing 4 bytes ie. IP(LSB),
IP(MSB), CS(LSB), CS(MSB).
Starting address of the memory block is
referred by any addressing mode except
immediate mode
JMP [2000H]
Forming the Effective
Address
Example
Offset(displacement) = 5000H
[AX] – 1000H [BX] – 2000H
[SI] - 3000H [DI] – 4000H
[BP] – 5000H [SP] – 6000H
[CS] – 0000H [DS] – 1000H
[SS] – 2000H [IP] – 7000H
Direct Addressing Mode
MOV AX,[5000]
Register Indirect
MOV AX,[BX]
Register Relative
MOV AX,5000 [BX]
Based Indexed
MOV AX,[BX] [SI]
Relative Based Indexed
MOV AX,5000 [BX] [SI]
I/O Addressing Capability
I/O Addressing Capability
Architecture
• Series of 3 pulses
• When the request is detected, processor issues a grant pulse during
T4(current) or T1(Next)
• After use, it sends a release pulse
General Bus Operation