Hardware Software Codesign of Embedded Systems

Syllabus Introduction to Embedded System Design HW/SW Codesign Overview Cospecification and modeling Embedded System partitioning CPU and Accelerator ...
Author: Richard Park
9 downloads 3 Views 520KB Size
Syllabus Introduction to Embedded System Design HW/SW Codesign Overview Cospecification and modeling Embedded System partitioning CPU and Accelerator based Embedded System Codesign Embedded Computer Organization Embedded System controller case studies Embedded SoPC: Virtex System on Programmable Chips

1.

Hardware Software Codesign of Embedded Systems

2. 3. 4. 5.

Siamak Mohammadi Tehran University

6. 7. 8.

S. Mohammadi

Syllabus 9. 10. 11. 12.

2

References

Compilers for Embedded Systems Real-time operating systems System level power/energy optimization HW/SW Codesign environments

„

Hardware/Software Co-Design: Principles and Practices ‰

„

„

HW/SW Codesign of Embedded Systems Tehran University

3

J. Staunstrup and W. Wolf, Kluwer 1997

Embedded System Design: A Unified Hardware/Software Approach ‰

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

Frank Vahid and Tony Givargis, 1999

Papers

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

4

Course goals „

„

„

Course goals (cont.)

Show benefits of the codesign approach over current design process ‰ Provide information on how to incorporate these techniques into a general digital design methodology for embedded systems

HW/SW Codesign of Embedded Systems Tehran University

5

Introduction „

„ „ „

„ „

Software and hardware components of an embedded system

Understand real-time operating systems Embedded Computer Architecture

Illustrate how codesign concepts are being introduced into design methodologies Introduce the fundamentals of HW/SW codesign and partitioning concepts in designing embedded systems ‰ Discuss the current trends in the codesign of embedded systems ‰ Provide information on the goals of and methodology for partitioning hardware/software in systems

S. Mohammadi

„

‰

S. Mohammadi

6

What is an Embedded (real-time) System? Most embedded systems are also real-time systems. „ An embedded system is an information processing system that responds to externally generated input stimuli within a finite and specified period.

What are Embedded Systems? Difficulties with the design of heterogeneous HW/SW Systems Requirements of modern embedded systems Embedded Systems Design Flow Embedded Systems Application

‰

‰

„

„

HW/SW Codesign of Embedded Systems Tehran University

7

The correctness depends not only on the logical result but also the time it was delivered Failure to respond is as bad as the wrong response!

Embedded system: any device that includes a programmable computer but is not itself a generalpurpose computer Take advantage of application characteristics to optimize the design: ‰

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

Don’t need all the general-purpose bells and whistles.

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

8

Embedding a computer

Embedded Systems „

„

„

„

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

9

„

„

„

Real-time systems process events Events occurring on external inputs cause other events to occur as outputs Minimizing response time is usually a primary objective, or otherwise the entire system may fail to operate properly Types of Embedded Real Time System: ‰ ‰ ‰

Hard real-time Soft real-time Firm real-time

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

10

Types of Real-Time Systems

Embedded Real Time Systems „

Electronic devices that incorporate a computer (microprocessor/micro-controller) in their implementation A computer is used in such devices primarily as a means to simplify the system design and to provide flexibility Often the user of the device is not even aware that a computer is present Embedded Systems are every where ‰ Embedded processors account for more than 90% of worldwide microprocessor production. ‰ Embedded:desktop = 100:1 ‰ 99% of all processors are for the embedded systems market. ‰ Number of embedded processors in a typical home is estimated at 50-60 (a recent Acura automobile has more than 48 processors)

11

„

„

„

Hard real-time — systems where it is absolutely imperative that the responses occur within the required deadline. For ex: Flight control systems, heart pace makers Soft real-time — systems where deadlines are important but which will still function correctly if deadlines are occasionally missed. For ex: dropping frames while displaying a video Firm real-time — allow occasional deadline violations but discard any jobs that are not finished by their deadlines

A single system may have all hard, soft and firm real-time subsystems. In reality many systems will have a cost function associated with missing each deadline.

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

12

Multi-tasking and Concurrency

Embedded Systems Applications

