Module 5 Microprocessor
Module 5 Microprocessor
Module 5 Microprocessor
Microprocessors are multipurpose devices that can be designed for generic or specialized functions. The
microprocessors of laptops and smartphones are general purpose whereas ones designed for graphical processing or
machine vision are specialized ones. There are some characteristics that are common to all microprocessors.
Clock speed
Instruction set
Word size
Clock Speed
Every microprocessor has an internal clock that regulates the speed at which it executes instructions and also
synchronizes it with other components. The speed at which the microprocessor executes instructions is called clock
speed. Clock speeds are measured in MHz or GHz where 1 MHz means 1 million cycles per second whereas 1 GHz
equals to 1 billion cycles per second. Here cycle refers to single electric signal cycle.
Currently microprocessors have clock speed in the range of 3 GHz, which is maximum that current technology can
attain. Speeds more than this generate enough heat to damage the chip itself. To overcome this, manufacturers are
using multiple processors working in parallel on a chip.
Word Size
Number of bits that can be processed by a processor in a single instruction is called its word size. Word size
determines the amount of RAM that can be accessed at one go and total number of pins on the microprocessor. Total
number of input and output pins in turn determines the architecture of the microprocessor.
First commercial microprocessor Intel 4004 was a 4-bit processor. It had 4 input pins and 4 output pins. Number of
output pins is always equal to the number of input pins. Currently most microprocessors use 32-bit or 64-bit
architecture.
Instruction Set
A command given to a digital machine to perform an operation on a piece of data is called an instruction. Basic set
of machine level instructions that a microprocessor is designed to execute is called its instruction set. These
instructions do carry out these types of operations −
Data transfer
Arithmetic operations
Logical operations
Control flow
Input/output and machine control
Microprocessor Characteristics
Compared to the first microprocessors, today’s processors are very small but still they have these basic parts right
from the first model −
CPU
Bus
Memory
CPU
CPU is fabricated as a very large scale integrated circuit (VLSI) and has these parts −
Instruction register − It holds the instruction to be executed.
Decoder − It decodes (converts to machine level language) the instruction and sends to the ALU
(Arithmetic Logic Unit).
ALU − It has necessary circuits to perform arithmetic, logical, memory, register and program sequencing
operations.
Register − It holds intermediate results obtained during program processing. Registers are used for holding
such results rather than RAM because accessing registers is almost 10 times faster than accessing RAM.
Bus
Connection lines used to connect the internal parts of the microprocessor chip is called bus. There are three types of
buses in a microprocessor −
Data Bus − Lines that carry data to and from memory are called data bus. It is a bidirectional bus with
width equal to word length of the microprocessor.
Address Bus − It is a unidirectional responsible for carrying address of a memory location or I/O port from
CPU to memory or I/O port.
Control Bus − Lines that carry control signals like clock signals, interrupt signal or ready signal are
called control bus. They are bidirectional. Signal that denotes that a device is ready for processing is called
ready signal. Signal that indicates to a device to interrupt its process is called an interrupt signal.
Memory
RAM − Random Access Memory is volatile memory that gets erased when power is switched off. All data
and instructions are stored in RAM.
ROM − Read Only Memory is non-volatile memory whose data remains intact even after power is
switched off. Microprocessor can read from it any time it wants but cannot write to it. It is preprogrammed
with most essential data like booting sequence by the manufacturer.
A computer system is made up of three major components. The Central Processing Unit (CPU) that processes data,
Memory Unit that holds data for processing and the Input and Output Unit that is used by the user to communicate
with the computer. But how do these different components of a CPU communicate with each other?
They use a special electronic communication system called the BUS. Just like a passenger bus that carries people,
the computer bus carries lots of information using numerous pathways called circuit lines.
Three units share the single bus. At any given point of time, information can be transferred between any two units.
Here I/O units use the same memory address space (Memory mapped I/O). So, no special instructions are required
to address the I/O, it can be accessed like a memory location. And since all the devices do not operate the same
speed, it is necessary to smooth out the differences in timings among all the devices. A common approach used is to
include buffer registers with the devices to hold the information during transfers. Example here it communication
between the processor and printer.
In this topic, we are going to discuss the single bus structure in computer organization.
In single bus structure inside the CPU, different components are linked by a single bus. The various components
available inside CPU in this architecture includes:
Instruction Register (IR)
Instruction Decoder (ID)
Program Counter (PC)
Memory Address Register (MAR)
Memory Data Register (MDR)
Arithmetic and Logic Unit (ALU) and
General purpose Register
Now, the question is what are CPU registers and what are the types of registers used in single bus
structure? Let’s discuss these in details.
The CPU registers are the high-speed memory location built into the microprocessor. CPU uses these memory
locations to store data and instructions temporarily for processing. That is why they are also called as the fastest
temporary memory device. Since they are available inside the CPU, therefore CPU can access them quickly. CPU
processes, stores and transfers data from one component to another with the help of registers.
Since we have different generations of computers and the efficiency, speed, accuracy etc. varies among the different
generation of computers, so the number of registers and the size of the registers also varies among computers.
Therefore, it is true that the performance of a CPU also depends on registers. The main job of a register is to receive
the information, holds it temporarily and pass it on, as directed by the Control Unit.
In single bus structure, the CPU uses Instruction Register (IR), Instruction Decoder (ID), Program Counter
(PC), Memory Address Register (MAR), Memory Data Register (MDR) and General-purpose Register during
processing to perform different operations. Let’s discuss all these registers along with ALU and how they work
together in the single bus structure.
Instruction Register holds the current instruction that is being executed. It doesn’t store any address but stores the
instruction. If we require which instruction is currently being executed by the CPU, then we will look at the contents
of IR which tells us the currently executing instruction.
Instruction Decoder decodes the opcodes of the instruction to generate the necessary signal.
Memory Address Register holds the address of active memory location. When CPU wants to store or read data from
memory, CPU stores the required address of memory location in MAR.
Memory Data Register holds data. The primary job of MDR is to handle the data transfer between the main memory
and the processor. That means it holds the contents of location read from or written in the memory.
Arithmetic & Logic Unit is the component where actual execution is performed. ALU is one of the significant parts
of the computer system which is capable of performing different calculations. Depending on the design of ALU it
makes the CPU more powerful, efficient as well as faster.
The General-Purpose Registers are used for different purposes including holding of intermediate results.
Now to understand how the single bus structure in computer organization works, let us consider an instruction ADD
A, B which is in location M of memory.
The address M is first placed in MAR and a read signal is generated by CPU. The content of location M i.e. ADD A,
B instruction is placed in MDR which is then placed to Instruction Register (IR). This instruction is decoded by the
Instruction Decoder (ID) and required signal components are activated to perform the addition operation.
First Operand address A is placed in MAR and read signal is generated. The operand content 5 is fetched from
memory and placed in MDR. This data 5 is sent to ALU by the single bus. Second operand address B is placed in
MAR and read signal is generated. Operand data 2 is fetched and placed in MDR. This data, 2 is then sent to ALU
by the single bus. Once two operands are available inside the ALU, arithmetic addition is performed due to the
signals generated by the system. The result 7 is temporarily placed in the general-purpose register R0.
It is then sent to MDR by the single bus. An address of memory where the result data should be stored is placed in
MAR. Once, the result data and address are placed in MDR and MAR respectively, write signal is generated which
fetches the result data from CPU to proper memory position.
The considered instruction ADD A, B is in 2-address instruction format. In this format, 2nd operand source is
destination also. Hence, MAR will hold B and result data 7 is placed to location B of memory.
CONTROL UNIT
During the execution of a program, the control unit fetches one instruction at a time from the main memory and then
executes it. In this execution process, it takes help of ALU, if the instruction execution involves arithmetic or logical
operation (like AND, OR, Ex-OR). After execution of the current instruction, the CPU fetches the next instruction
for execution. This process continues until the program is completed and the result is output using the output device.
In many computers, the control unit and the ALU are integrated into a single block, known as Central Processing
Unit (CPU).
This unit can store instructions, data, and intermediate results. This unit supplies information to other units of the
computer when needed. It is also known as an internal storage unit or the main memory or the primary storage or
Random Access Memory (RAM).
Its size affects speed, power, and capability. Primary memory and secondary memory are two types of memories in
the computer. Functions of the memory unit are −
It stores all the data and the instructions required for processing.
It stores intermediate results of processing.
It stores the final results of processing before these results are released to an output device.
All inputs and outputs are transmitted through the main memory.
A control unit or CU is circuitry that directs operations within a computer's processor. It lets the computer's logic
unit, memory, as well as both input and output devices know how to respond to instructions received from a
program. Examples of devices that utilize control units include CPUs and GPUs.
This unit controls the operations of all parts of the computer but does not carry out any actual data processing
operations.
It is responsible for controlling the transfer of data and instructions among other units of a computer.
It manages and coordinates all the units of the computer.
It obtains the instructions from the memory, interprets them, and directs the operation of the computer.
It communicates with Input/output devices for transfer of data or results from storage.
It does not process or store data.
A control unit works by receiving input information that it converts into control signals, which are then sent to the
central processor. The computer's processor then tells the attached hardware what operations to carry out. The
functions that a control unit performs are dependent on the type of CPU, due to the variance of architecture between
different manufacturers. The following diagram illustrates how instructions from a program are processed.
Arithmetic section
Logic Section
Arithmetic section
The function of arithmetic section is to perform arithmetic operations like addition, subtraction, multiplication, and
division. All complex operations are done by making repetitive use of the above operations.
Logic Section
The function of the logic section is to perform logic operations such as comparing, selecting, matching, and merging
of data.
Inside a computer, there is an Arithmetic Logic Unit (ALU), which is capable of performing logical operations (e.g.
AND, OR, Ex-OR, Invert etc.) in addition to the arithmetic operations (e.g. Addition, Subtraction etc.). The control
unit supplies the data required by the ALU from memory, or from input devices, and directs the ALU to perform a
specific operation based on the instruction fetched from the memory. ALU is the “calculator” portion of the
computer.
An arithmetic logic unit (ALU) is a major component of the central processing unit of a computer system. It does all
processes related to arithmetic and logic operations that need to be done on instruction words. In some
microprocessor architectures, the ALU is divided into the arithmetic unit (AU) and the logic unit (LU).
An ALU can be designed by engineers to calculate many different operations. When the operations become more
and more complex, then the ALU will also become more and more expensive and also takes up more space in the
CPU and dissipates more heat. That is why engineers make the ALU powerful enough to ensure that the CPU is also
powerful and fast, but not so complex as to become prohibitive in terms of cost and other disadvantages.
ALU is also known as an Integer Unit (IU). The arithmetic logic unit is that part of the CPU that handles all the
calculations the CPU may need. Most of these operations are logical in nature. Depending on how the ALU is
designed, it can make the CPU more powerful, but it also consumes more energy and creates more heat. Therefore,
there must be a balance between how powerful and complex the ALU is and how expensive the whole unit becomes.
This is why faster CPUs are more expensive, consume more power and dissipate more heat.
logical operations: These include operations like AND, OR, NOT, XOR, NOR, NAND, etc.
Bit-Shifting Operations: This pertains to shifting the positions of the bits by a certain number of places
either towards the right or left, which is considered a multiplication or division operations.
Arithmetic operations: This refers to bit addition and subtraction. Although multiplication and division
are sometimes used, these operations are more expensive to make. Multiplication and subtraction can also
be done by repetitive additions and subtractions respectively.