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

Microprocessor Systems I: Dara Rahmati

This document provides an overview of microprocessor systems. It discusses the differences between a CPU and a microprocessor, with a microprocessor being a single-chip implementation of a CPU. It also describes the basic components of a microcomputer system, including the CPU (microprocessor), memory, input/output ports, and bus. Finally, it discusses different types of processors like microcontrollers, programmable logic controllers, and digital signal processors.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views

Microprocessor Systems I: Dara Rahmati

This document provides an overview of microprocessor systems. It discusses the differences between a CPU and a microprocessor, with a microprocessor being a single-chip implementation of a CPU. It also describes the basic components of a microcomputer system, including the CPU (microprocessor), memory, input/output ports, and bus. Finally, it discusses different types of processors like microcontrollers, programmable logic controllers, and digital signal processors.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Lecture 2:

Microprocessor Systems I
Dara Rahmati

Some of the slides are borrowed from


Dr. Seyed-Hosein Attarzadeh-Niaki
Microprocessors and Assembly 1
CPU & Microprocessor

A CPU (central processing unit) is the part of a computer that executes


instructions. This can be implemented using a single IC, a number of ICs,
discrete transistors or a room full of vacuum tubes.

A Microprocessor is a single-chip implementation of a CPU

As of today CPUs, we use both terms aas identical

Microprocessors and Assembly 2


Microprocessor
• Microprocessors (AKA CPU)
– the CPU circuitry can be reduced to IC (Integrated Circuit)
scale, consisting of ALU, CU and registers
– contains no RAM, ROM, or I/O ports on the chip itself
– e.g., Intel’s x86 family (8088, 8086, 80386, 80386, 80486,
Pentium); Motorola’s 680x0 family (68000, 68010, 68020,
etc)

Microprocessors and Assembly 3


Microcomputer
• CPU: processes information stored in the memory
– Microprocessor
• Memory: stores both instructions and data
– ROM, RAM
• Input/Output ports: provide a means of communicating with the CPU
– Connecting I/O devices, e.g., keyboard, monitor, tape, disk, printer and etc.
• BUS: interconnecting all parts together
– Address bus
– Data bus
– Control bus

Microprocessors and Assembly 4


Microcomputer Structure
Address bus

I/O I/O
CPU Memory
Microprocessor
ports devices

Data bus

Control bus

Microprocessors and Assembly 5


Bus
• A bus is a communication pathway connecting two
or more devices
– A shared transmission medium: one device at a time
– System bus: connects major computer components
(processor, memory, I/O)
– Bus Access
• Centralized/Distributed/Time Multiplexing

Microprocessors and Assembly 6


Von Neumann (Princeton) Architecture

Princeton architecture
1.Five components partitioning
• Input/Output I/O Ports
• Memory Memory
• ALU
• Registers CPU
• Control unit
2. Three key concepts:
– Both instructions and data are stored in a single
read-write memory
– The contents of memory are addressable by location,
without regard to the type of data Harvard architecture
– Execution occurs in a sequential fashion

Microprocessors and Assembly 7


Microprocessors and Assembly 8
Microcomputer System
• Microcomputer
• Peripheral I/O devices
• Software
– System software
• e.g., OS, compilers, drivers
– Application software
• e.g. Word, MATLAB, Media player, Latex…

Sometimes we refer to Microcomputer System simply just as Computer

Microprocessors and Assembly 9


Microcomputer System Structure
ALU

Microprocessor
CU
(μP)

Microcomputer
Memory Registers
( μC )
I/O Device 1
Microcomputer I/O ports
system I/O Device 2
(μCS) I/O devices …

I/O Device n
System software
Application software

Microprocessors and Assembly 10


Microprocessor vs. Microcontroller

Microprocessors and Assembly 11


Microprocessor – Basic concept
ADDRESS BUS
32-bit / 64-bit wide

Microprocessor

Contains: CONTROL BUS


ALU Timing signals, ready signals,
CU interrupts etc
Registers

DATA BUS – bidirectional


8-bit / 16-bit / 32-bit / 128-bit

Microprocessor, by-itself, completely useless – must have external peripherals to


Interact with outside world
MicroPROCESSOR – Basic concept
CONTROL BUS

