0% found this document useful (0 votes)
4 views

Lec 2 - Introduction - MP

The document provides an introduction to microprocessors, detailing their definitions, components, and operations. It explains the differences between microcomputers, microprocessors, and microcontrollers, and discusses the internal structure of a microprocessor, including the Arithmetic/Logic Unit, Control Unit, and registers. Additionally, it covers concepts such as clock speed, instruction sets, cache memory, and bus systems, essential for understanding microprocessor functionality.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lec 2 - Introduction - MP

The document provides an introduction to microprocessors, detailing their definitions, components, and operations. It explains the differences between microcomputers, microprocessors, and microcontrollers, and discusses the internal structure of a microprocessor, including the Arithmetic/Logic Unit, Control Unit, and registers. Additionally, it covers concepts such as clock speed, instruction sets, cache memory, and bus systems, essential for understanding microprocessor functionality.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

EE-222 Microprocessors

Systems
By Dr Mir Yasir Umair
Associate Professor, MCS, NUST
Introduction to
Microprocessor
Lecture 02
Basic Concepts of
Microprocessors
• Differences between:
– Microcomputer – a computer with a
microprocessor as its CPU. Includes memory, I/O
etc.
– Microprocessor – silicon chip which includes
ALU, register circuits & control circuits
– Microcontroller – silicon chip which includes
microprocessor, memory & I/O in a single
package.
What is a Microprocessor?
• The word comes from the combination micro and
processor.
– Processor means a device that processes data
Micro
• Micro:
– In the late 1960’s, processors were built using discrete
elements.
– In the early 1970’s the microchip was invented.
– All of the components that made up the processor
were now placed on a single piece of silicon.
– The size became several thousand times smaller and
the speed became several hundred times faster. The
“Micro”Processor was born.
Definition of the Microprocessor

The microprocessor is a programmable device


that takes in numbers, performs on them
arithmetic or logical operations according to the
program stored in memory and then produces
other numbers as a result.
Definition (Contd.)
– Programmable device: The microprocessor can perform
different sets of operations on the data it receives depending
on the sequence of instructions supplied in the given
program.
By changing the program, the microprocessor manipulates
the data in different ways.

– Instructions: Each microprocessor is designed to execute a


specific group of operations. This group of operations is
called an instruction set. This instruction set defines what the
microprocessor can and cannot do.
Definition (Contd.)
– Takes in: The data that the microprocessor
manipulates must come from :
• It comes from what is called “input devices”.
• These are devices that bring data into the system
from the outside world.
• These represent devices such as a keyboard, a
mouse, switches, and the like.
Definition (Contd.)
– Numbers: It only understands binary numbers.

A binary digit is called a bit (which comes from binary digit).

The microprocessor recognizes and processes a group of bits


together. This group of bits is called a “word”.

The number of bits in a Microprocessor’s word, is a measure of its


“abilities”.
Definition (Contd.)
– Words, Bytes, etc.
• The earliest microprocessor (the Intel 8085 and Motorola’s
6800) recognized 8-bit words.
– They processed information 8-bits at a time. That’s why they are
called “8-bit processors”. They can handle large numbers, but in
order to process these numbers, they broke them into 8-bit pieces
and processed each group of 8-bits separately.

• Later microprocessors (8086 ) were designed with 16-bit


words.
– A group of 8-bits were referred to as a “half-word” or “byte”.
– A group of 4 bits is called a “nibble”.
– Also, 32 bit groups were given the name “long word”.

• Today, all processors manipulate at least 32 bits at a time and


there exists microprocessors that can process 64 bits
Definition (Contd.)
– Arithmetic and Logic Operations:
• Every microprocessor has arithmetic operations such as add
and subtract as part of its instruction set.
– Most microprocessors will have operations such as multiply and
divide.
– Some of the newer ones will have complex operations such as
square root.

• In addition, microprocessors have logic operations as well.


Such as AND, OR, XOR, shift left, shift right, etc.

• Again, the number and types of operations define the


microprocessor’s instruction set and depends on the specific
microprocessor.
Definition (Contd.)
– Stored in memory :
– Memory is the location where information is kept

– Memory is a collection of storage devices. Usually, each


storage device holds one bit. Also, in most kinds of
memory, these storage devices are grouped into groups of
8. These 8 storage locations can only be accessed
together. So, one can only read or write in terms of bytes
to and form memory.

– Memory is usually measured by the number of bytes it


can hold.
It is measured in Kilos, Megas and lately Gigas. A Kilo
in computer language is 210 =1024. So, a KB
(KiloByte) is 1024 bytes. Mega is 1024 Kilos and
Giga is 1024 Mega.
Definition (Contd.)
– Stored in memory:
• When a program is entered into a computer, it is
stored in memory. Then as the microprocessor starts
to execute the instructions, it brings the instructions
from memory one at a time.

• Memory is also used to hold the data.


– The microprocessor reads (brings in) the data from
memory when it needs it and writes (stores) the results
into memory when it is done.
Definition (Contd.)
– Produces: For the user to see the result of the
execution of the program, the results must
be presented in a human readable form.
• The results must be presented on an output
device.

