The 8086 Microprocessor: Ayesha Naureen
The 8086 Microprocessor: Ayesha Naureen
Ayesha Naureen
16-bit Microprocessor
ALU, internal registers and most of the instructions work with 16-bit binary word. Read or write data to a memory/port either 16bits or 8 bit at a time. Address up to 220 = 1,048,576 memory locations Each of the 1,048,576 memory addresses of the 8086 represents a bytewide location.
Words will be stored in two consecutive memory locations. If the first byte of a word is at an even address, the 8086 can read the entire word in one operation. If the first byte of the word is at an odd address, the 8086 will read the first byte of the word in one operation, and the second byte in another operation.
Processor
8085 8088
Data Bus
8 8
Address Bus
16 20
8086
80286 80386 80486 80586/Pentium(Pro)
16
16 32 32 64
20
24 32 32 32
1,048,576
16,777,21 4,294,976,296 4,294,976,296 4,294,976,296
Bus Interface Unit Sends out addresses Reads data Writes data
Execution Unit Where to fetch instructions or data from? Decodes instructions Executes instructions
Control Circuitry
Directs internal operations Translates instructions fetched from memory into a series of actions. Add, Subtract, AND, OR, XOR, Increment, Decrement, Complement, Shift
Instruction Decoder
ALU
A flag is a flip-flop which indicates some condition produced by the execution of an instruction or controls certain operations of the EU. A 16-bit flag register in the EU contains nine active flags.
SF
OF
Control Flag
TF
IF DF
EU has eight general purpose registers: AH, AL, BH, BL, CH, CL, DH and DL. The H represents the high-order or most-significant byte and the L represents the low- order or least-significant byte. Used to hold intermediate results. Each of these registers may be used separately as 8-bit storage areas or combined to form one 16-bit storage area. AX: AH-AL BX: BH-BL CX: CH-CL DX: DH-DL The AL register is also called as the Accumulator. For 16-bit operations, AX is called the accumulator.
While EU is decoding/executing an instruction, BIU fetches up to six instruction bytes for the following instructions. The BIU stores these prefetched instructions in a first-in-first-out register called a queue. When EU is ready for next instruction, it reads the instruction byte from the queue. Speeds up the execution process.
Fetching the next instruction while the current instruction executes is called pipelining.
20-bit addresses Address any of 220 or 1,048,576 bytes in memory. But at any given time, 8086 works with only four 65,536 byte data segments. Four segment registers hold the upper 16-bit of the starting addresses of the four memory segments. These are: Code Segment (CS): Instructions are fetched from this segment Data Segment (DS): Program variables and data are held in this area Stack Segment (SS): Stack is a memory area set aside to store addresses and data while a subprogram executes. Extra Segment (ES): Also used for data storage Each segment is made up of an uninterrupted section of memory locations.
2FFFFH
64K 20000H 00000H Physical Address
Memory
CS contains the upper 16 bits of the starting address of the segment from where instructions are being fetched. How to get the address of the next instruction to be fetched? Instruction Pointer (IP) Register IP holds the 16-bit address or offset of the next code byte within the code segment. This value is added to the segment base address in CS to produce the required 20-bit physical address. Each time the execution unit accepts an instruction, the instruction pointer, is incremented to point to the next instruction in the program.
38AB4H
Code Byte
IP=4214H
Segementbase:offsetform 348A:4214
348A0H Code Segment Base CS = 348AH Memory
Physical Address
Stack Segment (SS) contains the upper 16 bits of the starting address of the stack segment. Stack Pointer (SP) register in EU holds the 16-bit offset from the start of the stack segment to the memory location where a word was most recently stored. Top of Stack: Memory location where a word was most recently stored. The physical address for a stack read or stack write is produced by adding the contents of SP with the segment base address.
5FFE0H
Top of Stack
SP=FFE0H
SS:SP5000:FFE0
50000H Stack Segment Base SS = 5000H Memory
Physical Address
Base Pointer (BP) Register Source Index (SI) Register Destination Index (DI) Register Can be used for temporary data storage. But main function: Hold the 16-bit offset of a data word in one of the segments. For example:
SI can be used to hold the offset of a data word in the data segment. Physical address of word: Data Segment Base (DS) + SI