„ Most embedded systems have several inputs/outputs and multiple events occurring independently „ Separating tasks simplifies programming, but requires somehow switching back and forth among multiple tasks (multitasking) „ Concurrency is the appearance of simultaneous execution of multiple tasks Concurrent task for a Thermostat: /* Monitor Temperature*/ do forever { measure temp ; if (temp < setting) start furnace ; else if (temp > setting + delta) stop furnace ; }

S. Mohammadi

/* Monitor Time of Day */ do forever { measure time ; if (6:00am) setting = 26C ; else if (11:00pm) setting = 20C ; }

„

‰

„

„

Embedded Systems Applications „

„

„

„

„

„

Dishwashers, microwave ovens, VCRs, televisions, stereos, fire/security alarm systems, lawn sprinkler controls, thermostats, cameras, clock radios, answering machines

„

Data collection, oscilloscopes, signal generators, signal analyzers, power supplies HW/SW Codesign of Embedded Systems Tehran University

15

Imaging systems (e.g., XRAY, MRI, and ultrasound), patient monitors, and heart pacers FAX machines, copiers, telephones, and cash registers

Personal: ‰

Elevator controls, surveillance systems, robots

S. Mohammadi

14

Office automation: ‰

Instrumentation: ‰

HW/SW Codesign of Embedded Systems Tehran University

Medical: ‰

Industrial: ‰

S. Mohammadi

Printers, scanners, keyboards, displays, modems, hard disk drives, CD-ROM drives

Home: ‰

Satellites, network routers, switches, hubs

Embedded Systems Applications

Computer peripherals: ‰

Nintendo's "Game Boy“ …

Communications: ‰

13

Fuel injection control, passenger environmental controls, anti-lock braking, air bag controls, GPS mapping

Children toys: ‰

„

Navigation systems, automatic landing systems, flight attitude controls, engine controls, space exploration (e.g., the Mars Pathfinder)

Automotive: ‰

/* Monitor Keypad */ do forever { check keypad ; if (raise temp) setting++ ; else if (lower temp) setting-- ; }

HW/SW Codesign of Embedded Systems Tehran University

Aerospace spacecrafts:

Personal Digital Assistants (PDAs), pagers, cell phones, wristwatches, video games, portable MP3 players, GPS

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

16

Parts of an Embedded System

Parts „

EMBEDDED SYSTEM

USER

„

I/O

HARDWIRED UNIT • Application-specific logic • Timers • A/D and D/A conversion

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

ACTUATORS

PROCESSOR

SENSORS

MEMORY

„ „

„ „

„ „

17

‰

‰

„

‰

Microcontroller: includes I/O devices, on-board memory „ Digital signal processor (DSP): microprocessor optimized for digital signal processing. Typical embedded word sizes: 8-bit, 16-bit, and 32-bit. „

HW/SW Codesign of Embedded Systems Tehran University

HW/SW Codesign of Embedded Systems Tehran University

18

Today’s high-end automobile may have 100 microprocessors: ‰

Control fuel/air mixture, engine timing, etc. Multiple modes of operation: warm-up, cruise, hill climbing, etc. Provides lower emissions, better fuel efficiency

S. Mohammadi

S. Mohammadi

Automotive Embedded Systems

First microprocessor was Intel 4004 in early 1970’s HP-35 calculator used several chips to implement a microprocessor in 1972 Automobiles used microprocessor-based engine controllers starting in 1970’s ‰

Range of implementation options Single-chip implementation: system on a chip

ENVIRONMENT

Early History of Embedded Systems „

Actuators - mechanical components (e.g., valve) Sensors - input data (e.g., accelerometer for airbag control) Data conversion, storage, processing Decision-making

19

‰

„

4-bit microcontroller checks seat belt Microcontrollers run dashboard devices 16/32-bit microprocessor controls engine

BMW 850i brake and stability control system ‰

‰

‰

Anti-lock brake system (ABS): Pumps brakes to reduce skidding. Automatic Stability Control (ASC+T): Controls engine to improve stability ABS and ASC+T communicate. ABS was introduced first--ASC+T needed to interface to existing ABS module.

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

20

Anti-lock Brake System (ABS)

Embedded System Applications

