• 沒有找到結果。

Scotch Road

N/A
N/A
Protected

Academic year: 2022

Share "Scotch Road"

Copied!
111
0
0

加載中.... (立即查看全文)

全文

(1)

Embedded System Design - NTHU EOS Lab 1 Module-1 Embedded Computing

Introduction

 Embedded System Introduction

 Embedded Systems Characteristics

 Embedded System Design Process

 Object-Oriented Design

 Unified Modeling Language (UML)

 Design Example: Model Train Controller

(2)

Embedded System Design - NTHU EOS Lab 2 Module-1 Embedded Computing

Embedded System Introduction Embedded Systems Characteristics Embedded Systems Characteristics

Embedded System Design Process Embedded System Design Process

Object

Object - - Oriented Design Oriented Design

Unified Modeling Language (UML) Unified Modeling Language (UML)

Design Example: Model Train Controller

Design Example: Model Train Controller

(3)

Embedded System Design - NTHU EOS Lab 3 Module-1 Embedded Computing

Definition

 Embedded system: any device that

includes a programmable computer but is not itself a general-purpose computer

 e.g., PDA, printer, cell phone

 e.g., TV, household appliances

 e.g., automobiles: engine, brakes, etc

 NOT-e.g., PC

(4)

Embedded System Design - NTHU EOS Lab 4 Module-1 Embedded Computing

Embedded System Example

CPU

mem input

output analog

analog

embedded

computer

(5)

Embedded System Design - NTHU EOS Lab 5 Module-1 Embedded Computing

2-layered System Architecture

THE Application

I/O Manager Graphics

Subsystems Network

Drivers

Device Drivers Scheduler

Graphics Drivers Operating

System Kernel

Hardware

(6)

Embedded System Design - NTHU EOS Lab 6 Module-1 Embedded Computing

3-layered System Architecture

Applications

I/O Manager Graphics

Subsystems Network

Drivers

Device Drivers Scheduler

Graphics Drivers Operating

System Kernel

Hardware

Applications

Processes

(7)

Embedded System Design - NTHU EOS Lab 7 Module-1 Embedded Computing

Early History (1/2)

 Late 1940’s: MIT Whirlwind computer was designed for real-time operations

 to control aircraft simulator

 First microprocessor: Intel 4004 in early 1970’s

 microprocessor: a single-chip CPU

 Key breakthrough: HP-35 (1972)

 due to the high cost of VLSI design, reuse the HW design by changing the SW

 1st handheld calculator to compute complex math functions

 HP-35 uses several chips to implement the CPU

(8)

Embedded System Design - NTHU EOS Lab 8 Module-1 Embedded Computing

Early History (2/2)

 Automobiles used microprocessor-based engine controllers starting in 1970’s.

 Control fuel/air mixture, engine timing, etc.

 2 pushes: oil crisis & environment protection

 low fuel consumption & low emission

 Multiple modes of operation: warm-up, cruise, hill climbing, etc.

 sophisticated control can only be done with

microprocessors

(9)

Embedded System Design - NTHU EOS Lab 9 Module-1 Embedded Computing

Microprocessor Varieties

 Microcontroller: includes I/O devices, on- board memory

 Players: Intel, ARM, Motorola, Hitachi

 Digital signal processor (DSP):

microprocessor optimized for digital signal processing

 Players: Analog Devices, Motorola, TI

 Typical embedded word sizes: 8-bit, 16-

bit, 32-bit

(10)

Embedded System Design - NTHU EOS Lab 10 Module-1 Embedded Computing

Application Examples

 Front panel of microwave oven

 Advanced thermostat systems

 time-temperature settings

 Canon EOS 3 has 3 microprocessors

 32-bit RISC CPU runs auto-focus and eye-control system

 Analog TV: channel selection, etc

 Digital TV: audio processing CPU

 easier to design & debug

 possibility of upgrades

(11)

Embedded System Design - NTHU EOS Lab 11 Module-1 Embedded Computing

Automotive Embedded Systems

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

 4-bit microcontroller checks seat belt

 microcontrollers run dashboard devices

 16/32-bit microprocessor controls engine

(12)

Embedded System Design - NTHU EOS Lab 12 Module-1 Embedded Computing

BMW 850i Brake & 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

(13)

Embedded System Design - NTHU EOS Lab 13 Module-1 Embedded Computing

BMW 850i

brake sensor

brake sensor

brake sensor

brake sensor ABS hydraulic

pump

(14)

Embedded System Design - NTHU EOS Lab 14 Module-1 Embedded Computing

Review Slides (1)

 Embedded system definition? examples?

 First microprocessor?

 HP-35 significance?

 Microprocessor usage in automobiles?

 Microcontroller? DSP?

(15)

Embedded System Design - NTHU EOS Lab 15 Module-1 Embedded Computing

Embedded System Introduction

Embedded Systems Characteristics Embedded Systems Characteristics

Embedded System Design Process Embedded System Design Process

Object

Object - - Oriented Design Oriented Design

Unified Modeling Language (UML) Unified Modeling Language (UML)

Design Example: Model Train Controller

Design Example: Model Train Controller

(16)

Embedded System Design - NTHU EOS Lab 16 Module-1 Embedded Computing

Embedded Systems Characteristics (1/2)

 Complex algorithms

 e.g., automobile engine control system

 Sophisticated user interface

 e.g., GPS navigation system

 Real-time operation

 hard-real-time

 e.g. life-critical system

 soft-real-time

 e.g. GPS navigation system

(17)

Embedded System Design - NTHU EOS Lab 17 Module-1 Embedded Computing

Embedded Systems Characteristics (2/2)

 Multirate functionality

 e.g., multimedia applications (video & audio)

 Low manufacturing cost

 Low power

 excessive power consumption increases system cost

 Designed to tight deadlines by small teams

 6-month market window is common

 e.g. cannot miss back-to-school window for

calculators

(18)

Embedded System Design - NTHU EOS Lab 18 Module-1 Embedded Computing

Why use microprocessors?

 Alternatives: field-programmable gate arrays (FPGAs), custom logic, etc.

 Microprocessors are often very efficient:

can use same logic to perform many different functions

 Microprocessors simplify the design of

families of products

(19)

Embedded System Design - NTHU EOS Lab 19 Module-1 Embedded Computing

The Performance Paradox

 Microprocessors use much more logic to

implement a function than does custom logic

 instruction cycle: fetch, decode, execute, write

 however, for a set of family functions, microprocessors may use less logic

 But microprocessors are often at least as fast:

 heavily pipelined

 large design teams

 aggressive VLSI technology

 Microprocessors dominate new fabrication lines



custom logics have to wait and use old VLSI technology

(20)

Embedded System Design - NTHU EOS Lab 20 Module-1 Embedded Computing

Power

 Custom logic is a clear winner for low power devices

 Modern microprocessors offer features to help control power consumption

 Software design techniques can help

reduce power consumption

(21)

Embedded System Design - NTHU EOS Lab 21 Module-1 Embedded Computing

Embedded System Design Challenges (1/2)

 How much hardware do we need?

 How big is the CPU? Memory?

 more hardware  capabilities  more money

 How do we meet our deadlines?

 Faster hardware or cleverer software?

 How do we minimize power?

 Turn off unnecessary logic? Reduce memory

accesses? run at slower clock rate?

(22)

Embedded System Design - NTHU EOS Lab 22 Module-1 Embedded Computing

Embedded System Design Challenges (2/2)

 Does it really work?

 Is the specification correct?

 Does the implementation meet the spec?

 How do we test for real-time characteristics?

 How do we test on real data?

 How do we work on the system?

 Observability, controllability?

 What is our development platform?

(23)

Embedded System Design - NTHU EOS Lab 23 Module-1 Embedded Computing

Review Slides (2-1)

 Embedded systems characteristics?

 complex algorithms, complicated UI, real-time ops, multi-rate functions, low powers, tight deadline &

budget

 FPGA, ASIC, Microprocessor

 manufacturing cost, power, efficiency, size, development cost

 Microprocessor efficiency factors

 pipelined, large design teams, latest VLSI

 Embedded system design challenges?

 HW usage, efficiency, power, testing, platform

(24)

Embedded System Design - NTHU EOS Lab 24 Module-1 Embedded Computing

Review Slides (2-2)

Exec Speed Power Req VLSI Tech Design Team Gate #

Functions Flexibility Manu Cost

Microproc ASIC

FPGA

(25)

Embedded System Design - NTHU EOS Lab 25 Module-1 Embedded Computing