ADDRESS
BUS
mamulan
baraye rah
har no
oftadane
mobadele
system ast
yek format
Keyboard
Microprocessor BOOT az energy b
digari Screen
ROM Instruction Data
Contains: UART
ALU (program) Transducers
RAM Parallel
CU Used at ROM/RAM mese
Registers microphon interface
startup e
(mekaniki
etc.
b electriki)

DATA BUS

Microprocessor, by-itself, completely useless – must have external peripherals to


Interact with outside world
MicroCONTROLLER – Basic concept
CONTROL

ADDRESS

BOOT
ROM Instruction Data UART
Microprocessor (program) RAM Parallel
Used at ROM interface
contains
CU startup Transducers Etc
ALU
Registers

DATA

Microcontroller – put a limited amount of most commonly used resources


“inside” the chip – a “limited” amount is often “enough” for many applications
Advantages of microCONTROLLER over
microPROCESSOR
• Pin-count down
• Design time down, Board layout size down
• Matching between peripherals for speed, easy
usage and reliability
• Cost down – bulk purchases
• Common software / hardware design
environment available from manufacturer
software o hardware baham hastan
Microprocessor and Microcontroller
• A microcontroller is a microcomputer-on-a-chip
– A type of microprocessor emphasizing self-sufficiency and
cost-effectiveness, in contrast to a general-purpose donbale khodkafaie
microprocessor
• Main differences between a microcontroller and a
microprocessor:
– Microprocessor is a CPU with ALU, control unit and
registers
– Microcontroller has a simple CPU with additional elements
like ROM, RAM, peripherals (timer, I/O ports, etc).
• The boundary can be blurred hanuz enghad joda nistn az ham va marze daghighi vojud nadare

– Intel Atom, AMD Geode, Recent SoCs system on chips

Microprocessors and Assembly 16


Various Processor Types

Processor refers to both of microprocessor and microcontroller

Microprocessors and Assembly 17


Programmable
Logic Controllers (PLCs)baraye kar haye sanati estefade mishe

• A specialized form of a microcontroller


for industrial automation
• Initially designed to replace relay logic
boards mesale charkh bad kardane mashin ya teste charkh

– Sequence device actuation


– Coordinate activities
• Accepts input from a series of switches
az yekseri switch ha vorudi migire va khoruji ro b dastgah ha mifrese

• Sends output to devices or relays


Programmable
Logic Controllers (PLCs)
• Originated as replacements for
control circuits using electrical
relays to control machinery
• Often programmed using
ladder logic
– A graphical notation originally
used to specify logic constructed
with relays and switches
• Today PLCs: Microcontrollers
with suitable IO interfaces
input b sensor vasle va output b actuator
zabane anha ladder ast

Microprocessors and Assembly 19


Digital Signal Processor (DSP)
• DSP Processors designed • Characteristics
specifically to support – Harvard architecture
numerically intensive signal – Addressing modes supporting
processing applications auto increment, circular
buffers, and bit-reversed
• Applications: Audio and addressing (for FFT)
video processing, radar, – Support fixed-point and/or
sonar, medical electronics, floating-point data precisions
etc.
– Large amounts of data • Difficult to program
– Perform sophisticated
mathematical operations on – Assembly or specialized
the data (assembly-coded) C libraries
• System identification,
frequency analysis, machine
learning, and feature
extraction

Microprocessors and Assembly 20


Graphics Processor Unit (GPU)
• A specialized processor designed
especially to perform the
calculations required in graphics
rendering
– Render text and graphics, combine
multiple graphic patterns, draw
objects, 3D graphics, shading, and
digital video
• GPUs have evolved towards more
general programming models
(CUDA, OpenCL), GPGPU concept
• Typically quite power hungry

Microprocessors and Assembly 21


GPU vs CPU
• A GPU is tailored for highly parallel operation while a CPU
executes programs serially
• For this reason, GPUs have many parallel execution units and
higher transistor counts, while CPUs have few execution units
and higher clock speeds
• GPUs have much deeper pipelines (several thousand stages vs
10-20 for CPUs)
• GPUs have significantly faster and more advanced memory
interfaces as they need to shift around a lot more data than
CPUs
Components of a Microcomputer

Microprocessors and Assembly 23