Sensor

Sensor

Brake

Brake

Programmable Digital Thermostat ‰

ABS

Hydraulic pump

Brake

Brake

Sensor

Sensor

S. Mohammadi

4-bit microprocessor

HW/SW Codesign of Embedded Systems Tehran University

21

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

Embedded System Applications

Embedded System Applications

NASA’s Mars Rover

Palm Vx Handheld

‰

Intel 80C85 8-bit microprocessor

S. Mohammadi

‰

HW/SW Codesign of Embedded Systems Tehran University

23

22

32-bit CPU Motorola Dragonball EZ

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

24

Embedded System Applications

Embedded System Applications

DVD Player

IBM Research’s Linux Wrist Watch Prototype

‰

‰

32-bit RISC Microprocessor

Hardware „

„ „

„ „

„

„

‰

Software „ „ „

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

25

CPU: High speed, low power 32 bit MPU (18-74 MHz) Input devices: Touch panel, button Display: 320 x 240 dots, monochrome liquid crystal display Memory: 8MB low power DRAM, 16MB flash Interfaces: Bluetooth wireless technology (v1.1, voice-enabled), IrDA (V1.2), RS232C (via a cradle) Others: Speaker, microphone, vibrator, fingerprint sensor, accelerator sensor Cradle: RS232C, AC adapter, and AA batteries Operating system: Linux kernel version 2.4 GUI: Microwindows Bluetooth stack: IBM BlueDrekar (L2CAP, SDP, RFCOMM)

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

Embedded System Applications

Embedded System Applications

SONY Aibo Robot Dog

Vending Machine ‰

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

27

26

8-bit Motorola 68HC11 Microcontroller

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

28

Embedded Real-time System Features „

„

„

„

„

Characteristics of Embedded Systems

Large and complex — vary from a few hundred lines of assembler or C to 20 million lines of Ada Concurrent control of separate system components — devices operate in parallel in the real world; better to model this parallelism by concurrent entities in the program Facilities to interact with special purpose hardware — need to be able to program devices in a reliable and abstract way Extreme reliability and safe — embedded systems typically control the environment in which they operate; failure to control can result in loss of life, damage to environment or economic loss Guaranteed response times — we need to be able to predict with confidence the worst case response times for systems; efficiency is important but predictability is essential

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

29

Embedded Systems Non-Functional Requirements „ „

Performance Cost ‰ ‰

„ „

‰

‰ ‰

‰

„ „

„ „

Manufacturing cost Power

HW/SW Codesign of Embedded Systems Tehran University

„

31

HW/SW Codesign of Embedded Systems Tehran University

30

Why Use Microprocessors?

„

Alternative to custom logic, FPGAs Efficient way to implement digital systems Can built various feature sets for different products using same logic Simplify the design of products μp-based designs can be as fast because: ‰

‰ ‰ ‰

S. Mohammadi

Several real-time activities at the same time for example audio and video multimedia

S. Mohammadi

„

Critical in battery-powered systems Excessive power consumption increases system cost even in wall-powered devices Custom logic is the clear winner for low power devices Software techniques can help reduce power consumption

Complex algorithms: filtering functions in cars User Interface: moving maps in GPS

Real Time operations Multirate ‰

„

Manufacturing cost must often be low NRE (non-recurring engineering)

Sophisticated functionality ‰

„

Physical size and weight Power consumption ‰

„

μps execute programs very efficiently (RISC: one instruction per cycle) CPUs run at very high speed Heavily pipelined Aggressive VLSI technology

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

32

Challenges in Embedded System Design „

„

Run slower? Turn off unnecessary logic? Reduce memory access?

„

How do we consider upgradeability? ‰

„

‰

Faster HW or cleverer SW?

How do we minimize power? ‰

„

How big is the CPU, Memory, Peripheral devices?

How do we meet deadlines? ‰

„

Design Methodology: „ A procedure for designing a system

How much hardware do we need? ‰

„

Challenges in Embedded System Design

Add features by changing SW for next product generation

Reliability ‰

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

‰

33

Question: What are Design Goals? „

„ „ „ „

Help automate methodology steps Keep track of the methodology itself

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

34

StreetPilot GPS Receiver „16-bit