Review Slides (2-2)

Fast*

Fast Medium

Exec Speed

Medium*

Low Medium

Power Req

High-end Low-end

Medium

VLSI Tech

Large Medium

Small

Design Team

High Low

Medium

Gate #

More Less

Medium

Functions

High Low

Medium

Flexibility

Expensive Cheap

Medium

Manu Cost

Microproc ASIC

FPGA

(26)

Embedded System Design - NTHU EOS Lab 26 Module-1 Embedded Computing

Embedded System Introduction

Embedded Systems Characteristics Embedded System Design Process Embedded System Design Process

Object

Object - - Oriented Design Oriented Design

Unified Modeling Language (UML) Unified Modeling Language (UML)

Design Example: Model Train Controller

Design Example: Model Train Controller

(27)

Embedded System Design - NTHU EOS Lab 27 Module-1 Embedded Computing

Growth Rate of Embedded Software

1 2

0 10 12 18

months

factor

*) Department of Trade and Industry, London

(1. 4/ ye ar ) [M oo re ’s law ]

>10 times more programmers will write embedded applications than computer software by 2010

Em

be dd ed

so ft wa re

[D TI *]

(~ 2. 5/ yr )

already to-day, more than 98% of all microprocessors are used within

embedded systems

© 2004, reiner@hartenstein.de http://hartenstein.de

(28)

Embedded System Design - NTHU EOS Lab 28 Module-1 Embedded Computing

Submarine Programming Model

Hardware invisible:

under the surface

Hardware Algorithm

Assembly Language procedural high level Programming Language Soft ware

This model does not suport Hardware / Configware / Software partitioning

© 2004, reiner@hartenstein.de http://hartenstein.de

(29)

Embedded System Design - NTHU EOS Lab 29 Module-1 Embedded Computing

Dominance of the Submarine Model ...

Hardware

... indicates, that our CS education system produces zillions of mentally disabled CS graduates (procedural) structurally

disabled

… disabled to cope with solutions other than instruction-stream-based

© 2004, reiner@hartenstein.de http://hartenstein.de

(30)

Embedded System Design - NTHU EOS Lab 30 Module-1 Embedded Computing

Built From Bottom-Up

procedural

have not

You cannot *teach Hardware to a

Programmer

*) efficiently

But to a Hardware Guy you always can teach

Programming

structural

have natural

© 2004, reiner@hartenstein.de http://hartenstein.de

(31)

Embedded System Design - NTHU EOS Lab 31 Module-1 Embedded Computing

Design Methodologies

 A procedure for designing a system

 Understanding your methodology ensures you didn’t skip anything

 Compilers, software engineering tools, computer-aided design (CAD) tools, etc., can be used to:

 help automate methodology steps

 keep track of the methodology itself

(32)

Embedded System Design - NTHU EOS Lab 32 Module-1 Embedded Computing

Design Goals

 Performance.

 Overall speed, deadlines

 Functionality and user interface

 Manufacturing cost

 Power consumption

 Other requirements (physical size, etc.)

(33)

Embedded System Design - NTHU EOS Lab 33 Module-1 Embedded Computing

Design Process Abstraction

requirements specification

architecture component

design system integration

top-down design

bottom-up

design

(34)

Embedded System Design - NTHU EOS Lab 34 Module-1 Embedded Computing

Top-down vs. Bottom-up

 Top-down design:

 start from most abstract description

 work to most detailed

 Bottom-up design:

 work from small components to big system

 Real design uses both techniques

(35)

Embedded System Design - NTHU EOS Lab 35 Module-1 Embedded Computing

Step-1: Requirements

 Plain language description of what the user wants and expects to get

 May be developed in several ways:

 talking directly to customers

 talking to marketing representatives

 providing prototypes to users for comment

(36)

Embedded System Design - NTHU EOS Lab 36 Module-1 Embedded Computing

Sample Requirement Form

name project name

purpose one or 2 sentences inputs type of data? periodic

or non-periodic?

outputs I/O devices?

functions inputs  outputs performance real-time req?

manufacturing cost rough estimation

power battery or wall-

powered

physical size/weight e.g., PC or NB?

(37)

Embedded System Design - NTHU EOS Lab 37 Module-1 Embedded Computing

Example: GPS moving map requirements

 Moving map

