Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. Introduction to Microprocessors
2. Internal Architecture of 8086
3. Addressing modes of 8086.
Introduction to Microprocessors:
What is a microprocessor?
Microprocessor is multi purpose
programmable logic device which performs
arithmetic operations as well as logic operations
and which is integrated on a single IC.
TYPES OF COMPUTERS:
1.Super computer
2.Main frames
3.Mini computer
4.Microcomputer
Super computer
• The supercomputer is the most powerful variant of the
computer, which is used for specific purposes only.
• They are very expensive and require a number of employees to
utilize.
• The super computers are used for the immense number of
mathematical and computational calculations.
As an example, weather forecasting requires a large number
of data, and the supercomputer is needed to analyze the data.
Mainframe computer
• The mainframe computer is also like supercomputer based on
performance and fastness.
• But the difference between the two types are, the
supercomputers are used for a single purpose when the
mainframe computer works for multiple purposes.
• It can support hundreds to thousands of tasks at a time. In
some cases, the mainframe computers are faster than the
supercomputer.
• They are mostly used to perform bulk data processing works
like statics, transaction processing, census data processing, and
much more works
• Some of the examples of the computer include IBM Z Series.
Minicomputer
• The minicomputer is designed for the small organization
works such as control, instrumentation, communication
switching, human interaction, record keeping, and other
purposes.
• They become popular as personal computers with the
evaluation of time.
• Though they are called a minicomputer, they are basically
midsized, both in power and size.
• The minicomputer is capable of supporting up to 4 to 200
users with its multiprocessing system.
• They implement the computer to become possible with the
utilization of minimal instruction set, less expensive
peripherals, transistor, and core memory technologies.
Microcomputer
• The microcomputer is based on a simple microprocessor
as its central processor unit.
• They are very small and inexpensive when compared
with the other variants.
• They include the microprocessor, and minimal I/0
mounted circuits, memory unit on a single printed circuit
board.
• The microcomputers are basically the small smart gadgets
we use nowadays, like smartphones, smartwatches,
tablets, etc.
• The uses of the micro-computer made it possible for us to
bring small and tiny gadgets tools.
BLOCK DIAGRAM OF COMPUTER
• Mainly computer system consists of three parts, that are
central processing unit (CPU), Input Devices, and Output
Devices
The first 8 bit microprocessor which could perform arithmetic and logic
operations on 8 bit words was introduced in 1973 again by Intel.
This was Intel 8008 and was later followed by an improved version,
Intel 8088. Some other 8 bit processors are Zilog-80 and Motorola
M6800.
In 1974 Intel introduced the first 8-bit general purpose microprocessor
is 8085.
It is 8.bit microprocessor all the registers and alu operate on 8-bit data
size.
It contain 16address lines,8- data lines.
The memory capacity is 64kb.
Third Generation (16 - bit Microprocessor):
The 8-bit processors were followed by 16 bit processors.
The third generation microprocessors, introduced in 1978 were
represented by Intel's 8086, Zilog Z800 and 80286, which were 16 -
bit processors with a performance like minicomputers.
Fourth Generation (32 - bit Microprocessors):
Several different companies introduced the 32-bit microprocessors, but
the most popular one is the Intel 80386.
Fifth Generation (64 - bit Microprocessors):
From 1995 to now we are in the fifth generation. After 80856, Intel
came out with a new processor namely Pentium processor followed
by Pentium Pro CPU, which allows multiple CPUs in a single system
to achieve multiprocessing.
• Other improved 64-bit processors are Celeron, Dual, Quad, Octa
Core processors.
Microprocessor Year of Invention Word Length Memory Pins Clock Remarks
addressing
Capacity
Pentium III 1999 32-bit 64GB 370 PGA 600-1.3 MHz Improved
version of
Pentium II; 70
new SIMD
instructions
Itanium 2001 64-bit 64 address 423 PGA 733 MHz-1.3 64-bit EPIC
lines GHz Processor
Basic Terms used in Microprocessor:
• Instruction Set - The group of commands that the microprocessor
can understand is called Instruction set. It is an interface between
hardware and software.
• Bus - Bus is a group of conducting wires which carries information,
all the peripherals are connected to microprocessor through Bus.
• . A microprocessor will have three types of buses, i.e., data bus,
address bus, and control bus.
Address bus :
It is a group of conducting wires which carries address only.Address
bus is unidirectional because data flow in one direction, from
microprocessor to memory or from microprocessor to Input/output
devices
Data bus:
It is a group of conducting wires which carries Data only.Data bus is
bidirectional because data flow in both directions, from microprocessor
to memory or Input/Output devices and from memory or Input/Output
devices to microprocessor.
Control bus:
It is a group of conducting wires, which is used to generate timing and
control signals to control all the associated peripherals, microprocessor
uses control bus to process data, that is what to do with selected
memory location. Some control signals are:Memory read
• Memory write
• I/O read
• I/O Write
• Opcode fetch
Applications of Microprocessors:
The application of microprocessors is increasing day by day.
Some of the applications are:
1) Analytical scientific instruments 2) Smart terminals
3) Stacker crane controls 4) Conveyor controls
5) Word processor 6) Point of scale systems
7) Standalone electronics cash system 8) Electronic games
9) Vending and dispensing machines 10) Market scales 11)
Traffic light controls 12) Home heating and lighting
controls
13) Security & fire alarm system 14) Home appliances
15) Computer aided instruction 16) On line control of lab
instrumentation
17) Desktop computers 18) Check processor
19) Payroll system 20) Inventory control
21) Automatic type setting 22) Compact business machines
23) Medical instrumentation 24) Automobile diagnostics
25) Data communication processing 26) Optical character
recognition
27) I/O terminal for computers.
Intel 8086:
• Intel 8086 microprocessor is the enhanced version of Intel 8085
microprocessor. It was designed by Intel in 1976.
• The 8086 microprocessor is a16-bit, N-channel, HMOS
microprocessor. Where the HMOS is used for "High-speed Metal
Oxide Semiconductor".
• Intel 8086 is built on a single semiconductor chip and packaged in a
40-pin IC package. The type of package is DIP (Dual Inline
Package).
• Intel 8086 uses 20 address lines and 16 data- lines. It can directly
address up to 220 = 1 Mbyte of memory.
• It consists of a powerful instruction set, which provides operation
like division and multiplication very quickly.
• 8086 is designed to operate in two modes, i.e., Minimum and
Maximum mode.
• Maximum mode is suitable for system having multiple processors
• Minimum mode is suitable for system having a single processor
Features of 8086
• It has an instruction queue, which is capable of storing six
instruction bytes from the memory resulting in faster processing.
• It was the first 16-bit processor having 16-bit ALU, 16-bit registers,
internal data bus, and 16-bit external data bus resulting in faster
processing.
• It is available in 3 versions based on the frequency of operation −
– 8086 → 5MHz
– 8086-2 → 8MHz
– (c)8086-1 → 10 MHz
• It uses two stages of pipelining, i.e. Fetch Stage and Execute Stage,
which improves performance.
• Fetch stage can prefetch up to 6 bytes of instructions and stores
them in the queue.
• Execute stage executes these instructions.
• It has 256 vectored interrupts.
• It consists of 29,000 transistors.
• Architecture of 8086
• 8086 contains two independent functional units:
1.Bus Interface Unit (BIU)
2. Execution Unit (EU).
The segment registers, instruction pointer and 6-byte instruction queue
are associated with the bus interface unit (BIU).
The functions of BIU:
• Handles transfer of data and addresses,
• Fetches instruction codes, stores fetched instruction codes in first-in-
first-out register set called a queue,
• Reads data from memory and I/O devices,
• Writes data to memory and I/O devices,
• It relocates addresses of operands since it gets un-relocated operand
addresses from EU. The EU tells the BIU from where to fetch
instructions or where to read data.
It has the following functional parts:
• Instruction Queue: When EU executes instructions, the BIU gets
6-bytes of the next instruction and stores them in the instruction
queue and this process is known as instruction pre fetch. This
process increases the speed of the processor.
• When EU executes instructions and is ready for its next instruction,
then it simply reads the instruction from this instruction queue
resulting in increased execution speed.
• Fetching the next instruction while the current instruction executes
is called pipelining.
• Segment Registers: A segment register contains the addresses of
instructions and data in memory which are used by the processor to
access memory locations. It points to the starting address of a
memory segment currently being used.
• There are 4 segment registers in 8086
• Code Segment Register (CS): Code segment of the memory
holds instruction codes of a program.
• Data Segment Register (DS): The data, variables and
constants given in the program are held in the data segment of
the memory.
• Stack Segment Register (SS): Stack segment holds addresses
and data of subroutines. It also holds the contents of registers
and memory locations given in PUSH instruction.
• Extra Segment Register (ES): Extra segment holds the
destination addresses of some data of certain string
instructions.
Instruction Pointer (IP): The instruction pointer in the 8086 microprocessor
acts as a program counter. It indicates to the address of the next instruction to b
Execution Unit (EU)
• The EU receives opcode of an instruction from the queue, decodes it
and then executes it. While Execution unit decodes or executes an
instruction, then the BIU fetches instruction codes from the memory
and stores them in the queue.
• The BIU and EU operate in parallel independently. This makes
processing faster. This is called pipelining.
• General purpose registers, stack pointer, base pointer and index
registers, ALU, flag registers (FLAGS), instruction decoder and timing
and control unit constitute execution unit (EU). Let's discuss them:
• General Purpose Registers: There are four 16-bit general purpose
registers: AX (Accumulator Register), BX (Base Register), CX
(Counter) and DX. Each of these 16-bit registers are further subdivided
into 8-bit registers as shown below:
General Purpose Registers: There are four 16-bit general purpose
registers: AX (Accumulator Register), BX (Base Register), CX (Counter)
and DX. Each of these 16-bit registers are further subdivided into 8-bit
registers as shown below:
AX AH AL
BX BH BL
CX CH CL
DX DH DL
Index Register: The following four registers are in the group of
pointer and index registers:Stack Pointer (SP)
• Base Pointer (BP)
• Source Index (SI)
• Destination Index (DI)
ALU: It handles all arithmetic and logical operations. Such as
addition, subtraction, multiplication, division, AND, OR, NOT
operations.
Flag Register: It is a 16-bit register which exactly behaves like a flip-
flop, means it changes states according to the result stored in the
accumulator. It has 9 flags and they are divided into 2 groups i.e.
conditional and control flags.Conditional Flags: This flag represents
the result of the last arithmetic or logical instruction executed.
Conditional flags are:
– Carry Flag
– Auxiliary Flag
– Parity Flag
– Zero Flag
– Sign Flag
– Overflow Flag
• Control Flags: It controls the operations of the execution unit.
Control flags are:
– Trap Flag
– Interrupt Flag
– Direction Flag
• Flag register format:
The Flags Register
• It is a 16-bit register, also called Program Status Word (PSW).
Seven bits remain unused while the rest nine are used. Six are
status flags and three are control flags.
The control flags can be set/reset by the programmer.
• Trap flag − It is used for single step control and allows the user to
execute one instruction at a time for debugging. If it is set, then the
program can be run in a single step mode.
• Interrupt flag − It is an interrupt enable/disable flag, i.e. used to
allow/prohibit the interruption of a program. It is set to 1 for
interrupt enabled condition and set to 0 for interrupt disabled
condition.
• Direction flag − It is used in string operation. As the name suggests
when it is set then string bytes are accessed from the higher
memory address to the lower memory address and vice-a-versa.
Conditional Flags
It represents the result of the last arithmetic or logical instruction executed.
Following is the list of conditional flags −
• Carry flag − This flag indicates an overflow condition for arithmetic
operations.
• Auxiliary flag − When an operation is performed at ALU, it results in a
carry/barrow from lower nibble (i.e. D0 – D3) to upper nibble (i.e. D4 –
D7), then this flag is set, i.e. carry given by D3 bit to D4 is AF flag. The
processor uses this flag to perform binary to BCD conversion.
• Parity flag − This flag is used to indicate the parity of the result, i.e.
when the lower order 8-bits of the result contains even number of 1’s,
then the Parity Flag is set. For odd number of 1’s, the Parity Flag is reset.
• Zero flag − This flag is set to 1 when the result of arithmetic or logical
operation is zero else it is set to 0.
• Sign flag − This flag holds the sign of the result, i.e. when the result of
the operation is negative, then the sign flag is set to 1 else set to 0.
• Overflow flag − This flag represents the result when the system capacity
is exceeded.
The status flags are set/reset depending on the results of some
arithmetic or logical operations during program execution.
• 1. CF (Carry Flag) is set (CF=1) if there is a carry out of the
MSB position resulting from an addition operation or
subtraction.
• 2. AF (Auxiliary Carry Flag) AF is set if there is a carry out
of bit 3 resulting from an addition operation.
• 3. SF (Sign Flag) set to 1 when result is negative. When result
is positive it is set to 0.
• 4. ZF (Zero Flag) is set (ZF=1) when result of an arithmetic
or logical operation is zero. For non-zero result this flag is
reset (ZF=0).
• 5. PF (Parity Flag) this flag is set to 1 when there is even
number of one bits in result, and to 0 when there is odd
number of one bits.
• 6. OF (Overflow Flag) set to 1 when there is a signed
overflow. For example, when you multiply FFH by 11H not
one byte).
Addressing modes 0f 8086:
• Addressing mode indicates a way of locating data or operands.
• Depending up on the data type used in the instruction and the memory
addressing modes, any instruction may belong to one or more addressing
modes or same instruction may not belong to any of the addressig modes.
There are eight addressing modes in 8086 MPU. These modes are:
• Immediate Addressing Mode
• Register Addressing Mode
• Direct Addressing Mode
• Register Indirect Addressing Mode
• Based Addressing Mode
• Indexed Addressing Mode
• Based-Index Addressing Mode
• Based-Index with displacement addressing mode
Immediate Addressing
These are:
• Code Segment
• Data Segment
• Stack Segment
• Extra Segment
• Code Segment Register (CS): Code segment of the memory holds
instruction codes of a program.
• Data Segment Register (DS): The data, variables and constants
given in the program are held in the data segment of the memory.
• Stack Segment Register (SS): Stack segment holds addresses and
data of subroutines. It also holds the contents of registers and
memory locations given in PUSH instruction.
• Extra Segment Register (ES): Extra segment holds the
destination addresses of some data of certain string instructions.
• Each of these segments are addressed by an address stored in
corresponding segment register.
• These registers are 16-bit in size.
• Each register stores the base address (starting address) of the
corresponding segment.
• Because the segment registers cannot store 20 bits, they only
store the upper 16 bits.
• 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.
• To access any memory location it needs the 20-bit address, so
we have to calculate the 20-bit physical address.
• Bellow is the one way of positioning four 64 kilobyte segments
within the 1M byte memory space of an 8086.
Types Of Segmentation –
• Overlapping Segment – A segment starts at a particular
address and its maximum size can go up to 64kilobytes. But if
another segment starts along this 64kilobytes location of the
first segment, then the two are said to be Overlapping Segment.
Overlapped Segment.
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.
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.
• Each of these segments are addressed by an address stored in
corresponding segment register.
• These registers are 16-bit in size.
• Each register stores the base address (starting address) of the
corresponding segment.
• Because the segment registers cannot store 20 bits, they only
store the upper 16 bits.
How is a 20-bit address obtained if there are only 16- bit
registers?
• The 20-bit address of a byte is called its Physical Address.
• But, it is specified as a Logical Address.
• Logical address is in the form of: Base Address : Offset
• Offset is the displacement of the memory location from the
starting location of the segment.
• The value of Data Segment Register (DS) is 2222 H.
• To convert this 16-bit address into 20-bit, the BIU appends 0H
to the LSBs of the address.
• After appending, the starting address of the Data Segment
becomes 22220H.
• If the data at any location has a logical address specified as:
• 2222 H : 0016 H
• Then, the number 0016 H is the offset.
Ans:
• The offset of the CS Register is the IP register.
• Therefore, the effective address of the memory location pointed by the
CS register is calculated as follows: