You are on page 1of 15

Unit-1 Introduction to Microprocessor Architecture

EVOLUTION OF MICROPROCESSORS:
The microprocessor age began with the advancement in the IC technology to put all necessary
functions of a CPU into a single chip.
Intel started marketing its first microprocessor in the name of Intel 4004 in 1971. This was a4-bit
microprocessor having 16-pins in a single chip of PMOS technology. This was called the first generation
microprocessor. The Intel 4004 along with few other devices was used for making calculators. The 4004
instruction set contained only 45 instructions. Later in 1971, INTEL Corporation released the 8008 – an
extended 8-bit version of the 4004 microprocessor. The 8008 addressed an expanded memory size
(16KB) and 48 instructions.
Limitations of first generation microprocessors is small memory size, slow speed and instruction set
limited its usefulness.
Second generation microprocessors:
The second generation microprocessor using NMOS technology appeared in the market in the
year 1973. The Intel 8080, an 8-bit microprocessor, of NMOS technology was developed in the year 1974
which required only two additional devices to design a functional CPU. The advantages of second
generation microprocessors were

Large chip size(170x200 mil) with 40-pins. More chips on decoding circuits.
Ability to address large memory space (64-K Byte) and I/O ports(256).
More powerful instruction sets. Dissipate less power.
Better interrupt handling facilities. Cycle time reduced to half (1.3 to 9 m
sec.)
Sized 70x200 mil) with 40-pins. Less Support Chips Required
Used Single Power Supply Faster Operation
The 8080 microprocessor addresses more memory and execute additional instructions, but executes them
10 times faster than 8008.The 8080 has memory of 64 KB whereas for 8008 16 KB only. In 1977,
INTEL, introduced 8085 which was an updated version of 8080 last 8-bit processor.
The main advantages of 8085 were its internal clock generator, internal system controller and higher
clock frequency.
Third Generation Microprocessor:
In 1978, INTEL released the 8086 microprocessor, a year later it released 8088. Both devices
were 16 bit microprocessors, which executed instructions in less than 400ns.The 8086 and 8088 addresses
1MB of memory and rich instruction set to 246.16-bit processors were designed using HMOS technology.
The Intel 80186 and 80188 were the improved versions of Intel 8086 and8088, respectively. In addition to
16-bit CPU, the 80186 and 80188 had programmable peripheral devices integrated on the same package.
Fourth Generation Microprocessor:
The single chip 32-bit microprocessor was introduced in the year 1981 by Intel as iAPX 432. The
other 4thgeneration microprocessors were; Bell Single Chip Bellmac-32, Hewlett-Packard, National NSl
6032,Texas Instrument99000. Motorola 68020 and 68030. The Intel in the year 1985 announced the 32-
bit microprocessor(80386). The 80486 has already been announced and is also a 32-bit microprocessor.
The 80486 is a combination 386 processor a math coprocessor, and a cache memory controller on a single
chip.
The Pentium is a 64-bit superscalar processor. It can execute more than one instruction at a time and has a
full 64-bit data bus and 32-bit address bus. Its performance is double than 80486.
Features of 8086: •It requires +5V power supply. •A 40 pin dual in line package.
•It is a 16-bit μp. •8086 has a 20 bit address bus can access up to 2^20 memory locations (1 MB).
•It can support up to 64K I/O ports. •It provides 14, 16 -bit registers. •It has multiplexed address and data
bus AD0- AD15 and A16 – A19. •It requires single phase clock with 33% duty cycle to provide internal
timing •8086 is designed to operate in two modes, Minimum and Maximum. •It can pre-fetches up to 6
instruction bytes from memory and queues them in order to speed up instruction execution.
Architecture of 8086 microprocessor:

Bus Interface Unit:

• It provides full 16 bit bidirectional data bus and 20 bit address bus.
• The BIU is responsible for performing all external
bus operations. Specifically it has the following
functions:
• Instructions fetch Instruction queuing, Operand fetch and storage, Address relocation
and Bus control.
• The BIU uses a mechanism known as an instruction stream queue to implement
pipeline architecture.
• This queue permits pre-fetch of up to six bytes of instruction code. Whenever the queue
of the BIU is not full, it has room for at least two more bytes and at the same time the EU is
not requesting it to read or write operands from memory, the BIU is free to look ahead in the
program by pre-fetching the next sequential instruction.
• These pre-fetching instructions are held in its FIFO queue. With its 16 bit data bus, the
BIU fetches two instruction bytes in a single memory cycle.
• After a byte is loaded at the input end of the queue, it automatically shifts up through the
FIFO to the empty location nearest the output.
• The EU accesses the queue from the output end. It reads one instruction byte after the
other from the output of the queue. If the queue is full and the EU is not requesting access to
operand in memory.
• These intervals of no bus activity, which may occur between bus cycles, are known as idle
state.
• If the bus is already in the process of fetching an instruction when the EU request it to
read or write operands from memory or I/O, the BIU first completes the instruction fetch
bus cycle before initiating the operand read / write cycle.
• The BIU also contains a dedicated adder which is used to generate the 20 bit physical
address that is output on the address bus. This address is formed by adding an appended 16
bit segment address and a 16 bit offset address.