obtains position from GPS, paints map from local database.

lat: 40 13 lon: 32 19

I-78

S co tc h R o ad

(38)

Embedded System Design - NTHU EOS Lab 38 Module-1 Embedded Computing

Step-1 of GPS moving map (1/3)

 Functionality: Show major roads and landmarks for automotive use

 User interface: At least 400 x 600 pixel

screen. Three buttons max. Pop-up menu.

 Performance: Map should scroll smoothly.

No more than 1 sec power-up. Lock onto GPS within 15 seconds.

 Cost: $500 street price = approx. $100

manufacturing cost.

(39)

Embedded System Design - NTHU EOS Lab 39 Module-1 Embedded Computing

Step-1 of GPS moving map (2/3)

 Physical size/weight: Should fit in hand

 Power consumption: Should run for 8

hours on four AA batteries

(40)

Embedded System Design - NTHU EOS Lab 40 Module-1 Embedded Computing

Step-1 of GPS moving map (3/3)

name MGPS: GPS moving map

purpose consumer-grade moving map for driving

inputs power button, two control buttons

outputs back-lit LCD 400 X 600 functions 5-receiver GPS; three

resolutions; displays current lat/lon

performance updates screen within 0.25 sec of movement

manufacturing cost $100 cost-of-goods-sold

power 100 mW

physical size/weight no more than 2” X 6”, 12 oz.

(41)

Embedded System Design - NTHU EOS Lab 41 Module-1 Embedded Computing

Step-2: Specifications

 A more precise description of the system:

 should NOT imply a particular architecture

 provides input to the architecture design process

 Serve as a contract between customers and architects

 May include functional and non-functional elements.

 May be executable or may be in mathematical

form for proofs

(42)

Embedded System Design - NTHU EOS Lab 42 Module-1 Embedded Computing

Step-2 of GPS moving map

 Should include:

 What is received from GPS

 map data

 user interface

 operations required to satisfy user requests

 background operations needed to keep the

system running

(43)

Embedded System Design - NTHU EOS Lab 43 Module-1 Embedded Computing

Step-3: Architecture Design

 Describe how the system implements the required functions

 Specifications: what the system does

 Architecture: how the system does things

 Hardware components:

 CPUs, peripherals, etc.

 Software components:

 major programs and their operations.

 Must take into account functional and non-

functional (cost, speed, etc) specifications

(44)

Embedded System Design - NTHU EOS Lab 44 Module-1 Embedded Computing

Step-3: GPS moving map block diagram (1/3)

GPS receiver

search

engine renderer

user interface database

display

(45)

Embedded System Design - NTHU EOS Lab 45 Module-1 Embedded Computing

Step-3: GPS moving map Hardware Architecture (2/3)

GPS receiver CPU

panel I/O display frame

buffer

memory

(46)

Embedded System Design - NTHU EOS Lab 46 Module-1 Embedded Computing

Step-3: GPS moving map Software Architecture (3/3)

position

database

search renderer

timer user

interface

pixels

(47)

Embedded System Design - NTHU EOS Lab 47 Module-1 Embedded Computing

Step-3: Architecture Design (cont)

 Functional block diagram first  SW/HW architecture

 SW  HW module mapping

 Make sure both functional and non-functional requirements are satisfied

 Otherwise, redo Step-3 again

 How to make sure non-functional requirements are satisfied?

 Experience

 Modeling

 Simulation

(48)

Embedded System Design - NTHU EOS Lab 48 Module-1 Embedded Computing

Step-4: Designing Hardware and Software Components

 Must spend time architecting the system before you start coding

 Some components are ready-made (e.g.,

CPU, topographic databases), some can

be modified from existing designs, others

must be designed from scratch

(49)

Embedded System Design - NTHU EOS Lab 49 Module-1 Embedded Computing

Step-5: System Integration

 Put together the components

 Many bugs appear only at this stage 

 Have a plan for integrating components

to uncover bugs quickly, test as much

functionality as early as possible

(50)

Embedded System Design - NTHU EOS Lab 50 Module-1 Embedded Computing

Summary

 Embedded computers are all around us

 Many systems have complex embedded hardware and software

 Embedded systems pose many design challenges: design time, deadlines, power, etc.

 Design methodologies help us manage the

design process

(51)

