cs244- introduction to embedded systems and …eli/courses/cs244-w10/lecture1...winter 2010- cs 244...

38
CS244-Introduction to Embedded Systems and Ubiquitous Computing Instructor: Eli Bozorgzadeh Computer Science Department UC Irvine Winter 2010

Upload: others

Post on 28-May-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

CS244-Introduction to Embedded Systems and Ubiquitous Computing

Instructor: Eli BozorgzadehComputer Science Department

UC IrvineWinter 2010

Winter 2010- CS 244 2

Introduction to Embedded Systems

Suggested Textbooks:Embedded System Design, by F. Vahid and Givargis, Wiley, 2002Embedded System Design, by P. Marwedel, KluwerAcademic, 2003Embedded System Design, by Gajski, Abdi, and et. al., Springer, 2008

Other sourcesLecture noteshandouts

Winter 2010- CS 244 3

Course outline

LecturesTue-Thu: 9:30-11:00 a.m. DBH 130

Office hours: email me first to make sure I am available!Grading policy:

25%: homework25%: Paper presentation

Each of you presents a paper assigned to you, assignment: aroundweek 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 4

Outline

What are embedded systems?Embedded System Components

Hardware/softwareEmbedded System applicationsModel, languages and toolsHardware/software co-design and synthesisReconfigurable ComputingReal time Operating systems

Copyrighted Material adapted from slides by Peter Marwedel, Frank Vahid,Tony Givargis, Dan Gajski, and Nikil Dutt

Winter 2010- CS 244 5

What’s an Embedded System?Embedded systems =

information processing systems embedded into a larger product

Two types of computingDesktop – produced millions/yearEmbedded – billions/year

Non-Embedded SystemsPCs, servers, and notebooks

The future of computing!Automobiles, entertainment,

communication, aviation, handheld devices, military and medical equipments.

Winter 2010- CS 244 6

Embedded SystemsDevices other than desktop PCs, servers, and notebooks

Electricity running throughPerform something intelligent

Hardware/software which form a component of a larger system, but are concealed from userComputers camouflaged as non-computers The future of computing!

6

Winter 2010- CS 244 7

An Example Embedded SystemDigital Camera Block Diagram

Winter 2010- CS 244 8

ES: Simplified Block Diagram

actuatorsactuators

Winter 2010- CS 244 9

Course Outline

ConceptConceptSpecificationSpecification

HW/SWHW/SWPartitioningPartitioning

Hardware ComponentsHardware Components

Software ComponentsSoftware Components

Estimation Estimation --ExplorationExploration

HardwareHardware

SoftwareSoftware

DesignDesign

(Synthesis, Layout,

(Synthesis, Layout, ……))

DesignDesign(Compilation,

(Compilation, ……))

Validation and Evaluation (area, power, performance, Validation and Evaluation (area, power, performance, ……))

Winter 2010- CS 244 10

Components of Embedded SystemsAnalog Components

Sensors, Actuators, Controllers, …Digital Components

Processor, CoprocessorsMemoriesControllers, BusesApplication Specific Integrated Circuits (ASIC)

Converters – A2D, D2A, …Software

Application ProgramsException Handlers

Hardware

Software

Hardware Components

Winter 2010- CS 244 12

Hardware Components of Embedded Systems- an example

Analog Digital Analog

Memory

Coprocessors

Controllers

Converters

Processor

Interface

Software(Application Programs)

ASIC

Winter 2010- CS 244 13

ProcessorsWhat is a processor?

Artifact that computes (runs algorithms)Controller and data-path

General-purpose (GP) processors:Variety of computation tasksFunctional flexibility and low cost at high volumes (maybe)Slow and power hungry

Single-purpose (SP) processors (or ASIC)One particular computation taskFast and power efficientFunctional inflexibility and high cost at low volumes (maybe)

13

Winter 2010- CS 244 14

GP/SP Processor Architecture

14

Data-Path

DataInput

DataOutput

Control

Status

Controller

Control

Winter 2010- CS 244 15

General-purpose processors

Programmable device used in a variety of applications

Also known as “microprocessor”Features

Program memoryGeneral datapath with large register file and general ALU

User benefitsLow time-to-market and NRE costsHigh flexibility

ExamplesPentium, Athlon, PowerPC

IR PC

Registerfile

GeneralALU

DatapathController

Program memory

Assembly code for:

total = 0for i =1 to …

Control logic and

State register

Datamemory

Winter 2010- CS 244 16

Application-specific IS processors (ASIPs)

Programmable processor optimized for a particular class of applications having common characteristics

Compromise between general-purpose and ASIC (custom hardware)

FeaturesProgram memoryOptimized datapathSpecial functional units

BenefitsSome flexibility, good performance, size and power

ExamplesDSPs, Video Signal Processors, Network Processors,..

IR PC

Registers

CustomALU

DatapathController

Program memory

Assembly code for:

total = 0for i =1 to …

Control logic and

State register

Datamemory

Winter 2010- CS 244 17

Application-Specific ICs (ASICs)

Digital circuit designed to execute exactly one program

coprocessor, hardware acceleratorFeatures

Contains only the components needed to execute a single programNo program memory

BenefitsFastLow powerSmall size

DatapathController

Control logic

State register

Datamemory

index

total

+

Winter 2010- CS 244 18

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 19

GP vs. SP Processors

Programmable controllerControl logic is stored in memoryFetch/decode overhead

Highly general data-pathTypical bit-width (8, 16, 32, 64)Complete set of arithmetic/logic unitsLarge set of registers

High NRE/sale-volume

Hardwired controllerNo need for program memory and cacheNo fetch/decode overhead