• For example: The physical address of the next instruction to be fetched is formed by
combining the current contents of the code segment CS register and the current contents of
the instruction pointer IP register.
• The BIU is also responsible for generating bus control signals such as those for memory
read or write and I/O read or write.
Execution Unit:

•The EU extracts instructions from top of the queue in the BIU, decodes them, generates
operands if necessary, passes them to the BIU and requests it to perform the read or write
bus cycles to memory or I/O and perform the operation specified by the instruction on the
operands.
•During the execution of the instruction, the EU tests the status and control flags and
updates them based on the results of executing the instruction.
• If the queue is empty, the EU waits for the next instruction byte to be fetched and shifted to
top of the queue.
• When the EU executes a branch or jump instruction, it transfers control to a location
corresponding to another set of sequential instructions.
When ever this happens, the BIU automatically resets the queue and then begins to fetch
instructions from this new location to refill the queue.

Register organization of 8086:


In general there are four different types of registers are there in 8086 microprocessor. They are
as follows:

The registers AX, BX, CX, and DX are the general 16-bit registers.
AX Register: Accumulator register consists of two 8-bit registers AL and AH, which can be
combined together and used as a 16- bit register AX. AL in this case contains the low-order byte
of the word, and AH contains the high-order byte. Accumulator can be used for I/O operations,
rotate and string manipulation.
BX Register: This register is mainly used as a base register. It holds the starting base location of a
memory region within a data segment. It is used as offset storage for forming physical address in
case of certain addressing mode.
CX Register: It is used as default counter or count register in case of string and loop instructions.
DX Register: Data register can be used as a port number in I/O operations and implicit operand
or destination in case of few instructions. In integer 32-bit multiply and divide instruction the DX
register contains high-order word of the initial or resulting number.
Segmentregisters:
To complete 1Mbyte memory is divided into 16 logical segments. The complete 1Mbyte
memory segmentation is as shown in fig 1.5. Each segment contains 64Kbyte of memory. There
are four segment registers.
Code segment (CS) is a 16-bit register containing address of 64 KB segment with processor
instructions. The processor uses CS segment for all accesses to instructions referenced by
instruction pointer (IP) register. CS register cannot be changed directly. The CS register is
automatically updated during far jump, far call and far return instructions. It is used for
addressing a memory location in the code segment of the memory, where the executable program
is stored.
Stack segment (SS) is a 16-bit register containing address of 64KB segment with program stack.
By default, the processor assumes that all data referenced by the stack pointer (SP) and base
pointer (BP) registers is located in the stack segment. SS register can be changed directly using
POP instruction. It is used for addressing stack segment of memory. The stack segment is that
segment of memory, which is used to store stack data. Data segment (DS) is a 16-bit register
containing address of 64KB segment with program data. By default, the processor assumes that
all data referenced by general registers (AX, BX, CX,
DX) and index register (SI, DI) is located in the data segment. DS register can be changed
directly using POP and LDS instructions. It points to the data
segment memory where the data is resided.
Extra segment (ES) is a 16-bit register containing address of 64KB segment, usually with
program data. By default, the processor assumes that the DI register references the ES segment
in string manipulation instructions. ES register can be changed directly using POP and LES
instructions. It also refers to segment which essentially is another data segment of the memory. It
also contains data.
Pointers and index registers:
The pointers contain within the particular segments. The pointers IP, BP, SP usually contain
offsets within the code, data and stack segments respectively
Stack Pointer (SP) is a 16-bit register pointing to program stack in stack segment.
Base Pointer (BP) is a 16-bit register pointing to data in stack segment. BP register is usually
used for based, based indexed or register indirect addressing.
Source Index (SI) is a 16-bit register. SI is used for indexed, based indexed and register indirect
addressing, as well as a source data addresses in string manipulation instructions. Destination
Index (DI) is a 16-bit register. DI is used for indexed, based indexed and register indirect
addressing, as well as a destination data address in string manipulation instructions.

Flag Register
8086 has a 16-bit flag register which is divided into two parts, viz.(a)condition code or status
flags and (b)machine control flags. The condition code flag register is the lower byte of the 16-
bit flag register along with the overflow flag. This flag is identical to the 8085 flag register, with
an additional overflow flag, which is not present in 8085.This part of the flag register of 8086
reflects the results of the operations performed by ALU. The control flag register is the higher
byte of the flag register of 8086.
It contains three flags, viz. direction flag(D), interrupt flag(I) and trap flag(T).
The complete bit configuration of 8086 flag register is shown in the below diagram.