Arithmetic Logic Unit (ALU)
• Performs arithmetic and logic operations
• Receives data from main memory and/or
registers, stores the results back into memory
and/or registers
• The processor can decide the program flow based
on if a number is zero, if it is positive, and …
– Allow the processor to modify the program flow
– Programs appear to work through these simple
decisions.

Microprocessors and Assembly 24


Hardware of an ALU
Input Input
• ALU is a multifunctional calculator
– What specific calculation will be taken
depends on the particular control signal
• Two inputs control ALU
signal
• Calculation result can be temporarily
stored in one of the registers
results

Microprocessors and Assembly 25


Arithmetic and Logic Operations
Operation Comment
Addition
Subtraction
Multiplication
Division
AND Logical Multiplication
OR Logical Addition
NOT Logical Inversion
NEG Arithmetic Inversion
Shift
Rotate Microprocessors and Assembly 26
Decisions
Decision Comment
Zero Test a number for zero or not zero
Sign Test a number for positive or negative
Carry Test for a carry after addition or a
borrow after subtraction
Parity Test a number for an even or an odd
number of ones tedade 1 ha farde ya zoj

Overflow Test for an overflow that indicates an


invalid signed result after addition or
subtraction
Microprocessors and Assembly 27
Control Unit (CU)
• The control unit is the central part of the processor which
controls its operation
• Control unit works based on instructions
• An instruction is a pre-defined code which defines a
specific operation, processing and exchanging
information among CPU, memory and I/O devices.
• CU contains an instruction decoder
– decodes an instruction and generates all control signals,
coordinating all activities within the computer
• CU contains a program counter
– points to the address of the next instruction to be executed

Microprocessors and Assembly 28


Control Unit (CU)
• It cycles through the following operations:
– Fetch: Fetches machine language instructions
from memory
– Decode: Decodes the instruction
– Execute: Control the interpretation of each
instruction
• fetching the required operands (data) from registers or
memory
• controlling the required executions steps
• storing the results in registers or memory

Microprocessors and Assembly 29


Instruction Set
• The instruction set
– All instructions are recognized by the instruction decoder
• CISC (Complex Instruction Set Computers)
– Variable instruction length (1 word- n words)
– Variable execution time of different format instructions
– More instruction formats
– Backward compatible (new instruction set contains earlier generation’s
instructions) yani pardazandeye jadid hanuz instruction haye ghabli ro ham shamel mishe va
barnamehaye ghadimi amalan ghabele ejran
– e.g., 80x86 family has more than 3000 instructions
• RISC (Reduced Instruction Set Computers)
– Fixed size (1 word)
– Fixed time for all instructions
– Easy to pipeline the RISC instructions (fast)
– Fewer formats (simple hardware, shorter design cycle)
– e.g., PowerPC, MIPS, ARM, RISC-V, PIC’s MCU

Microprocessors and Assembly 30


Registers
• Registers are specialized locations that the
CPU uses to read or write a binary number
• Registers are used to hold data and address
values
• The number and types of registers depends on
the CPU design
• Registers are used both by the CPU and may
be used by the I/O subsystem

Microprocessors and Assembly 31


Memory

Microprocessors and Assembly 32


Memory
• Memory is the set of digital
locations each of which can har kodum ye byte osuln

hold the same size data value


– Usually a byte
• Often consecutive bytes form
words (2 bytes), double words
(4 bytes) etc.
• Each location has a unique
address. A 16-bit address
allows for 65,636 (64K)
memory locations
• A transfer of data from
memory is a read. A transfer
of data to memory is a write.
osulan byte addressable hastn
2byte mishe ye word

Microprocessors and Assembly 33


Memory
• bit (b): a binary digit that can have the value 0 or 1
• Byte (B): consists of 8 bits
– smallest unit that can be addressed in microcomputers 10101010
• Nibble: is half a byte (4bits)
• Word: the number of bits that a CPU can process at one time
– depends on the width of the CPU’s registers and that of the
data bus
• e.g., if the width of the data bus is 16 bits, then a word is 16
bits; if the width of the data bus is 32 bits, then a word is 32
bits
• Double word
• Kilo, Mega, Giga, Tera, Peta, …
2 b tavane: 10, 20 , 30 , 40 , 50

Microprocessors and Assembly 34


Hardware: Memory Organization

Primary Secondary
CPU
Internal
Cache memory memory
Regs.