Embedded System Design - NTHU EOS Lab 51 Module-1 Embedded Computing

Review Slides (3)

 Common design goals?

 Performance, functionality, user interface, cost, power, size, weight

 5-step design process?

 Requirements? Requirement form?

 Specification?

 Architecture design?

 Component design?

 System integration?

(52)

Embedded System Design - NTHU EOS Lab 52 Module-1 Embedded Computing

Embedded System Introduction

Embedded Systems Characteristics Embedded System Design Process

Object

Object - - Oriented Design Oriented Design

Unified Modeling Language (UML) Unified Modeling Language (UML)

Design Example: Model Train Controller

Design Example: Model Train Controller

(53)

Embedded System Design - NTHU EOS Lab 53 Module-1 Embedded Computing

System Modeling

 Need languages to describe systems:

 useful across several levels of abstraction;

 understandable within and between organizations

 Block diagrams are a start, but don’t

cover everything

(54)

Embedded System Design - NTHU EOS Lab 54 Module-1 Embedded Computing

Object-Oriented Design

 Object-oriented (OO) design: A generalization of object-oriented programming

 OO design is different from OO programming

 Object = state + methods

 State provides each object with its own identity

 Methods provide an abstract interface to the

object

(55)

Embedded System Design - NTHU EOS Lab 55 Module-1 Embedded Computing

OO implementation in C++

class display {

pixels : pixeltype[IMAX,JMAX];

public:

display() { } // constructor

pixeltype pixel(int i, int j) { return pixels[i,j]; } void set_pixel(pixeltype val, int i, int j)

{ pixels[i,j] = val; }

}

(56)

Embedded System Design - NTHU EOS Lab 56 Module-1 Embedded Computing

Objects and Classes

 Class: object type

 Class defines the object’s state elements

 Class defines the methods used to interact with all objects of that type

 Each object has its own state (memory)

(57)

Embedded System Design - NTHU EOS Lab 57 Module-1 Embedded Computing

OO Design Principles

 Some objects will closely correspond to real-world objects

 Some objects may be useful only for description or implementation

 Not every object is executable

 Objects provide interfaces to read/write

state, hiding the object’s implementation

from the rest of the system

(58)

Embedded System Design - NTHU EOS Lab 58 Module-1 Embedded Computing

Embedded System Introduction

Embedded Systems Characteristics Embedded System Design Process Object-Oriented Design

Unified Modeling Language (UML) Unified Modeling Language (UML)

Design Example: Model Train Controller

Design Example: Model Train Controller

(59)

Embedded System Design - NTHU EOS Lab 59 Module-1 Embedded Computing

UML

 Developed by Booch et al.

 Goals:

 object-oriented

 visual

 useful at many levels of abstraction

 usable for all aspects of design

(60)

Embedded System Design - NTHU EOS Lab 60 Module-1 Embedded Computing

UML object

d1: Display

pixels: array[] of pixels elements

menu_items pixels is a

2-D array

comment

object name

class name

attributes

(61)

Embedded System Design - NTHU EOS Lab 61 Module-1 Embedded Computing

UML class

Display pixels elements menu_items

mouse_click()

draw_box() operations

class name

(62)

Embedded System Design - NTHU EOS Lab 62 Module-1 Embedded Computing

The class interface

 The operations provide the abstract interface between the class’s

implementation and other classes

 Operations may have arguments, return values

 An operation can examine and/or modify

the object’s state

(63)

Embedded System Design - NTHU EOS Lab 63 Module-1 Embedded Computing

Class Derivation

 May want to define one class in terms of another

 Derived class inherits attributes, operations of base class

Derived_class

Base_class

UML

generalization

(64)

Embedded System Design - NTHU EOS Lab 64 Module-1 Embedded Computing

Class Derivation Example

Display pixels elements menu_items pixel()

set_pixel()

mouse_click() draw_box

BW_display Color_map_display

base class

derived class

(65)

Embedded System Design - NTHU EOS Lab 65 Module-1 Embedded Computing

Multiple Inheritance

Speaker Display

Multimedia_display base classes

derived class

(66)

Embedded System Design - NTHU EOS Lab 66 Module-1 Embedded Computing

Links and Associations

 Link: describes relationships between objects

 Association: describes relationship

between classes

(67)

Embedded System Design - NTHU EOS Lab 67 Module-1 Embedded Computing

