Professional Documents
Culture Documents
L1 Pin Diagram
8086
8086 is a 16-bit microprocessor fabricated using HMOS technology. 8086 has 16-bit ALU; this means 16-bit numbers are directly processed by 8086.It is a 40 pin IC. It operates at 5Mhz.Its enhanced version 8086-2 permits clock frequency 8MHz, and 8086-1, can handle upto 10MHz It has 16-bit data bus, so it can read data or write data to memory or I/O ports either 16 bits or 8 bits at a time. It has 20 address lines, so it can address up to 2 20 i.e. 1048576 = 1Mbytes of memory . Due to the 1Mbytes memory size multiprogramming is made feasible and several multiprogramming features have been incorporated in 8086 design. 8086 includes few features, which enhance multiprocessing capability (it can be used with math coprocessors like 8087, I/O processor 8089 etc. Higher Throughput (Speed)(This is achieved by a concept called pipelining).
8088
NMI is an edge triggered nonmaskable interrupt. NMI is not maskable internally by software. A transition from a LOW to HIGH initiates the interrupt at the end of the current instruction. CLK is for supplying the clock signal that synchronizes the activity within the CPU. READY is for inputting an acknowledge from a memory or I/O interface that input data will be put on the data bus or output data will be accepted from the data bus within the next clock cycle. RESET is for inputting a system reset signal. Most systems include a line that goes to all system components and a pulse is automatically sent over this line when the system is turned on ,or the reset pulse can be manually generated by a switch that allows the operator to reinitialize the system.
RESET (cntd) For the processor this state is having the PSW, IP, DS, SS, ES, and instruction queue cleared and CS set to FFFF. With (IP) =0000 and (CS)=FFFF the processor will begin executing at FFFF0, this location would be a read-only section of memory and would contain a JMP instruction to a program for initializing the system and loading the application software or operating system. Such a program is referred to as a bootstrap loader. Test This signal is used in conjunction with the WAIT instruction and is employed primarily in multiprocessing situations. This input is examined by the ``wait for test'' instruction. If the TEST input is LOW, execution continues, otherwise the processor waits in an``idle'' state. RD indicates that an input operation is to be performed. BHE/S7 If 0 during first part of bus cycle this pin indicates that at least one byte of the current transfer is to be made on pins AD15-AD8;if 1 transfer is made on AD7-AD0.Status S7 is output during the latter part of bus cycle, but S7 presently has not been assigned a meaning.
ADDRESS/STATUS(AD19/S6-AD16/S3): During the first part of a bus cycle pins 35-38 output the 4 higher-order bits of the address, and during the remaining part of the cycle they output status information. Status bits S3 and S4 indicate the segment register that is being used to generate the address and bit S5 reflects the contents of the IF flag.S6 is always held at 0 indicating that an 8086/8088 is controlling the system bus. Vcc +5v Pin definitions fot the Minimum Mode. Pins 24 to 31 are mode dependent. In minimum mode these are defined as under: INTA Indicates recognition of an Interrupt request. Consists of two negative going pulses in two consecutive bus cycles. ALE Outputs a pulse at the beginning of the bus cycle and is to indicate an address is available on the address pins. DEN Output during the latter portion of the bus cycle and is to inform the transceivers that the CPU is ready to send or receive data.
QS1 QS0 Characteristics 0(LOW) 0 No Operation 0 1 First Byte of Opcode from Queue 1(HIGH) 0 Empty the Queue 1 1 Subsequent Byte from Queue S0,S1,S2 Indicates the type of transfer to take place during the current bus cycle: S2 S1 S0 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 Instruction fetch 1 0 1 Read memory 1 1 0 write memory 1 1 1 Inactive-passive
LOCK Indicates the bus is not to be relinquished to other potential bus masters. It is initiated by LOCK instruction prefix. RQ/GT1 For inputting bus requests and outputting bus grants. RQ/GT0 Same as RQ /GT1 except that a request on RQ/GT0 has higher priority.
L2 8086 Architecture
8086 Architecture
8086 Architecture
The 8086 CPU is organized as two separate units, called the Bus Interface Unit (BIU) and the Execution Unit (EU). Bus interface Unit The BIU facilitates communication between the EU and the memory or I/O circuits. It is responsible for transmitting address, data, and the control signals on the buses. It contains CS, DS, ES, SS and IP registers that hold the address of the memory locations. The IP contains the address of the next instruction to be executed by the EU. An internal bus connects the EU and BIU, and they work together. While the EU is executing an instruction the BIU fetches up to six bytes of next instruction and places it in the Instruction Queue to speed up the processor. Execution Unit The purpose of the execution unit is to execute the instruction. It contains a circuit called arithmetic and logic unit (ALU). The ALU can perform arithmetic and logical operations. The data for the arithmetic and logic operations are stored in circuits called registers.
8086 Architecture
Execution Unit(cntd) The EU has eight registers for storing data. They are AX, BX, CX, DX, SI, DI, BP and SP. In addition EU has temporary registers for holding operands for CPU, and the FLAG register whose individual bit reflect the result of a computation. Responsible for decoding and executing instruction. EU accesses the instruction from output end of the instruction queue and data from general-purpose register. During execution, EU may test the status and control flags and update these flags based on the results of execution.
Segment Registers(CONCEPT Of PHYSICAL ADDRESS) Data address may be formed by adding together a combination of BX or BP register contents, SI or DI register contents, and/or a displacement*The word displacement is used to indicate a quantity that is added to the contents of a register(s) to form an EA.]. The result of such an address computation is called an Effective address(EA) or offset. The final data address, however, is determined by EA and the appropriate Data segment, Extra segment or Stack segment registers. Segment group consists of ES,SS,DS,CS registers. The registers that used for addressing, the BX, IP, SP, BP, SI, and DI registers, are only 16bits wide and, therefore an effective address has only 16bits.On the other hand, the address put on the address bus, called the physical address, must contain 20 bits. The extra 4bits are obtained by adding the effective address to the contents of one of the segment registers.
Segment Registers(CONCEPT Of PHYSICAL ADDRESS) cntd The addition is carried out by appending four 0 bits to the right of the number in the segment register before the addition is made. For example if (CS)=123A and (IP)=341B,then the next instruction will be fetched from 341B Effective address 123A0 Beginning segment address -----------157BB Physical address of instruction The utilization of the segment registers essentially divides the memory space into overlapping segments, with each segment being 64k bytes long and beginning at an address that is divisible by 16. The contents of a segment register are referred to as segment address, and the segment address multiplied by 1610 as the beginning physical segment address.
2239F 223A0
. . . .
10010
10020
. . .
Program
first 16byte boundary after the end of the program code segment Another segment
. .
0F
DF
IF
TF
SF
ZF
AF
PF
CF
8085 Flags The 8086s PSW contains 16 bits ,but 7 of them are not used. Each bit in The PSW is called a flag. The 8086 flags are divided into : conditional flags which reflect the result of the previous operation involving the ALU, and the Control flags which control the execution of special functions. Conditionl flags : SF(Sign Flag)- Is equal to the MSB of the result. Since in 2s complement negative numbers have a 1 in the MSB and for nonnegative numbers this bit is 0,this flag indicates whether the previous result was negative or nonnegative. ZF (Zero Flag)-Is set to 1 if the result is zero and 0 if the result is nonzero.
0F
DF
IF
TF
SF
ZF
AF
PF
CF
8085 Flags PF(Parity Flag)- Is set to 1 if the low order 8 bits of the result contain an even number of 1s; otherwise it is cleared. CF(Carry Flag)- An addition causes this flag to be set if there is a carry out of the MSB, and a subtraction causes it to be set if a borrow is needed. AF(Auxiliary Carry Flag)- Is set if there is carry out of bit 3 during an addition or a borrow by bit 3 during a subtraction. This flag is used Exclusively for BCD arithmetic. OF(Overflow Flag)- Is set if an overflow occurs,i.e., a result is out of Range. For addition this flag is set when there is a carry into the MSB and no carry out of the MSB or vice versa.
0F
DF
IF
TF
SF
ZF
AF
PF
CF
8085 Flags OF(Overflow Flag)cntd- For subtraction it is set when the MSB needs a borrow and there is no borrow from the MSB, or vice versa. As an Example, if the previous instruction performed the addition, 0010 0011 0100 0101 + 0010 0010 0001 1001 ---------------------------------0100 0101 0101 1110 Result SF=0,ZF=0,PF=0,CF=0,AF=0,OF=0 If the previous instruction performed the addition, 0101 0100 0011 1001 + 0100 0101 0110 1010 --------------------------------1001 1001 1010 0011 Result SF=1,ZF=0,PF=1,CF=0,AF=1,OF=1
0F
DF
IF
TF
SF
ZF
AF
PF
CF
8085 Flags ControlFlags: DF (Direction Flag)-Used by string manipulation instructions .If clear, the string is processed from its beginning with the first element having the lowest address. Otherwise, the string is processed from the high address towards the low address. IF(Interrupt Enable Flag)-If set ,a certain type of interrupt(a maskable interrupt) can be recognized by the CPU; otherwise, these interrupts are ignored. TF(Trap Flag)- If set, a trap is executed after each instruction.
8086 Architecture Internal operations(Instruction Queue) The general operation of a computer consists of: 1.Fetching the next instruction from the address indicated by the PC. 2.Putting it in the instruction register and decoding it while the PC is incremented to point to the next instruction. 3.Executing the instruction and ,if a branch is to be taken, resetting the Pc to the branch address. 4.Repeating steps 1 through 3. In 8086 the address of the next instruction is determined by the sum of IP and (CS)X16 10 ,and the instruction register is a 6 byte first in / first Out (FIFO) queue (This queue gives 8086 a pipelined architecture) that is continually being filled whenever the system bus is not needed for other operation. This look ahead feature can significantly increase the CPUs throughput because much of the time the next instruction is already in the CPU when the present instruction completes its execution.
The way in which an operand is specified is called its addressing mode. The addressing modes for the 8086 instructions are broken into two Categories ,those for data and those for branch addresses. Data Related addressing modes: Immediate-The datum is either 8 bits or 16 bits long and is part of the Instruction. Direct-The 16-bit effective address of the datum is part of the instruction. Register-The datum is in the register that is specified by the instruction. For a 16 bit operand ,a register may be AX, BX, CX, DX, SI, DI, SP, or BP, and for an 8-bit operand a register may be AL,AH,BL,BH,CL,CH,DL, or DH. Register Indirect- The effective address of the datum is in the base register BX or an index register that is specified by the instruction, i.e., (BX) EA= (DI) (SI)
Addressing Modes
Register Relative- The effective address is the sum of an 8- or 16-bit Displacement and the contents of a base register or an index register,i.e., (BX) EA= (BP) 8 bit displacement (DI) + (sign extended) (SI) 16-bit displacement Based Indexed-The effective address is the sum of a base register and an index register, both of which are specified by the instruction, i.e., (BX) + (SI) (BP) (DI) Relative Based Indexed- The effective address is the sum of an 8-or 16-bit Displacement and a based indexed address, i.e., EA=
Addressing Modes
Addressing Modes
+ (SI) + 8 bit displacement (DI) (sign extended) 16-bit displacement
For example, if (BX)=0158 (DI)=10A5 Displacement=1B57 (DS)=2100 and DS is used as the segment register, then the effective and physical addresses produced by these quantities and the various addressing modes be. Direct: EA= 1B57,Physical address=1B57+21000=22B57 Register: No effective address-datum is in specified register. Register indirect assuming register BX: EA=0158,physical address 0158+21000=21158 Register relative assuming register BX: EA=0158+1B57=1CAF,physical address=1CAF+21000=22CAF Based indexed assuming registers BX and DI:EA=0158+10A5=11FD.
Addressing Modes
Physical address=11FD+21000=221FD Relative based indexed assuming BX and DI:EA=0158+10A5+1B57=2D54, Physical address =2D54+21000=23D54 Branch Related addressing modes: Intrasegment Direct-The effective branch address is the sum of an 8 or 16 bit displacement and the current contents of IP. When the displacement is 8 bits long, it is referred to as short jump. It may be used with either conditional or unconditional branching, but a conditional branch instruction can have only an 8 bit displacement. Intrasegment Indirect-The effective branch address is the contents of a register or memory location that is accessed using any of the data related addressing modes except the immediate mode. The contents of IP are Replaced by the effective branch address. This addressing mode may be used only in unconditional branch instructions.
Intersegment Direct-Replaces the contents of IP with part of the Instruction and contents of CS with another part of the instruction. The Purpose of this addressing mode is to provide a means of branching from one code segment to another . Intersegment Indirect Replaces the contents of IP and CS with the contents of two consecutive words in memory that are referenced using any of the above data related addressing modes except the immediate and register modes. Suppose that (BX)=1256,(SI)=528F, Displacement =20A1 Then: With the direct addressing, the effective branch address is the contents Of: 20A1+(DS)X1610 With register relative addressing assuming register BX, the effective branch address is the contents of : 1256+20A1+(DS)X1610
Addressing Modes
With based indexed addressing assuming registers BX and SI, the effective Branch address is the contents of: 1256+528F+(DS)X1610
Addressing Modes
L4
8086Bus Cycle
BUS CYCLE AND TIME STATES A bus cycle defines the sequence of events when the MPU communicates with an external device, which starts with an address being output on the system bus followed by a read or write data transfer. Types of bus cycles: Memory Read Bus Cycle Memory Write Bus Cycle Input/Output Read Bus Cycle Input/Output Write Bus Cycle The bus cycle of the 8086 microprocessor consists of at least four clock periods. These four time states are called T1, T2, T3 and T4.
8086Bus Cycle
MEMORY READ CYCLES Fig. (a) shows a memory read cycle of the 8086: During period T1, The 8086 outputs the 20-bit address of the memory location to be accessed on its multiplexed address/data bus. BHE is also output along with the address during T1. At the same time a pulse is also produced at ALE. The trailing edge or the high level of this pulse is used to latch the address in external circuitry. Signal M/IO is set to logic 1 and signal DT/R is set to the 0 logic level and both are maintained throughout all four periods of the bus cycle. Beginning with period T2, Status bits S3 through S6 are output on the upper four address bus lines. This status information is maintained through periods T3 and T4.
(a) Logical memory organization, and (b) Physical memory organization (high and low memory banks) of the 8086 microprocessor.
Each of the memory banks provides half of the 8086's 16-bit data bus. The lower bank transfers bytes of data over data lines D0 through D7, while data transfers for a high bank use D8 through D15. The 8086 microprocessor accesses memory as follows: Fig. (a)shows how a byte-memory operation is performed to address X, an even-addressed storage location. A0 is set to logic 0 to enable the low bank of memory and BHE to logic 1 to disable the high bank. Data are transferred to or from the lower bank over data bus lines D0 through D7. Fig.(b) shows how a byte-memory operation is performed to an odd addressed storage location such as X + 1. A0 is set to logic 1 and BHE to logic 0.This enables the high bank of memory and disables the low bank. Data are transferred over bus lines D8 through D15. D8 represents the LSB. Fig.(c) illustrates how an aligned word (at even an address X) is accessed. Both the high and low banks are accessed at the same time.