Chapter-1
Chapter-1
Introduction to Microprocessor
1
Microcomputer
● Generally, the words ‘microprocessor’ and ‘microcomputer’ are used to
correspond to the same thing, but in fact these words have different
meanings.
● The microprocessor is an Integrated Circuit (IC) developed on LSI or
VLSI technology.
● It is the core of any computer system, but a microprocessor by itself is
completely useless, until external peripheral devices are connected with it
to enable it to interact with the outside world.
● The microcomputer is a complete computing system and it is built with a
microprocessor, input/output devices and memory (RAM and ROM).
2
● The microcomputer is a complete computing system and it is built
with a microprocessor, input/output devices and memory (RAM and
ROM).
3
What is microprocessor ?
● A microprocessor is a programmable device that accepts binary data from an
input device, processes the data according to the instructions stored in the
memory and provides results as output.
● The microprocessor executes the program stored in the memory and transfers
data to and from the outside world through I/O ports.
● Any microprocessor-based system essentially comprises three parts, namely:-
○ Microprocessor
○ Memory
○ Peripheral I/O devices.
4
● The memory stores the binary instructions and data for the microprocessor.
● It can be classified as the primary or main memory and secondary
memory.
○ Read/write memory (R/WM) and read only memory (ROM) are
examples of primary memory and are used for executing and storing
programs.
○ Magnetic disks and tapes are examples of secondary memory. They are
used to store programs and results after the completion of program
execution.
● Microprocessors do not execute programs stored in the secondary memory
directly.
● Instead, they are first copied on to the R/W primary memory.
5
● Input/output devices are means through which the microprocessor interacts
with the outside world.
○ The commonly used input devices include keyboards, A/D converters,
switches, cameras, scanners, microphones and so on.
○ LEDs, seven-segment displays, LCD displays, printers and monitors are
some of the commonly used output devices.
● A bus is basically a communication link between the processing unit and the
peripheral devices. It is a group of wires that carry information in the form of
bits.
● The address bus is unidirectional and is used by the CPU to send out the
address of the memory location to be accessed.
● It is also used by the CPU to select a particular input or output port.
6
● The data bus is bidirectional, that is, data flow occurs both to and
from the microprocessor and peripherals.
● Data bus size has a considerable influence on the computer
architecture, as parameters such as the word length and the
quantum of data that can be manipulated at a time are determined
by the size of the data bus.
● There is an internal data bus, which may not be of the same width as
the external data bus that connects the microprocessor to I/O and
memory.
● The size of the internal data bus determines the largest number that
can be processed by the microprocessor in a single operation.
7
● The control bus contains a number of individual lines carrying synchronizing
signals.
● The term ‘bus’ would normally imply a group of lines working in unison.
● The control bus sends out control signals to memory, I/O ports and other
peripheral devices to ensure proper operation.
● It carries control signals such as memory read, memory write, read input
port, write output port, hold, interrupt, etc.
● For instance, if it is desired to read the contents of a particular memory
location, the CPU first sends out the address of that location on the address
bus and a ‘memory read’ control signal on the control bus.
● The memory responds by outputting data stored in the addressed memory
location onto the data bus.
8
Some definitions
Microprocessor
● The microprocessor is one of the most important components of a digital
computer.
● It acts as the brain of the computer system.
● Sometimes, microprocessor is written as µP.
● As technology has progressed, microprocessors have become faster, smaller
and capable of doing more work per clock cycle.
● Microprocessor is the controlling unit or CPU of a micro-computer, fabricated
on a very small chip capable of performing arithmetic and logic operations
(ALU) operations and communicating with the external devices connected to
it.
● One or more microprocessors typically serve as a central processing unit(CPU)
in a computer system or handheld device. 9
Multiprocessor System
● The CPU of a large powerful digital computer contains more than one
microprocessor.
● High-end powerful servers, mainframe computers, supercomputers, etc.
contain more than one microprocessor to act as CPU.
● A computer whose CPU contains more than one microprocessor is called
Multiprocessor System.
10
Microcontroller
● A highly integrated chip that contains all the components such as:
○ CPU
○ RAM
○ Some form of ROM
○ I/O ports and
○ Timers
● Unlike a general-purpose computer, which also includes all of these
components, a microcontroller is designed for a very specific task to control a
particular system.
11
Microprocessor Characteristics
● Microprocessor is a multipurpose device that can be designed for generic or
specialized functions.
● Microprocessors of laptops and smartphones are general purpose.
● Microprocessors designed for graphical processing or machine vision
are specialized ones.
● Some Characteristics
12
● Instruction Set:
○ The set of instructions that a microprocessor can understand.
● Bandwidth
○ The number of bits processed in a single instruction.
● Capability
○ It depends upon the number of instructions and capability of each instruction.
● Clock Speed
○ The microprocessor’s step is controlled by system clock.
○ The system clock is an electronic circuit that generates pulses which are
measured in millions or billions of seconds (MHz, GHz).
○ The number of pulses generated by the clock per unit of time is clock speed.
13
Clock speed
● The clock speed determines how many operations per second the processor
can perform.
● It is also called Clock Rate.
● Every computer contains an internal clock that regulates the rate at which
instructions are executed and synchronizes the various computer components.
● The faster the clock, the more instructions the CPU can execute per second.
● Clock speeds are expressed in megahertz(MHz) or gigahertz(GHz).
○ 1 MHz means 1 million cycles per second
○ 1 GHz means 1 billion cycles per second
● The microprocessors of personal computers have clock speeds of any where
from 300MHzto over 3.8 GHz. 14
Word Length
● Word length is the number of bits that can be processed by a processor
in a single instruction.
● Determines the amount of RAM that can be accessed by a processor on a
single go.
● It depends upon the width of internal data bus, registers, ALU etc.
● An 8-bit microprocessor can process 8bit data at a time.
● A processor with longer word length is more powerful and can process
data at a faster speed as compared to processor with shorter word
length.
● The word length ranges from 4bits for small microprocessor, to 64bits
for high-end microcomputers.
15
● Width of Data Bus
○ This is the size of the data bus. It defines the number of bits that can be
transferred through data bus.
● Width of Address Bus
○ This parameter decides the memory addressing capability of the
microprocessor.
○ The maximum size of the memory unit is decided by this parameter.
● Input/output Addressing Capability
○ The maximum number of the input/output ports accessed by the
microprocessor depends upon the width of the input/output address provided
in the input/output instruction.
16
● Data Types
○ The microprocessor handles various types of data formats
○ Like binary, BCD, ASCII, signed and unsigned numbers.
● Interrupt Capability
○ Interrupts are used to handle unpredictable and random events in the
microcomputer. It is used to interrupt the microprocessor.
○ Interrupt driven input/output improves the throughput of a system.
17
Evolution of Microprocessors
● First Generation(1939-1954)
○ Vacuum Tubes
● Second Generation(1954-1959)
○ Transistor
● Third Generation(1999-1971)
○ Integrated Circuit(IC)
● Fourth Generation(1971-Present)
○ Microprocessor
● Microprocessor is identified with word size of data
○ E.g., In 4-bit Microprocessor can perform 4-bit data operation at a time
18
Intel 4004 and 4040 ( 4 bit)
19
Intel 8008, 8080 and 8085 (8 bit)
20
Intel 8086 and 8088 (16 bit)
21
Intel 80386 and 80486 (32 bit)
22
Intel Pentium family since 2006
23
Intel 64 bit microprocessors
24
Inside a Microprocessor
● Figure shows a simplified typical schematic arrangement of a microprocessor.
● The figure shown is a generalized one and is not the actual structure of any of the
commercially available microprocessors.
● The important functional blocks include:
25
Arithmetic Logic Unit (ALU)
● The arithmetic logic unit (ALU) is the core component of all microprocessors.
● It performs the entire integer arithmetic and bit-wise logical operations of the
microprocessor.
● ALU is a combinational logic circuit and has two data input lines, a data output line
and a status line.
● It gets data from the registers of the microprocessor, processes the data according to
the instructions from the control unit and stores the results in its output registers.
● The integer arithmetic operations performed by the ALU include addition and
subtraction.
● It performs AND, OR, NOT and EXCLUSIVE-OR logical operations.
26
Register File
● The register file comprises various registers used primarily to store data, addresses
and status information during the execution of a program.
● Registers are sequential logic devices built using flip-flops.
● Some of the commonly found registers in most of the microprocessors include the
program counter, instruction registers, buffer registers, the status register, the stack
pointer, general-purpose registers and temporary registers.
Control Unit
● The control unit governs and coordinates the activities of different sections of the
processor and I/O devices.
● It is responsible for controlling the cycle of fetching machine instructions from
memory and executing them.
● It also coordinates the activities of input and output devices.
27
Basic Microprocessor Instructions
Data Transfer Instructions
● Data transfer instructions transfer data from one location designated as the source
location to another location designated as the destination.
● The data transfer could take place from one register to another, from one memory
location to another memory location, from a memory location to a register or from a
register to a memory location, and so on.
○ Example
28
Arithmetic Instructions
● Arithmetic instructions performed by microprocessors include addition, subtraction,
multiplication, division, comparison, negation, increment and decrement.
○ Example
29
Logic Instructions
● Microprocessors can perform all the logic functions of hard-wired logic.
● The basic logic operations performed by all microprocessors are AND, OR, NOT and
EXCLUSIVE-OR.
● Other logic operations include ‘shift’ and ‘rotate’ operations.
○ Example
30
Control Transfer or Branch or Program Control Instructions
● Microprocessors execute machine codes from one memory location to the next, that is,
they execute instructions in a sequential manner.
● Branch instructions change the flow of the program either unconditionally or under certain
test conditions.
● Branch instructions include ‘jump’, ‘call’, ‘return’ and ‘interrupt’. ‘Jump’ instructions are of
two types, namely ‘unconditional jump’ instructions and ‘conditional jump’ instructions.
○ Examples
31
Machine Control Instructions
● Machine control instructions include HALT and NOP instructions.
● Machine control instructions performed by the 8085 microprocessor include the following:
○ Example
32
Addressing Modes
● Microprocessors perform operations on data stored in the register or memory. These
data are specified in the operand field of the instruction.
● The data can be specified in various ways as a direct data value or stored in some
register or memory location, and so on.
● These are referred to as the addressing modes of the microprocessor.
● Different microprocessor architectures provide a variety of addressing modes.
● RISC microprocessors have far fewer addressing modes than CISC microprocessors.
● The most commonly used addressing modes are absolute, immediate, register direct,
register indirect, indexed, program counter relative, implicit and relative addressing
modes.
● They account for more than 90 % of the total addressing modes.
33
Absolute or Memory Direct Addressing Mode
● In absolute addressing mode, the data are accessed by specifying their address in the
memory [Fig a]. This mode is useful for accessing fixed memory locations, such as
memory mapped I/O devices.
● For example, the instruction MOV A, 30H in the 8085 microprocessor moves the
contents of memory location 30H into the accumulator [Fig. b]. In this case the
accumulator has the value 07H.
34
Immediate Addressing Mode
● In immediate addressing mode the value of the operand is held within the instruction
itself. This mode is useful for accessing constant values in a program.
● It is faster than the absolute addressing mode and requires less memory space.
● For example, the instruction MVI A, #30H moves the data value 30H into the
accumulator.
● The sign # in the instruction tells the assembler that the addressing mode used is
immediate.
35
Register Direct Addressing Mode
● In register direct addressing mode, data are accessed by specifying the register name in which
they are stored [Fig s]. Operations on registers are very fast, and hence instructions in this
mode require less time than absolute addressing mode instructions.
● Example, the instruction MOV A, R1 in the 8051 microprocessor moves the contents of
register R1 into the accumulator [Fig b]. The contents of the accumulator after the
instruction are 06H.
36
Register Indirect Addressing Mode
● In all the modes discussed so far, either the value of the data or their location is directly
specified. The indirect addressing mode uses a register to hold the actual address where the data
are stored. That is, in this case the memory location of the data is stored in a register [Fig a].
● The instruction MOV A, @R0 moves the contents of the memory location whose address is
stored in R0 into the accumulator. The value of the accumulator in this example is 07H [Fig b].
37
Indexed Addressing Mode
● In the indexed addressing mode, the address is obtained by adding the contents of a register to a
constant.
● The instruction ‘move the contents of accumulator A to the memory location whose address is
given by the contents of register 1 plus 5’ is an example of indexed addressing.
● The indexed addressing mode is useful whenever the absolute location of the data is not known
until the program is running.
● This addressing mode is used to access a continuous table or array of data items stored in
memory.
38
Implicit Addressing Mode
● In implicit addressing mode, no operand is used in the instruction and the location of
the operand is obvious from the instruction itself.
● Examples
■ RRC (rotate accumulator A right by one bit)
■ RLC (rotate accumulator A left by one bit)
39
Microprocessor Selection
● There are thousands of microprocessors available on the market. Selection of the
right microprocessor for a given application is not an easy task and cannot take place
in a vacuum; it must be done with the application in mind.
● Not only this, the quantity to be produced and the experience and capabilities of the
designers must also be considered.
● The selection process begins with the definition of the application to be followed by
matching a given processor with the well-defined application.
● Factors to be considered while selecting the microprocessor are price, power
consumption, performance, availability, software support and code density.
40
Price
● Price is one of the important factors that is considered by designers to evaluate a
processor.
● It assumes more importance for those embedded systems that have price constraint.
Power consumption
● Power consumption is an important factor for battery-operated systems.
● The power consumption of a microprocessor varies with the supply voltage (square
of supply voltage), speed (linearly) and with the software the chip is running.
● The bus structure of the processor and its interconnection with the memory ICs
should also be looked into.
41
Performance
● Processors that are good for one task may not be suitable for another. It is therefore
very important to define the processor requirements for the given application.
● These include the estimated size and complexity of the program, speed requirements
(time-critical functions), the language to be used, the arithmetic functions needed,
memory requirements (ROM, RAM and mass storage), I/O requirements and
interrupt source and response time required.
● After defining the application requirements, they should be matched with those that
a processor can offer.
Availability
● Before zeroing onto a particular microprocessor, it is important to ensure that it is
easily available.
42
Software support
● The associated software with the microprocessor, such as the debugger, compiler and
operating system, constitutes one of the factors that needs to be considered.
Code density
● The code density is the ratio between the size of the source code and the size of the
object code. The smaller the object code, the better is the code density.
● Processors having high code densities require less memory to execute the code.
● RISC processors have poor code density compared with CISC processors.
43
Thanks
44