Association Example

message

msg: ADPCM_stream length : integer

message set count : integer

0..* 1

contains

# contained messages # containing message sets

0 or more messages

(68)

Embedded System Design - NTHU EOS Lab 68 Module-1 Embedded Computing

Link Example

 Link defines the contains relationship:

m1:message msg = msg1 length = 1102 m2:message msg = msg2 length = 2114

ms1:message set

count = 2

(69)

Embedded System Design - NTHU EOS Lab 69 Module-1 Embedded Computing

State Machines

a b

state state name

transition

(70)

Embedded System Design - NTHU EOS Lab 70 Module-1 Embedded Computing

Event-Driven State Machines

 Behavioral descriptions are written as event-driven state machines

 Machine changes state when receiving an input

 An event may come from inside or

outside of the system

(71)

Embedded System Design - NTHU EOS Lab 71 Module-1 Embedded Computing

Event Type

 Signal: asynchronous event

 Call: synchronized communication

 Timer: activated by time

(72)

Embedded System Design - NTHU EOS Lab 72 Module-1 Embedded Computing

Signal Event

<<signal>>

mouse_click

leftorright: button x, y: position

declaration

a

b mouse_click(x,y,button)

event description

(73)

Embedded System Design - NTHU EOS Lab 73 Module-1 Embedded Computing

Call Event (Procedural Call)

c d

draw_box(10,5,3,2,blue)

(74)

Embedded System Design - NTHU EOS Lab 74 Module-1 Embedded Computing

Timer Event

e f

tm(time-value)

• State change after a certain amount of time

• time-value = amount of time to expire

(75)

Embedded System Design - NTHU EOS Lab 75 Module-1 Embedded Computing

Example State Diagram

region found

got menu item

called menu item

found object

object highlighted start

finish

mouse_click(x,y,button)/

find_region(region)

input/output

region = menu/

which_menu(i) call_menu(i)

region = drawing/

find_object(objid) highlight(objid)

(76)

Embedded System Design - NTHU EOS Lab 76 Module-1 Embedded Computing

Sequence Diagram

 Shows sequence of operations over time

 Relates behaviors of multiple objects

(77)

Embedded System Design - NTHU EOS Lab 77 Module-1 Embedded Computing

Sequence Diagram Example

m: Mouse d1: Display u: Menu

mouse_click(x,y,button)

which_menu(x,y,i)

call_menu(i)

time

lifeline

(78)

Embedded System Design - NTHU EOS Lab 78 Module-1 Embedded Computing

Summary

 Object-oriented design helps us organize a design

 UML is a transportable system design language

 Provides structural and behavioral

description primitives

(79)

Embedded System Design - NTHU EOS Lab 79 Module-1 Embedded Computing

Embedded System Introduction

Embedded Systems Characteristics Embedded System Design Process Object-Oriented Design

Unified Modeling Language (UML)

Design Example: Model Train Controller

Design Example: Model Train Controller

(80)

Embedded System Design - NTHU EOS Lab 80 Module-1 Embedded Computing

Model train setup

console

power supply

rcvr motor

ECC address

header command

(81)

Embedded System Design - NTHU EOS Lab 81 Module-1 Embedded Computing

Step-1: Requirements (1/2)

 Console can control 8 trains on 1 track

 Throttle has at least 63 levels

 Inertia control adjusts responsiveness with at least 8 levels (加速度)

 Emergency stop button

 Error detection scheme on messages

(82)

Embedded System Design - NTHU EOS Lab 82 Module-1 Embedded Computing

Step-1: Requirements Form (2/2)

name model train controller

purpose control speed of <= 8 model trains inputs throttle, inertia, emergency stop,

train #

outputs train control signals

functions set engine speed w. inertia;

emergency stop

performance can update train speed at least 10 times/sec

manufacturing cost $50

power wall powered

physical size/weight

console comfortable for 2 hands; < 2

lbs.

(83)

Embedded System Design - NTHU EOS Lab 83 Module-1 Embedded Computing

Step-2: Conceptual Specification

 Before we create a detailed specification, we will make an initial, simplified

specification

 Gives us practice in specification and UML.

 Good idea in general to identify potential

problems before investing too much effort in

detail

(84)

Embedded System Design - NTHU EOS Lab 84 Module-1 Embedded Computing