• Memory hierarchy
– Cache(s)
– Primary memory: ROM, RAM
– Secondary memory: magnetic disk, optical memory, tape, …

Microprocessors and Assembly 35


Hardware: Memory Organization

Primary Secondary
CPU
Internal
Cache memory memory
Regs.

• Memory hierarchy
– Cache(s)
– Primary memory: ROM, RAM
– Secondary memory: magnetic disk, optical memory, tape, …

Microprocessors and Assembly 36


Memory Characteristics I
• Location
– CPU (registers, Cache),
– Internal of Microcomputer (Cache, main
memory),
– External (Disk, tape, DVD)
• Capacity parameters
– Word size, Number of words
• Unit of transfer
– Internal: Word,
External: Usually a block
– Addressable unit: Normally
a Byte for internal memory,
Cluster on disks

Microprocessors and Assembly 37


Memory Characteristics II
• Access method
– Sequential (tape), Direct (hard disk), Random (RAM, ROM),
Associative (Cache)
• Performance
– Access time
• Access time, also known as response time or latency, refers to how
quickly the memory can respond to a read or write request
– Memory Cycle time
• The minimum period between two successive requests. For
various reasons the time separating two successive requests is not
always 0, i.e a memory with a response time of 80 ns cannot
satisfy a request every 80 ns
– Transfer Rate
• Maximum amount of data transferred during a unit time

Microprocessors and Assembly 38


Types of Memory I
• Random-access memory (RAM): Same amount
of time is required to access any location on
the same chip, two variants: DRAM,SRAM
– Dynamic random-access memory (DRAM):
periodic refresh is required to maintain the
contents of a DRAM chip
– Static random-access memory (SRAM): no
periodic refresh is required

Microprocessors and Assembly ٣٩


Types of Memory II
• Read-only memory (ROM): Can only be read but not
written by the processor
– Mask-programmed read-only memory (MROM): programmed
when being manufactured
– Programmable read-only memory (PROM): the memory chip
can be programmed by the end user
– Erasable programmable ROM (EPROM): electrically
programmable many times
• erased by ultraviolet light (through a window)
• erasable in bulk (whole chip in one erasure operation)
– Electrically erasable programmable ROM (EEPROM): electrically
programmable many times
• electrically erasable many times
• can only be erased in bulk

Microprocessors and Assembly ۴٠


Types of Memory III
• Flash memory
– electrically programmable many times
– electrically erasable many times
– can be erased one location, one row, or whole
chip in one operation

Microprocessors and Assembly ۴١


Primary Memory Organization

Microprocessors and Assembly 42


Single-bus Structure
Address Bus

IO device
CPU RAM ROM I/O ports
IO device

Data Bus

Control Bus

A bus connects all modules


• pro:simple
• con:poor performance in terms of throughput

Microprocessors and Assembly 43


CPU-Central Dual-Bus Structure
I/O bus
CPU
Memory I/O ports I/O ports I/O ports
bus

Memory
IO device IO device IO device

• A dedicated bus between CPU and memory, and a dedicated bus between CPU
and I/O devices
• pro:efficient in terms of data transfer
• con:information between memory and I/O devices has to go through CPU.
Therefore, poor CPU performance

Microprocessors and Assembly 44


Memory-Central Dual-Bus Structure
I/O bus

Memory I/O port I/O port


CPU Memory
bus

• Gain both High CPU IO device IO device


performance and data transfer
throughput
dar in halat memory geroon mishe

Microprocessors and Assembly 45


Memory-mapped I/O

Address
Address Memory

CPU Address chosen


decoder
chosen I/O
address

Microprocessors and Assembly 46


Isolated I/O

MA address
Address Memory address Memory
chosen
CPU CPU

IOA address I/O address I/O


chosen

Dedicated address lines Multiplexing address lines

What is the essential difference between the memory-mapped


and isolated I/O addressing schemes?

Microprocessors and Assembly 47


Addressing scheme to accessing
memory and I/O modules
• Memory-mapped I/O
– One single address space for both memory and I/O
– Status and data registers of I/O modules are treated
as memory locations
– Using the same machine instructions to access both

• Isolated I/O
– Two separate address spaces for memory and I/O
modules
– Using different sets of accessing instructions
Microprocessors and Assembly 48
End

Microprocessors and Assembly 49

You might also like