Performance ‰

Understanding your methodology helps you ensure you didn’t skip anything Compilers, software engineering tools, computer-aided design (CAD) tools, etc., can be used to: ‰

Finding bugs in safety-critical systems before selling it!

Requirements, Specification, Architecture, components, System Integration

microprocessor

Overall speed, deadlines.

Functionality and user interface Manufacturing cost Power consumption Other requirements (physical size, etc.)

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

35

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

36

Requirements Analysis of a GPS Moving Map

GPS Moving Map Needs

„Moving

„

Functionality:

„

User interface:

map obtains its position from the GPS (satellite-based navigation system) „Paints map from the local database

‰

‰

User’s current position

„

Cost:

„

Physical size/weight:

„

Power consumption:

‰

‰

HW/SW Codesign of Embedded Systems Tehran University

S. Mohammadi

37

Map should scroll smoothly. No more than 1 sec power-up. Lock onto GPS within 15 seconds

„

‰

Lat: 20 12 long:40 15

At least 400 x 600 pixel screen. Three buttons max. Pop-up menu.

Performance: ‰

Kurdistan

Hemat

For automotive use. Show major roads and landmarks.

$700 street price = approx. $150 cost of goods sold Should fit in hand Should run for 8 hours on four AA batteries

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

GPS Moving Map Requirements form

Specification

Name

GPS moving map

Purpose

Consumer-grade moving map for driving

Inputs

Power button, three control buttons

Outputs

Back-lit LCD 400 X 600

Functions

5-receiver GPS; three resolutions; displays current latitude/longitude

Performance

Updates screen within 0.25 sec of movement

A more precise description of the system: „ Should not imply a particular architecture; „ Provides input to the architecture design process „ May include functional and non-functional elements „ May be executable or may be in mathematical form for proofs „ It Should include:

Manufacturing cost

$100 cost-of-goods-sold

‰ ‰

Power

100 mW

Physical size/weight

No more than 2 X 6, 12 oz

‰ ‰ ‰

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

39

38

What is received from GPS; map data; user interface; operations required to satisfy user requests; background operations needed to keep the system running.

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

40

System Architecture Design

Moving Map Block Diagram

What major components needed to satisfy the specification? „ Hardware components: ‰ ‰

„

Software components: ‰

„

CPUs Memory, Peripherals, etc. Major programs and their operations

Must take into account functional and nonfunctional specifications

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

41

GPS HW Architecture

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

42

GPS SW Architecture

43

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

44

An embedded system example: a digital camera

Hardware Software Components „ „

„

Must spend time architecting the system before you start coding Some components are ready-made, some can be modified from existing designs, and others must be designed from scratch System Integration ‰

CCD preprocessor

JPEG codec

„

Memory controller

Have a plan for integrating components to uncover bugs quickly, test as much functionality as early as possible HW/SW Codesign of Embedded Systems Tehran University

45

‰ ‰

„

Display ctrl

S. Mohammadi

„

Many systems have complex embedded hardware and software

UART

LCD ctrl

HW/SW Codesign of Embedded Systems Tehran University

46

„

„ „ „ „ „

Design methodology help us manage the design process HW/SW Codesign of Embedded Systems Tehran University

HW/SW Codesign Overview Modeling and co-specification of Embedded Systems ‰

Design time Power Performance Deadlines

S. Mohammadi

ISA bus interface

What comes next?

Embedded systems pose many design challenges: ‰

Multiplier/Accum

Single-functioned -- always a digital camera Tightly-constrained -- Low cost, low power, small, fast Reactive and real-time -- only to a small extent

Embedded Systems are all around us

‰

Microcontroller

DMA controller

Summary ‰

D2A

lens

Many bugs appear only at this stage

S. Mohammadi

„

Pixel coprocessor

A2D

Put together the components „

‰

Digital camera chip CCD

„ „ 47

SystemC as a specification language

Partitioning and Scheduling Hardware Accelerator based Embedded Systems Embedded Computer Organization Code generation and retargetable Compilers Real-time operating systems System Level Power/Energy Optimization Etc.

S. Mohammadi

HW/SW Codesign of Embedded Systems Tehran University

48