Highly tuned data-pathCustom bit-widthCustom arithmetic/logic unitsCustom set of registers

Low NRE/sale-volume

19

GP: ASIC:

Winter 2010- CS 244 20

StorageWhat is a memory?

Artifact that stores bitsStorage fabric and access logic

Write-abilityManner and speed a memory can be written

Storage-permanenceability of memory to hold stored bits after they are written

Many different types of memoriesFlash, SRAM, DRAM, etc.

Common to compose memories

20

Winter 2010- CS 244 21

Write-abilityRanges of write ability

High endProcessor writes to memory simply and quicklyE.g., RAM

Middle rangeProcessor writes to memory, but slowerE.g., FLASH, EEPROM

Lower rangeSpecial equipment, “programmer”, must be used to write to memoryE.g., EPROM, OTP ROM

Low endBits stored only during fabricationE.g., Mask-programmed ROM

21

Winter 2010- CS 244 22

Storage-permanenceRange of storage permanence

High endEssentially never loses bitsE.g., mask-programmed ROM

Middle rangeHolds bits days/months/years after memory’s power source turned offE.g., NVRAM

Lower rangeHolds bits as long as power supplied to memoryE.g., SRAM

Low endBegins to lose bits almost immediately after writtenE.g., DRAM

22

Winter 2010- CS 244 23

Memory Types

23

Stor

age-

perm

anen

ce

Write-ability

Mask-programmed ROM

OTP ROM

EPROM EEPROM FlashNVRAM

SRAM/DRAM

IdealIn-system programmable

Nonvolatile

Winter 2010- CS 244 24

CommunicationWhat is a bus?

An artifact that transfers bitsWires, air, or fiber and interface logic

Associated with a bus, we have:Connectivity scheme

Serial CommunicationParallel CommunicationWireless Communication

ProtocolPortsTiming DiagramsRead and write cycles

Arbitration scheme, error detection/correction, DMA, etc.

24

Winter 2010- CS 244 25

Serial CommunicationA single wire used for data transferOne 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 nodeLower cost in terms of wires (cable)E.g., USB, Ethernet, RS232, I2C, etc.

25

Winter 2010- CS 244 26

Parallel CommunicationMultiple buses used for data transferOne or more additional wires used for controlHigher throughput for short distance communication

Data misalignment problemOften used within a processing node

Higher cost in terms of wires (cable)E.g., ISA, AMBA, PCI, etc.

26

Winter 2010- CS 244 27

Wireless CommunicationInfrared (IR)

Electronic wave frequencies just below visible light spectrumDiode emits infrared light to generate signalInfrared transistor detects signal, conducts when exposed to infrared lightCheap to buildNeed line of sight, limited range

Radio frequency (RF)Electromagnetic wave frequencies in radio spectrumAnalog circuitry and antenna needed on both sides of transmissionLine of sight not needed, transmitter power determines range

27

Winter 2010- CS 244 28

PeripheralsPerform specific computation taskCustom single-purpose processors

Designed by us for a unique task

Standard single-purpose processors“Off-the-shelf”pre-designed for a common task

28

Winter 2010- CS 244 29

TimersTimers: measure time intervals

To generate timed output eventsTo measure input eventsTop: max count reached

Range and resolution

29

16-bit up counterClk

Cnt

Basic timer

Top

Reset

16

Winter 2010- CS 244 30

CountersCounter: like a timer, but counts pulses on a general input signal rather than clock

e.g., count cars passing over a sensorCan often configure device as either a timer or counter

30

16-bit up counter

Clk16

Cnt_in

2x1 mux

Mode

Timer/counter

Top

Reset

Cnt

Winter 2010- CS 244 31

Watchdog TimerMust reset timer every X time unit, else timer generates a signalCommon use: detect failure, self-reset

31

Winter 2010- CS 244 32

UARTUART: Universal Asynchronous Receiver Transmitter

Takes parallel data and transmits seriallyReceives serial data and converts to parallel

Parity: extra bit for simple error checkingStart bit, stop bitBaud rate

Signal changes per secondBit rate, sometimes different

32

Winter 2010- CS 244 33

Pulse Width Modulator (PWM)Generates pulses with specific high/low timesDuty cycle: % time high

Square wave: 50% duty cycleCommon use: control average voltage to electric device

Simpler than DC-DC converter or digital-analog converterDC motor speed, dimmer lights

33

Winter 2010- CS 244 34

LCDLiquid Crystal DisplayN rows by M columnsController build into the LCD moduleSimple microprocessor interface using portsSoftware controlled

34

Winter 2010- CS 244 35

Keypad

35

N1N2N3N4

M1M2M3M4

key_code

keypad controller

k_pressed

key_code

4

N=4, M=4

Winter 2010- CS 244 36

Stepper Motor ControllerStepper 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 coilsController greatly simplifies this

36

Winter 2010- CS 244 37

Analog-to-Digital Converter

37

proportionality

Vmax = 7.5V

0V

11111110

0000

0010

0100

0110

1000

1010

1100

0001

0011

0101

0111

1001

1011

1101

0.5V1.0V1.5V2.0V2.5V3.0V

3.5V4.0V4.5V5.0V

5.5V6.0V6.5V7.0V

Analog to Digital (A/D)

4

3

2

1

t1 t2 t3 t40100 1000 0110 0101

time

anal

og in

put (

V)

Digital output

Digital to Analog(D/A)

4

3

2

1

0100 1000 0110 0101

t1 t2 t3 t4time

anal

og o

utpu

t (V

)

Digital input

Winter 2010- CS 244 38

Summary

Hardware: Information ProcessingProcessorsMemoriesCommunicationPeripherals