• This can be the monitor, a paper from the printer, a


simple LED or many other forms.
A Microprocessor-based system

Input Output

Memory
Inside The Microprocessor
• Internally, the microprocessor is made up of
3 main units.
– The Arithmetic/Logic Unit (ALU)
– The Control Unit.
– An array of registers for holding data while it is
being manipulated.
Organization of a microprocessor- based
system
• Let’s expand the picture a bit.
I/O
Input / Output

ALU Register
Array
System Bus

Control Memory

ROM RAM
Clock speed
Also called clock rate, the clock speed is the speed at which a
microprocessor executes instructions. Every computer
contains an internal clock that regulates the rate at which
instructions are executed and synchronizes all the various

computer components.
 The faster the clock, the more instructions the

microprocessor can execute per second.


 The microprocessor requires a fixed number of clock ticks

(or clock cycles) to execute each instruction.


 Clock speed is stated in either MHz or GHz.

1 MHz =1 million cycles per second,


1 GHz = 1 billion cycles per second.
 Some microprocessors are superscalar, which means

that they can execute more than one instruction per clock
cycle.
CPU Performance Evaluation
A program consists of instructions
• # of instructions
• On average an instruction takes x
number of clock cycles to be
executed(CPI)
• Clock cycle time of the CPU (1/f)
So the CPU execution time consists of

# of instructions x CPI x clock cycle


time
Example
A program consists of 10M instructions
Average CPI=2.5 cycles/instructions
CPU clock rate=200MHz
CPU clock cycle =1/200M=5x10-9 sec/cycle

CPU Execution time =10 x106 x 2.5 x 5x10-9


125 msec
Calculation of CPI (Cycles Per
Instruction) For the multi-cycle MIPS
Load 5 cycles
Store 4 cycles
R-type 4 cycles
Branch 3 cycles
Jump 3 cycles
If a program has
50% R-type instructions
10% load instructions
20% store instructions
18% branch instructions
2% jump instructions then what is the CPI?
CPI = (4x50 + 5x10 + 4x20 + 3x18 + 3x2)/100 = 3.9
Example
A program consists of 1 billion instructions
Clock Speed is 2 GHz.
Suppose also
 50% of the instructions execute in 3 clock cycles,
 30% execute in 4 clock cycles, and
 20% execute in 5 clock cycles.
What is the execution time for the program or task?
instruction count: 109 instructions.
Clock time = 0.5×10-9 seconds.
CPI= (3x50 + 4x30 +5x20)/100=3.7
Execution time = 1.0×109 × 3.7 × 0.5×10-9 sec = 1.85
sec.
Registers
Register is a small high speed named memory.
Data is usually loaded from the memory to the registers
Its size determines the speed of the CPU
 In a 32 bit processor all of its registers are 32 bit wide
Instruction Set
The possible operations a microprocessor can performs is
based on its instruction set.

Programs are written for a microprocessor based on its


instruction set.

For example, a computer understands 10 instructions, and any


program written for it uses those ten instructions in various ways to
accomplish some complicated tasks.
Cache
Memory cache is a high speed storage
mechanism that holds recently read data and
instructions from main memory, which
eliminates the processor from having to
constantly access main memory.

The program first checks the cache to see if the


desired information is already present there.

95% of the time the processor is working, it is


accessing information from cache.
Levels of Cache:-
 L1 cache (also called primary cache) is built directly into the
microprocessor, a location referred to as "on-die".
 Size varies from 2KB-64KB
 L2cache (also called secondary cache) is not usually built into
microprocessor.
 Size varies 256KB-512KB
 L3 Cache:- The L3 cache is larger in size but also slower in speed than L1
and L2,it's size is between 1MB to 8MB.
 In Multicore processors, each core may have separate L1 and L2,but all
core share a common L3 cache.
BUS SYSTEM
Data BUS
Address BUS
Control BUS
Internal structure and basic operation of microprocessor

Address
ALU Register
bus
Section
Data bus

Control and timing


section Control bus

Block diagram of a
microprocessor 31
Data bus
The data bus is 'bi-directional'
 data or instruction codes from memory or
input/output are transferred into the
microprocessor
 the result of an operation or computation is
sent out from the microprocessor to the
memory or input/output.
Depending on the particular
microprocessor, the data bus can handle
8 bit or 16 bit data.

32
Address bus
The address bus is 'unidirectional',
over which the microprocessor sends an
address code to the memory or
input/output.
The size (width) of the address bus is
specified by the number of bits it can
handle.
The more bits there are in the address
bus, the more memory locations a
microprocessor can access.
A 16 bit address bus is capable of
addressing 65,536 (64K) addresses. 33
Control bus
The control bus is used by the
microprocessor to send out timing and
control signals in order to coordinate and
regulate its operation and to
communicate with other devices, i.e.
memory or input/output.

34
Bus Speed
The processor communicates with other devices via the data
bus, sometimes called the front side bus. Bus speed is
measured in MHz, the same unit used to measure clock speed.
While a processor might be working at up to 3 GHz, quite often
the performance of the computer is hampered by a slower
data bus speed.
Block diagram of micro computer
Questions
Thank You

You might also like