Advance Processors UNIT-1
Advance Processors UNIT-1
UNIT-1
Page 1
Advance Processors
UNIT-1
Page 2
Advance Processors
UNIT-1
- In 8086 CPU is divided into two independent functional parts BIU and EU.
- Dividing the work between these two units’ speeds up the processing.
➢ BIU (Bus Interface Unit)
Components of BIU
- Instruction queue
It holds the instruction bytes of the next instruction to be executed by EU
- Segment Registers
Four 16-bit register that provides powerful memory management mechanism
ES (extra segment), CS (code segment), SS (stack segment) , DS (data segment).
The size of each register is 64kb.
- Instruction pointer (IP)
Register that holds 16-bit address or offset of next code byte within code segment
- Address Generation and bus control
Generation of 20-bit physical address
Page 3
Advance Processors
UNIT-1
Page 4
Advance Processors
UNIT-1
Page 5
Advance Processors
UNIT-1
Index registers
The Index Registers are as follows:-
1. Source Index (SI): SI is a 16-bit register used for indexed, based indexed and register indirect
addressing, as well as a source data addresses in string manipulation instructions.
2. Destination Index (DI) : DI is a 16-bit register. DI is used for indexed, based indexed and register
indirect addressing, as well as a destination data addresses in string manipulation instructions.
Flag Registers
1. The 16-bit flag register of 8086 contains 9 active flags (six conditional & 3 control flags), other 7
flags are undefined.
2. Status Flags: It indicates certain condition that arises during the execution. They are controlled by
the processor.
3. Control Flags: It controls certain operations of the processor. They are deliberately set/ reset by the
user.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
U U U U OF DF IF TF SF ZF U AF U PF U CF
Control Flags
Control flags are set or reset deliberately to control the operations of the execution unit.
4. Trap Flag (TF):
- It is used for single step control.
- It allows user to execute one instruction of a program at a time for debugging.
- When trap flag is set, program can be run in single step mode.
5. Interrupt Flag (IF):
- It is an interrupt enable/disable flag.
- If it is set, the mask able interrupt of 8086 is enabled and if it is reset, the interrupt is disabled.
- It can be set by executing instruction sit and can be cleared by executing CLI instruction.
Page 6
Advance Processors
UNIT-1
Page 7
Advance Processors
UNIT-1
Advantage:
- Operand can be accessed quickly as they are directly available in instruction queue.
- No need of External bus or bus-cycles to obtain data.
- No memory reference to fetch data
- Comparatively Faster execution
Limitation:
- The operand can only be used as a source operand.
- Value of the operand will remain Constant
2. Register Addressing Mode
- The operand is stored in one of the CPU register.
- Register may be used as source operand or destination operand or both
- E.g. ADD r1, r2; adding r1 and r2 and store the result in r2
E.g. MOV AX,BX ; move value from BX to AX register
Advantage:
- This mode is normally preferred, as the execution of instruction is faster and compact, because all
the registers reside on the same chip.
- Therefore, data transfer is within the chip and no External bus is required.
Limitation:
- Number of CPU registers are limited
Page 8
Advance Processors
UNIT-1
E.g.
MOV [30540], TEMP; moving value of TEMP to memory location [30540]
DS=3060 and direct memory address=0030
3 0 6 0 0 (‘0’ is added to LSB by BIU)
+ 0 0 3 0 ( direct address)
3 0 6 3 0 (physical address)
-
E.g. MOV [DI], BX; value of BX is moved to the memory location specified in DI
MOV [BX], AX ; value of AX is moved to the memory location specified in BX
Page 9
Advance Processors
UNIT-1
Benefit:
- Large address space
Limitation:
- Slower access, as multiple memory accesses is needed to find operand.
5. Based Addressing Mode
When memory is accessed PA is computed from BX and DS, when the stack is accessed PA is computed
from BP and SS.
Equation:
PA ={starting address of Segment Register } + { [BX] or [BP] }+ (8 or 16 bit) displacement
E.g. MOV AL, TEMP [BX]; segment register address+ BX+ offset
MOV AL, TEMP [BP]; segment register address+ BP+ offset
Assume DS=3060, BX=0050 and displacement=08
3 0 6 0 0 H (starting address of segment register)
+ 0 0 5 0 H(base register)
+ 0 8 H(offset)
3 0 6 5 8 H(physical address)
6. Indexed Addressing Mode
- In this addressing mode offset address is added to index register and finally the sum is added to
segment register.
- E.g. MOV BH, TEMP [SI] ; TEMP is the offset address
Equation:
PA ={starting address of Segment Register } + { [SI] or [DI] }+ (8 or 16 bit) displacement
Assume DS=3060, SI=0050 and displacement=08
3 0 6 0 0 H (starting address of segment register)
+ 0 0 5 0 H (Source Index)
+ 0 8 H (offset)
3 0 6 5 8 H (physical address)
Page 10
Advance Processors
UNIT-1
5 3 4 0 8 H (physical address)
Page 11
Advance Processors
UNIT-1
Page 12
Advance Processors
UNIT-1
Page 13
Advance Processors
UNIT-1
Page 14
Advance Processors
UNIT-1
S4 S3 Register
0 0 ES
0 1 SS
1 0 CS
1 1 DS
iii. BHE/S7
- BHE stands for Bus High Enable.
- Active low output signal.
- BHE signal is used to indicate the transfer of data over higher order data bus (D8 – D15).
- 8-bit I/O devices use this signal.
- S7 is reserved for future development.
➢ Control Pins
i. TEST
- Active low input signal.
- It is used to test the status of math coprocessor 8087.
- The BUSY pin of 8087 is connected to this pin of 8086.
- If low, execution continues, else microprocessor is in wait state.
ii. MN/MX
- Input signal
- 8086 works in two modes:
- Minimum Mode [Active high input signal]
- Maximum Mode [ Active low input signal]
- If MN/MX is high, it works in minimum mode.
- If MN/MX is low, it works in maximum mode.
- Pins 24 to 31 issue two different sets of signals.
- One set of signals is issued when CPU operates in minimum mode.
- Other set of signals is issued when CPU operates in maximum mode.
iii. RD (READ)
- It is an active low output signal.
- It is a read signal used for read operation.
- When the signal is low, then read from memory or I/O
➢ Mode Multiplexed pins
i. INTA (QS1)
- It is an active low output signal.
- This is an interrupt acknowledge signal.
- When microprocessor receives INTR signal, it acknowledges the interrupt by generating this signal.
ii. ALE(QS0)
- It is an active high output signal and remains high during T1 state.
Page 15
Advance Processors
UNIT-1
Page 16
Advance Processors
UNIT-1
Page 17
Advance Processors
UNIT-1
- Since a memory read or write should be complete within one bus-cycle (4-CLK pulses, T1 -T4),
related timing states as follows:
- T1 (1st clock pulse)- starts the bus cycle. Actions include setting control signals to give the
required logic values for IO/M, ALE, DT/R and a valid address onto the address bus.
- T2 - the RD or WR control signals are issued, DEN is asserted and in the case of a write, data is
put onto the data bus.
- The DEN 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 and if READY is low, wait state (TW) is
inserted before T3 begins.
- T3 - this clock period is provided to allow memory to access the data. If the bus cycle is a read
Page 18
Advance Processors
UNIT-1
cycle, the data bus is sampled at the end of T3 or the 3rd clock pulse of the bus-cycle.
- T4 - all bus signals are deactivated in preparation for the next clock cycle.
- The 8088 also finishes sampling the data (in a read cycle) in this period.
- For the write cycle, the trailing edge of the WR signal transfers data to the memory.
- Hence the timing diagram can be categorized in two parts, the first is the timing diagram for read
cycle and the second is the timing diagram for write cycle shown below.
Figure: Read Cycle of Minimum Mode Figure: Write Cycle of Minimum Mode
Read Cycle
To complete the minimum-mode memory-read bus-cycle, the required control signals with appropriate
active logic levels are :
- IO/M = ‘logic 0’, to select memory interface
- MN/MX = ‘logic 1’, to select minimum-mode of operation
- DT/R = ‘logic 0’, to activate the data-receive mode of ‘Data-bus-buffer’
- Valid Physical-address of memory-location via address-bus (A19 to A0)
- ALE-pulse, to latch the valid Physical-address
- RD = ‘logic 0’, to initiate reading data into CPU. Note, WR = ’logic 1’
- DEN = ‘0’, enables the ‘Data-Bus-transceiver-buffer’ to let data pass
- Reset RD=DEN=’logic1’, to END the read-bus-cycle.
Write Cycle
To complete the minimum-mode memory-write bus-cycle, the required control signals with appropriate
active logic levels are :
- IO/M = ‘logic 0’, to select memory interface
- MN/MX = ‘logic 1’, to select minimum-mode of operation
- DT/R = ‘logic 1’, to activate the data-transmit mode of ‘Data-bus-buffer’
- Valid Physical-address of memory-location via address-bus (A19 to A0)
- ALE-pulse, to latch the valid Physical-address.
- WR = ‘logic 0’, to initiate memory data writing. Note, RD = ’logic 1’
- DEN = ‘0’, enables the ‘Data-Bus-transceiver-buffer’ to let data pass
- Reset WR=DEN=’logic1’, to END the write-bus-cycle.
-
Page 19
Advance Processors
UNIT-1
- In Maximum mode, for multiprocessor environment WR, IO/M, DT/R, DEN, ALE, INTA signals are
not available. Instead available signals are as follows:-
MRDC (memory read command)
MWRT (memory write command)
IORC (I/O read command)
IOWC (I/O write command)
INTA (interrupt acknowledge)
Page 20
Advance Processors
UNIT-1
- The below table shows the Operation carried out by Maximum Mode.
S2 S1 S0 Machine Language
0 0 0 Interrupt acknowledgement
0 0 1 Read I/O
0 1 0 Write I/O
0 1 1 HALT
1 0 0 Code Access
1 0 1 Read Memory
1 1 0 Write Memory
1 1 1 Passive
Table: Operation carried out by Maximum Mode
Figure: Read Cycle of Maximum Mode Figure: Write Cycle of Maximum Mode
Read Cycle
To complete the minimum-mode memory-read bus-cycle, the required control signals with appropriate
active logic levels are :
- IO/M = ‘logic 0’, to select memory interface
- MN/MX = ‘logic 0’, to select maximum-mode of operation
- DT/R = ‘logic 0’, to activate the data-receive mode of ‘Data-bus-buffer’
- Valid Physical-address (A0 to A19) and BHE signal is generated by CPU
- ALE-pulse, to latch the valid Physical-address.
- Proper status code S0 to S2 (as shown in table of slide 8) is generated by
- CPU to initiate data reading (MRDC) from the desired memory bank
- DEN = ‘1’, enables the ‘Data-Bus-transceiver-buffer’ to let data pass
- Reset MRDC and DEN signals to END the read-bus-cycle
Page 21
Advance Processors
UNIT-1
Write Cycle
To complete the maximum-mode memory-write bus-cycle, the required control signals with appropriate
active logic levels are :
- IO/M = ‘logic 0’, to select memory interface
- MN/MX = ‘logic 0’, to select maximum-mode of operation
- DT/R = ‘logic 1’, to activate the data-transmit mode of ‘Data-bus-buffer’
- Valid Physical-address (A0 to A19) and BHE signal is generated by CPU
- ALE-pulse, to latch the valid Physical-address.
- Proper status code S0 to S2 (as shown in table of slide 8) is generated by
- CPU to initiate data writing (MRTC) from the desired memory bank
- DEN = ‘1’, enables the ‘Data-Bus-transceiver-buffer’ to let data pass
- Reset MRTC and DEN signals to END the read-bus-cycle
9. Differentiate minimum and maximum mode of 8086.
Ans Maximum Mode
i. When MN/MX (bar) low 8086 is in maximum mode.
ii. There are multiple processors in the system
iii. Maximum mode unique signals
Name Function
RQ/GT Request/ Grant bus access control
0,1
LOCK Bus priority lock control
Status Bus cycle status
QS 0,1 Instruction queue status
iv. In maximum mode interfacing, master/slave and multiplexing and several such control signals
are required.
v. In maximum mode a bus controller is required to produce control signals. This bus controller
produces MEMRDC, MEMWRC, IORDC, IOWRC, ALE, DEN, DT/R control signals.
vi. Maximum mode operation control signals must be generated externally requires an additional
external bus controller 8288. Thus maximum mode operation is more expensive.
Minimum Mode
i. When MN/MX (bar) high 8086 is in minimum mode.
ii. There is only one processor in the system minimum mode.
iii. In minimum mode no interfacing or master/slave signals is required.
iv. In minimum mode direct RD WR signals can be used. No bus controller required. A simple de-
multiplexer would do the job of producing the control signals.
Minimum mode operation is less expensive as all the control signal is generated for the
input/output and memory by processor itself.
Page 22
Advance Processors
UNIT-1
Page 23
Advance Processors
UNIT-1
16. What is the minimum and maximum size of a segment in 8086? How are they computed?
Ans - In 8086 microprocessor the total memory addressing capability is 1 mega bytes.
- For representing 1MB there are minimum 4 hex digits are required i.e., 20 bits, but 8086 has
fourteen 16-bit registers. That is there are no registers for representing 20 bit address. So, the
total memory is divided into 16 logical segments and each segment capacity is 64 KB (kilo bytes).
- That is 16*64kb=1 MB. So, for representing 64 kb only 16 bit register is sufficient.
- Therefore, Size of segments is from minimum 64KB to maximum 1MB.
17. Explain Memory Models in 8086
Ans The Memory models used in 8086 are as follows:-
- Tiny: Code and data combined must be less than 64K
- Small: Code <=64K and Data<= 64K
- Medium: Data<=64K code any size multiple code segment
- Compact: Code<=64K data any size multiple data segment
- Large: Code>64K and data>64K multiple code and data segment
- Huge: Same as the Large except that individual section can be > 64K
Page 24