O-Overflow flag
D-Direction flag
1-Interrupt flag
T-Trap flag
S-Sign flag
Z-Zero flag
Ac-Auxiliary carry flag
P-Parity flag
Cy-Carry flag
X-Not used

ConditionalFlags
Conditional flags are as follows:
Carry Flag (CY): This flag indicates an overflow condition for unsigned integer arithmetic. It is
also used in multiple-precision arithmetic.
Auxiliary Flag (AC): If an operation performed in ALU generates a carry/barrow from lower
nibble (i.e. D0 – D3) to upper nibble (i.e. D4 – D7), the AC flag is set i.e. carry given by D3 bit
to D4 is AC flag. This is not a general-purpose flag, it is used internally by the Processor to
perform Binary to BCD conversion.
Parity Flag (PF): This flag is used to indicate the parity of result. If lower order 8-bits of the
result contains even number of 1’s, the Parity Flag is set and for odd number of 1’s, the Parity
flag is reset.
Zero Flag (ZF): It is set; if the result of arithmetic or logical operation is zero else it is reset.
Sign Flag (SF): In sign magnitude format the sign of number is indicated by MSB bit. If the
result of operation is negative, sign flag is set.
MachineControlFlags
Control flags are set or reset deliberately to control the operations of the execution unit.
Control flags are as follows:
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.
Interrupt Flag (IF): It is an interrupt enable/disable flag. If it is set, the maskable 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.
Direction Flag (DF): It is used in string operation. If it is set, string bytes are accessed from
higher memory address to lower memory address. When it is reset, the string bytes are accessed
from lower memory address to higher memory address.

Memory Segmentation in 8086 Microprocessor:


Segmentation is the process in which the main memory of the computer is logically
divided into different segments and each segment has its own base address. It is basically used to
enhance the speed of execution of the computer system, so that the processor is able to fetch and
execute the data from the memory easily and fast.

Need for Segmentation –


The Bus Interface Unit (BIU) contains four 16 bit special purpose registers (mentioned
below) called as Segment Registers.

• Code segment register (CS): is used for addressing memory location in the code segment of
the memory, where the executable program is stored.
• Data segment register (DS): points to the data segment of the memory where the data
is stored.
• Extra Segment Register (ES): also refers to a segment in the memory which is another
data segment in the memory.
• Stack Segment Register (SS): is used for addressing stack segment of the memory. The stack
segment is that segment of memory which is used to store stack data.

The number of address lines in 8086 is 20, 8086 BIU will send 20bit address, so as to access one
of the 1MB memory locations. The four segment registers actually contain the upper 16 bits of
the starting addresses of the four memory segments of 64 KB each with which the 8086 is
working at that instant of time. A segment is a logical unit of memory that may be up to 64
kilobytes long. Each segment is made up of contiguous memory locations. It is an independent,
separately addressable unit. Starting address will always be changing. It will not be fixed. Note
that the 8086 does not work the whole 1MB memory at any given time. However, it works only
with four 64KB segments within the whole 1MB memory.Below is the one way of positioning
four 64 kilobyte segments within the 1M byte memory space of an 8086.

Types Of Segmentation –

1. Overlapping Segment – A segment starts at a particular address and its maximum


size can go up to 64kilobytes. But if another segment starts along with this 64kilobytes
location of the first segment, then the two are said to be Overlapping Segment.
2. Non-Overlapped Segment – A segment starts at a particular address and its
maximum size can go up to 64kilobytes. But if another segment starts before this
64kilobytes location of the first segment, then the two segments are said to be Non-
Overlapped Segment.

Rules of Segmentation Segmentation process follows some rules as follows:

• The starting address of a segment should be such that it can be evenly divided by 16.
• Minimum size of a segment can be 16 bytes and the maximum can be 64 kB.

Advantages of the Segmentation The main advantages of segmentation are as follows:

• It provides a powerful memory management mechanism.


• Data related or stack related operations can be performed in different segments.
• Code related operation can be done in separate code segments.
• It allows to processes to easily share data.
• It allows to extend the address ability of the processor, i.e. segmentation allows the use
of 16 bit registers to give an addressing capability of 1 Megabytes. Without
segmentation, it would require 20 bit registers.
• It is possible to enhance the memory size of code data or stack segments beyond 64
KB by allotting more than one segment for each area.

Physical Memory Organisation:


In an 8086 based system, the 1MB memory is physically organized as an odd bank and an even
bank, each of 512 KB, addressed in parallel by the processor. Byte data with an even address is
transferred on D7-D0, while the byte data with an odd address is transferred on D15-D8 bus lines. The
processor provides two enable signals, BHE and A0 for selection of either even or odd or both the banks.

