CS244-Introduction to
Embedded Systems and
Ubiquitous Computing
Instructor: Eli Bozorgzadeh
Computer Science Department
UC Irvine
Winter 2010
Introduction to Embedded Systems
Suggested Textbooks:
Embedded System Design, by F. Vahid and Givargis,
Wiley, 2002
Embedded System Design, by P. Marwedel, Kluwer
Academic, 2003
Embedded System Design, by Gajski, Abdi, and et. al.,
Springer, 2008
Other sources
Lecture notes
handouts
Winter 2010- CS 244 2
Course outline
Lectures
Tue-Thu: 9:30-11:00 a.m.
DBH 130
Office hours: email me first to make sure I am available!
Grading policy:
25%: homework
25%: Paper presentation
Each of you presents a paper assigned to you, assignment: around
week 4 and presentation around week 8-9.
30%: embedded system Example project (week 6-10)
20%: Exam (late midterm, week 8-9)
Winter 2010- CS 244 3
Outline
What are embedded systems?
Embedded System Components
Hardware/software
Embedded System applications
Model, languages and tools
Hardware/software co-design and synthesis
Reconfigurable Computing
Real time Operating systems
Copyrighted Material adapted from slides by Peter Marwedel, Frank Vahid,
Tony Givargis, Dan Gajski, and Nikil Dutt
Winter 2010- CS 244 4
What’s an Embedded System?
Embedded systems =
information processing systems
embedded into a larger product
Two types of computing
Desktop – produced millions/year
Embedded – billions/year
Non-Embedded Systems
PCs, servers, and notebooks
The future of computing!
Automobiles, entertainment,
communication, aviation, handheld
devices, military and medical
equipments.
Winter 2010- CS 244 5
Embedded Systems
Devices other than desktop PCs, servers, and
notebooks
Electricity running through
Perform something intelligent
Hardware/software which form a component of a
larger system, but are concealed from user
Computers camouflaged as non-computers
The future of computing!
Winter 2010- CS 244 66
An Example Embedded System
Digital Camera Block Diagram
Winter 2010- CS 244 7
ES: Simplified Block Diagram
actuators
Winter 2010- CS 244 8
Course Outline
Hardware Components
Hardware
si gn )
Concept HW/SW De ut, …
Specification Partitioning Layo
,
e s is
yn th
( S
De
sig
Estimation - (C
om n
pil
Exploration a ti
on
, …)
Software Components Software
Winter 2010- CS 244 9
Validation and Evaluation (area, power, performance, …)
Components of Embedded Systems
Analog Components
Sensors, Actuators, Controllers, …
Digital Components
Hardware
Processor, Coprocessors
Memories
Controllers, Buses
Application Specific Integrated Circuits (ASIC)
Converters – A2D, D2A, …
Software
Application Programs Software
Exception Handlers
Winter 2010- CS 244 10
Hardware Components
Hardware Components of Embedded
Systems- an example
Memory Controllers Interface
Software
(Application Programs)
Coprocessors Processor
ASIC
Converters
Analog Winter 2010- CS 244
Digital Analog
12
Processors
What is a processor?
Artifact that computes (runs algorithms)
Controller and data-path
General-purpose (GP) processors:
Variety of computation tasks
Functional flexibility and low cost at high volumes (maybe)
Slow and power hungry
Single-purpose (SP) processors (or ASIC)
One particular computation task
Fast and power efficient
Functional inflexibility and high cost at low volumes (maybe)
Winter 2010- CS 244 13
13
GP/SP Processor Architecture
Status
Data
Input
Data-Path Controller
Control
Data
Output
Control
Winter 2010- CS 244 14
14
General-purpose processors
Programmable device used in a Controller Datapath
variety of applications Control Register
Also known as “microprocessor” logic and file
State
Features register
General
Program memory IR PC ALU
General datapath with large register file
and general ALU Program Data
User benefits memory memory
Low time-to-market and NRE costs Assembly code
for:
High flexibility
total = 0
Examples for i =1 to …
Pentium, Athlon, PowerPC
Winter 2010- CS 244 15
Application-specific IS processors
(ASIPs)
Programmable processor optimized for a
particular class of applications having common Controller Datapath
characteristics Control Registers
Compromise between general-purpose and logic and
ASIC (custom hardware) State
register
Features Custom
ALU
Program memory
IR PC
Optimized datapath
Data
Special functional units
Program memory
Benefits memory
Some flexibility, good performance, size and Assembly code
power for:
Examples total = 0
for i =1 to …
DSPs, Video Signal Processors, Network
Processors,..
Winter 2010- CS 244 16
Application-Specific ICs (ASICs)
Digital circuit designed to execute Controller Datapath
exactly one program Control
logic
index
coprocessor, hardware accelerator total
State
Features register +
Contains only the components needed
Data
to execute a single program memory
No program memory
Benefits
Fast
Low power
Small size
Winter 2010- CS 244 17
Application Specific Circuits (ASIC)
Custom-designed circuits
necessary if ultimate speed or
energy efficiency is the goal
and large numbers can be sold.
Approach suffers from long
design times and high costs.
Winter 2010- CS 244 18
GP vs. SP Processors
GP: ASIC:
Programmable controller Hardwired controller
Control logic is stored in No need for program memory
memory and cache
Fetch/decode overhead No fetch/decode overhead
Highly general data-path Highly tuned data-path
Typical bit-width (8, 16, 32, Custom bit-width
64) Custom arithmetic/logic units
Complete set of Custom set of registers
arithmetic/logic units
Large set of registers Low NRE/sale-volume
High NRE/sale-volume
Winter 2010- CS 244 19
19
Storage
What is a memory?
Artifact that stores bits
Storage fabric and access logic
Write-ability
Manner and speed a memory can be written
Storage-permanence
ability of memory to hold stored bits after they are
written
Many different types of memories
Flash, SRAM, DRAM, etc.
Common to compose memories
Winter 2010- CS 244 20
20
Write-ability
Ranges of write ability
High end
Processor writes to memory simply and quickly
E.g., RAM
Middle range
Processor writes to memory, but slower
E.g., FLASH, EEPROM
Lower range
Special equipment, “programmer”, must be used to write to
memory
E.g., EPROM, OTP ROM
Low end
Bits stored only during fabrication
E.g., Mask-programmed ROM
Winter 2010- CS 244 21
21
Storage-permanence
Range of storage permanence
High end
Essentially never loses bits
E.g., mask-programmed ROM
Middle range
Holds bits days/months/years after memory’s power source
turned off
E.g., NVRAM
Lower range
Holds bits as long as power supplied to memory
E.g., SRAM
Low end
Begins to lose bits almost immediately after written
E.g., DRAM
Winter 2010- CS 244 22
22
Memory Types
Mask-programmed ROM In-system programmable
Ideal
Storage-permanence
OTP ROM
EPROM EEPROM Flash
NVRAM
Nonvolatile
SRAM/DRAM
Write-ability
Winter 2010- CS 244 23
23
Communication
What is a bus?
An artifact that transfers bits
Wires, air, or fiber and interface logic
Associated with a bus, we have:
Connectivity scheme
Serial Communication
Parallel Communication
Wireless Communication
Protocol
Ports
Timing Diagrams
Read and write cycles
Arbitration scheme, error detection/correction, DMA, etc.
Winter 2010- CS 244 24
24
Serial Communication
A single wire used for data transfer
One or more additional wires used for control
(but, some protocols may not use additional
control wires)
Higher throughput for long distance
communication
Often across processing node
Lower cost in terms of wires (cable)
E.g., USB, Ethernet, RS232, I2C, etc.
Winter 2010- CS 244 25
25
Parallel Communication
Multiple buses used for data transfer
One or more additional wires used for control
Higher throughput for short distance
communication
Data misalignment problem
Often used within a processing node
Higher cost in terms of wires (cable)
E.g., ISA, AMBA, PCI, etc.
Winter 2010- CS 244 26
26
Wireless Communication
Infrared (IR)
Electronic wave frequencies just below visible light spectrum
Diode emits infrared light to generate signal
Infrared transistor detects signal, conducts when exposed to
infrared light
Cheap to build
Need line of sight, limited range
Radio frequency (RF)
Electromagnetic wave frequencies in radio spectrum
Analog circuitry and antenna needed on both sides of
transmission
Line of sight not needed, transmitter power determines range
Winter 2010- CS 244 27 27
Peripherals
Perform specific computation task
Custom single-purpose processors
Designed by us for a unique task
Standard single-purpose processors
“Off-the-shelf”
pre-designed for a common task
Winter 2010- CS 244 28
28
Timers
Timers: measure
time intervals
Basic timer
To generate timed
output events Clk
16-bit up counter 16 Cnt
To measure input
events Top
Top: max count Reset
reached
Range and
resolution
Winter 2010- CS 244 29 29
Counters
Counter: like a
timer, but counts
pulses on a general Timer/counter
input signal rather Clk
2x1
mux
16-bit up
counter
16 Cnt
than clock Cnt_in Top
e.g., count cars passing Reset
over a sensor Mode
Can often configure
device as either a timer or
counter
Winter 2010- CS 244 30 30
Watchdog Timer
Must reset timer every X time unit, else timer
generates a signal
Common use: detect failure, self-reset
Winter 2010- CS 244 31 31
UART
UART: Universal Asynchronous Receiver
Transmitter
Takes parallel data and transmits serially
Receives serial data and converts to parallel
Parity: extra bit for simple error checking
Start bit, stop bit
Baud rate
Signal changes per second
Bit rate, sometimes different
Winter 2010- CS 244 32
32
Pulse Width Modulator (PWM)
Generates pulses with specific high/low
times
Duty cycle: % time high
Square wave: 50% duty cycle
Common use: control average voltage
to electric device
Simpler than DC-DC converter or digital-
analog converter
DC motor speed, dimmer lights
Winter 2010- CS 244 33
33
LCD
Liquid Crystal Display
N rows by M columns
Controller build into
the LCD module
Simple
microprocessor
interface using ports
Software controlled
Winter 2010- CS 244 34 34
Keypad
N1
N2
N3 k_pressed
N4
M1
M2
M3
M4 4
key_code key_code
keypad controller
N=4, M=4
Winter 2010- CS 244 35
35
Stepper Motor Controller
Stepper motor: rotates fixed number of
degrees when given a “step” signal
In contrast, DC motor just rotates when power
applied, coasts to stop
Rotation achieved by applying specific
voltage sequence to coils
Controller greatly simplifies this
Winter 2010- CS 244 36
36
Analog-to-Digital Converter
Vmax = 7.5V 1111 4 4
7.0V 1110
6.5V 1101 3 3
analog output (V)
analog input (V)
6.0V 1100
5.5V 1011
2 2
5.0V 1010
4.5V 1001
4.0V 1 1
1000
3.5V 0111
3.0V 0110 time time
t1 t2 t3 t4 t1 t2 t3 t4
2.5V 0101
2.0V 0100 0100 1000 0110 0101 0100 1000 0110 0101
1.5V 0011 Digital output Digital input
1.0V 0010
0.5V 0001
0V 0000
proportionality Analog to Digital Digital to Analog
(A/D) (D/A)
Winter 2010- CS 244 3737
Summary
Hardware: Information Processing
Processors
Memories
Communication
Peripherals
Winter 2010- CS 244 38