Basic System Commands

command name parameters

set-speed speed

(positive/negative) set-inertia inertia-value (non-

negative)

estop none

(85)

Embedded System Design - NTHU EOS Lab 85 Module-1 Embedded Computing

UML Sequence Diagram

:console :train_rcvr

set-inertia set-speed

set-speed

set-speed

estop

(86)

Embedded System Design - NTHU EOS Lab 86 Module-1 Embedded Computing

Class Diagram

command

set-inertia

value: unsigned- integer set-speed

value: integer

estop

(87)

Embedded System Design - NTHU EOS Lab 87 Module-1 Embedded Computing

Subsystem Collaboration Diagram

Shows relationship between console and receiver (ignores role of track):

 One console can control up to 8 receivers

:console :receiver

1..n: command

(88)

Embedded System Design - NTHU EOS Lab 88 Module-1 Embedded Computing

System Structure Modeling

 Some classes define non-computer components

 Denote by *name

 Choose important systems at this point to

show basic relationships

(89)

Embedded System Design - NTHU EOS Lab 89 Module-1 Embedded Computing

Major Subsystem Roles

 Console:

 read state of front panel

 format messages

 transmit messages

 Train:

 receive message

 interpret message

 control the train

(90)

Embedded System Design - NTHU EOS Lab 90 Module-1 Embedded Computing

Console System Class Diagram

console

panel formatter transmitter

Knobs* sender*

1 1

1 1 1

1

1 1 1

1

(91)

Embedded System Design - NTHU EOS Lab 91 Module-1 Embedded Computing

Console class roles

 panel: describes analog knobs and interface hardware

 formatter: turns knob settings into bit streams

 transmitter: sends data on track

(92)

Embedded System Design - NTHU EOS Lab 92 Module-1 Embedded Computing

Train System Class Diagram

train set

train receiver

controller

motor interface

detector* pulser*

1 1..t

1

1

1 1 1 1

1 1

1 1

(93)

Embedded System Design - NTHU EOS Lab 93 Module-1 Embedded Computing

Train class roles

 receiver: digitizes signal from track

 controller: interprets received commands and makes control decisions

 motor interface: generates signals

required by motor

(94)

Embedded System Design - NTHU EOS Lab 94 Module-1 Embedded Computing

Detailed Specification

 We can now fill in the details of the conceptual specification:

 more classes

 behaviors

 Sketching out the spec first helps us

understand the basic relationships in the

system

(95)

Embedded System Design - NTHU EOS Lab 95 Module-1 Embedded Computing

Console Physical Object Classes

knobs*

train-knob: integer speed-knob: integer

inertia-knob: unsigned- integer emergency-stop: boolean

pulser*

pulse-width: unsigned- integer direction: boolean

sender*

send-bit()

detector*

read-bit() : integer

(96)

Embedded System Design - NTHU EOS Lab 96 Module-1 Embedded Computing

Panel and Motor Interface Classes

panel

train-number() : integer speed() : integer

inertia() : integer estop() : boolean new-settings()

motor-interface

speed: integer

(97)

Embedded System Design - NTHU EOS Lab 97 Module-1 Embedded Computing

Class Descriptions

 panel class defines the controls

 new-settings() behavior reads the controls

 motor-interface class defines the motor

speed held as state

(98)

Embedded System Design - NTHU EOS Lab 98 Module-1 Embedded Computing

Transmitter and Receiver Classes

transmitter

send-speed(adrs: integer, speed: integer)

send-inertia(adrs: integer, val: integer)

set-estop(adrs: integer)

receiver

current: command new: boolean

read-cmd()

new-cmd() : boolean rcv-type(msg-type:

command)

rcv-speed(val: integer)

rcv-inertia(val:integer)

(99)

Embedded System Design - NTHU EOS Lab 99 Module-1 Embedded Computing

Class Descriptions

 transmitter class has one behavior for each type of message sent

 receiver function provides methods to:

 detect a new message

 determine its type

 read its parameters (estop has no parameters)

(100)

Embedded System Design - NTHU EOS Lab 100 Module-1 Embedded Computing

Formatter Class

formatter

current-train: integer

current-speed[ntrains]: integer current-inertia[ntrains]:

unsigned-integer

current-estop[ntrains]: boolean send-command()