The instruction stream is fetched from memory as words and is addressed internally by the
processor as necessary. In other words, if the processor fetches a word from memory, there are different
possibilities, like:
1. Both the bytes may be data operands
2. Both the bytes may contain opcode bits
3. One of the bytes may be opcode while the other may be data
All the above possibilities are taken care of by the internal decoder circuit of the microprocessor.
The timing and control unit then derives all the signals required for execution of the instruction.
While referring to word data, the BIU requires one or two memory cycles, depending upon whether the
starting byte is located at an even or odd address. It is always better to locate the word data at an even
address. To read or write a complete word from/to memory, if it is located at an even address, only one
read or write cycle is required. If the word is located at an odd address, the first read or write cycle is
required for accessing the lower byte while the second one is required for accessing the upper byte. Thus
two bus cycles are required if a word is located at an odd address. It should be kept in mind that while
initialing the structures like stack they should be initialized at an even address for efficient operation.

Thus bits D0-D7 of a 16-bit data will be transferred over D0-D7 of 16-bit data bus to/from 8-bit
memory and bits D8-D15 of the 16-bit data will be transferred over D8-D15 of the 16-bit data bus of the
microprocessor, to/from 8-bit memory. Thus to achieve 16-bit data transfer using 8-bit memories, in
parallel, the map of the complete system byte memory addresses will obviously be divided into the two
memory banks.
Thus if it is imagined that the complete memory map of 8086 is filled with 16-bit data, all the
lower bytes(D0-D7) will be stored in the 8-bit memory bank and all the higher bytes have to be stored in
the 8-bit memory bank. Consequently it can be observed that all the lower bytes have to be stored at even
addresses and all the higher bytes have to be stored at odd addresses. Thus the 8-bit memory bank (1) will
be called an odd memory bank and the 8-bit memory bank (2) will be called an even address bank. The
complete memory map of 8086 system is thus divided into even and odd address memory banks.
If 8086 transfers a 16-bit data to/from memory, both of these banks must be selected for the 16-
bit operation. However to maintain an upward compatibility with 8085, 8086 must be able to implement
8-bit operations. In which case, two possibilities arise; the first being 8-bit operation with even memory
bank, i.e, with an even address and the second one is 8-bit operation with odd address memory bank, i.e,
with an odd address. The two signals A0 and BHE’ solve the problem of selection of appropriate memory
banks.
Certain locations in memory are reserved for specific CPU operations. The locations FFFF0H to
FFFFFH are reserved for operations including jump to initialization program and I/O processor
initialization. The locations 00000H to 003FFH are reserved for interrupt vector table. The interrupt
structure provides space for a total of 256 interrupt vectors. The vectors, i.e, CS and IP for each interrupt
routine requires 4 bytes for storing it in the interrupt vector table. Hence, 256 types of interrupt require
256 * 4 =1kbyte (03FFH) locations for the complete interrupt vector table.

General Bus Operation:


The 8086 has a combined address and data bus commonly referred to as a time multiplexed
address and data bus. The main reason behind multiplexing address and data over the same pins is the
maximum utilization of processor pins and it facilitates the use of 40 pin standard DIP package. The bus
can be demultiplexed using a few latches and transreceivers, whenever required. In the following text, we
will discuss a general bus operation cycle.
Basically, all the processor bus cycles consist of at least four clock cycles. These are referred to
as T1,T2,T3 and T4. The address is transmitted by the processor during T1. It is present on the bus only
for one cycle. During T2, i.e, the next cycle, the bus is tristated for changing the direction on the bus only
for the following data read cycle. The data transfer takes place during T3 and T4. In case, an addressed
device is slow and shows ‘NOT READY’ status the wait states Tw are inserted between T3 and T4.
These clock states during wait period are called idle states (Ti), wait states (Tw) or inactive states. The
processor uses these cycles for internal housekeeping. The address latch enable (ALE) signal is emitted
during T1 by the processor (minimum mode) or the bus controller (maximum mode) depending upon
MN/MX’ input. The negative edge of this ALE pulse is used to separate the address and the data or status
information. In maximum mode the status line and are used to indicate the type of operation. ̅̅̅̅̅̅ ̅̅̅

0, 1
̅̅̅̅̅̅

are multiplexed with higher order address bits and the signal. Address is valid
̅̅̅
̅̅̅̅̅̅ ̅̅̅̅̅̅ ̅̅̅̅̅̅

Status bits 3 to 7
̅̅̅̅̅̅ ̅̅̅̅̅̅
during T 1 while the s tatus bits to are valid during T2 th rough T4.

3 7

You might also like