panel-active() : boolean

update-panel()

(101)

Embedded System Design - NTHU EOS Lab 101 Module-1 Embedded Computing

Formatter Class Description

 Formatter class holds state for each train, setting for current train

 The operate() operation performs the

basic formatting task

(102)

Embedded System Design - NTHU EOS Lab 102 Module-1 Embedded Computing

Control Input Cases

 Use a soft panel to show current panel settings for each train

 Changing train number:

 must change soft panel settings to reflect current train’s speed, etc.

 Controlling throttle/inertia/estop:

 read panel, check for changes, perform

command

(103)

Embedded System Design - NTHU EOS Lab 103 Module-1 Embedded Computing

Control Input Sequence Diagram

:knobs :panel :formatter :transmitter

ch an g e in s p ee d / in er ti a/ es to p ch an g e in tr ai n n u m b er

change in control settings

read panel panel settings

panel-active send-command

send-speed, send-inertia.

send-estop read panel

panel settings read panel panel settings

change in train number

set-knobs

new-settings

(104)

Embedded System Design - NTHU EOS Lab 104 Module-1 Embedded Computing

Formatter Operate Behavior

idle

update-panel()

send-command() panel-active() new train number

other

(105)

Embedded System Design - NTHU EOS Lab 105 Module-1 Embedded Computing

Panel-active behavior

panel*:read-train()

current-train = train-knob update-screen

changed = true T

panel*:read-speed() current-speed = throttle changed = true

T F

...

F

...

(106)

Embedded System Design - NTHU EOS Lab 106 Module-1 Embedded Computing

Controller Class

controller

current-speed: integer

current-inertia: unsigned-integer

set-speed(integer)

set-inertia(integer)

new-speed(integer)

(107)

Embedded System Design - NTHU EOS Lab 107 Module-1 Embedded Computing

Setting the Speed

 Don’t want to change speed instantaneously

 Controller should change speed gradually

by sending several commands

(108)

Embedded System Design - NTHU EOS Lab 108 Module-1 Embedded Computing

Set-Speed Sequence Diagram

:receiver :controller :motor-interface :pulser*

new-cmd cmd-type

rcv-speed new-speed set-pulse

set-pulse

set-pulse

set-pulse

set-pulse

(109)

Embedded System Design - NTHU EOS Lab 109 Module-1 Embedded Computing

Refined Command Classes

command type: 3-bits address: 3-bits parity: 1-bit

set-inertia type=001 value: 3-bits set-speed

type=010 value: 7-bits

estop

type=000

(110)

Embedded System Design - NTHU EOS Lab 110 Module-1 Embedded Computing

Summary

 Separate specification and programming

 Small mistakes are easier to fix in the spec

 Big mistakes in programming cost a lot of time

 You can’t completely separate specification and architecture

 Make a few tasteful assumptions

(111)

Embedded System Design - NTHU EOS Lab 111 Module-1 Embedded Computing

Useful Links

 http://www.uml.org/

 Official UML resource page

 You will find many good links here

 http://www.raba.com/~jcstaff/oodev/presents /uml/intro_uml/

 A pretty good introduction to UML

 http://www.softdocwiz.com/UML.htm

 UML Dictionary

 http://uml.tutorials.trireme.com/

 A relatively complete UML tutorial

參考文獻

相關文件

Tei-Wei Kuo, Embedded System and Wireless Networking Lab, National Taiwan University.. Real-Time

Writing of a 16MB incurs 1K block erases because of the reclaiming of invalid space.. 2008/1/30 Embedded Systems and Wireless Networking Lab. 80. Wear Leveling versus

include domain knowledge by specific kernel design (e.g. train a generative model for feature extraction, and use the extracted feature in SVM to get discriminative power).

On the other hand, Japanese Buddhist scholars tend to point out the basic contradiction or inconsistency embedded in the śīla/vinaya system of Sinitic Mahāyāna tradition--that

Department of Electrical Engineering, National Cheng Kung University In this thesis, an embedded system based on SPCE061A for interactive spoken dialogue learning system (ISDLS)

(ii) Maximum power point tracking (MPPT) controller design of the PV module.. (iii) MPPT controller design of the WTG without sensing the

//Structural description of design example //See block diagram

• Facilitating Field Studies in Hong Kong.. • PBL – A New Mode of