1 system design process basic problem in embedded systems combine hardware / software techniques...

44
1 System Design Process • Basic problem in embedded systems • Combine hardware / software techniques • Allow flexibility in boundary • Basic steps: --gather requirements, analyze --write specifications --design --implement --test --maintain Basic System Process (Digital) ADC DAC Digital input Analog output Analog input Digital output

Post on 20-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

1

System Design Process

• Basic problem in embedded systems

• Combine hardware / software techniques

• Allow flexibility in boundary

• Basic steps: --gather requirements, analyze--write specifications--design--implement--test--maintain

Basic System

Process (Digital)ADC DAC

Digital input

Analog outputAnalog input

Digital output

Page 2: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

2

LEVELS & VIEWS:

Behavioral / Functional View

Structural View Physical View

Performance Specs.

Processors, Memory, Switches, Buses Physical Partitions

Hardware Modules Clusters

Algorithms

Register Transfers

Registers, ALU's, MUX's Floor Plans

Gates, Flip-flops, Cells Modules, Cells

Boolean Logic, FSM's

Transfer Functions, Timing

Transistors, Contacts, Wires, Vias Layout Geometry

HIGH LEVEL

Hardware Design Space

Issues:--timing--synch/asynch--parallelism--digital/analog--space--power

Page 3: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

3

TRANSISTOR(PHYSICAL)

LIBRARY COMPONENT (PHYS. / BEHAV./ STRUCT.)

NETLIST (STRUCTURAL)

n1: a b o1

n2: a c o2

n3: o1 o2 o3

--VHDL ARCHITECTURE (STRUCTURAL)

architecture A of HALFADDER is component XOR port (X1,X2: in bit; O: out bit); end component; component AND port (X1,X2: in bit; O: out bit); end component;

begin G1: XOR port map (A,B,S); G2: AND port map (A,B,COUT); end A;

Example (half adder, based on Figure 4, Chapter 13, Handbook of Mechatronics and additions)

--VHDL entityentity HALFADDER is port (A,B: in bit; S,COUT: out bit);end ADDER;

--VHDL ARCHITECTURE (BEHAVIORAL)

architecture CONCURRENT of HALF ADDER is--this is a behavioral description ("delay" = 5 ns here)--it does NOT imply that XOR or AND gates will be used in the implementation

beginS <= (A xor B) after 5 ns;COUT <= (A and B) after 5 ns;end CONCURRENT;

--VHDL ARCHITECTURE (BEHAVIORAL/DATAFLOW):

architecture PROCESS_BEHAVIOR of HALF ADDER isbeginSUM_PROC: process(A,B)

begin if (A = B) then

S <= '0' after 5 ns; else

S<= (A or B) after 5 ns; end if; end process SUM_PROC;

CAR_PROC: process (A,B)begin case A is when '0' => COUT <= A after 5 ns; when '1' => COUT <= B after 5 ns; when others => COUT <= 'X' after 5 ns; end case;end process CAR_PROC;

end PROCESS_BEHAVIOR;

Analog component:

Page 4: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

4

Software Process Model

Software Process Model: --A development strategy that encompasses the process, methods, and tools

--Specific model is chosen based upon the project/application, the methods/tools to be used, resources available, and the deliverables required

basic model:problemdevelopintegrate

each step is carried out recursively until an appropriate level of detail is achieved

Page 5: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

5

Process Model Types

Software Process Model Types:

“Prescriptive”Model includes a specific set of tasks, along with a

workflow for these tasks and definite milestones and outcomes for each task; end result is the desired product

"Agile"Model tends to be simpler than prescriptive models;

emphasis is on incremental development, customer satisfaction, and minimal process overhead

"Mathematical"Formal Method Model stresses mathematical rigor and

formal proofs that product is meeting carefully-defined goals

Page 6: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

6

Waterfall Model

Analysis Design Code Test Maintain

Linear Sequential Model (“waterfall model”): Sequential approach from system level through analysis, design, coding, testing, support--oldest and most widely used paradigm

Advantages:--better than nothing--can be appropriate for for small, well-understood projects

Disadvantages:--Real projects rarely follow a sequential flow--Requirements usually not fully known.--Working version not available until late in project.

Page 7: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

7

Some Common Prescriptive Models

Some common prescriptive models used in practice:"Basic":Linear Sequential ModelPrototyping ModelRAD Model "Evolutionary" (product evolves over time):Incremental ModelSpiral ModelConcurrent Development ModelComponent-Based Development

Page 8: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

8

Prototyping Model

Prototyping Model: customer defines set of general objectives; no details on input, processing, output requirements; may be unsure of algorithm efficiency, adaptability, OS, human/machine issues

Advantages:--Focuses on what is visible to customer --Quick design leads to a prototype --Prototype evaluated by the customer who can refine requirements--Ideal mechanism for identifying and refining SW requirements

Disadvantages:--Customer sees something that appears to work and wants it.--Less than ideal choices move from prototype to product SW

Prototyping: A-->D-->C-->T-->M

(A=analysis, D=design, C=coding, T=testing, M=maintenance)

Page 9: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

9

Rapid Application Development Model

RAD: A-->D1 D2-->C-->T Integrate-->T-->M D2-->C-->T Reuse-->C-->T

(A=analysis, D=design, C=coding, T=testing, M=maintenance)

RAD Model: Rapid Application Development: incremental model, emphasizes short development cycle.component based: requirements fully understood and scope constrained: good for information systems applications.

Advantages: Assumes "4th Gen" techniques: reuse existing programs or create reusable components. Only new components need to be tested.

Disadvantages: Enough human resources to create the right number of RAD teams; system must be modularizable; high risk, i.e., new technologies.

Page 10: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

10

Evolutionary Models

Evolutionary Models--useful for: Business and product requirements which change during development. Tight market deadlines. Cases where core requirements are understood but details of extensions are not known.

Page 11: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

11

Incremental Model

Incremental: A-->D-->C-->T-->M-->A-->D-->C-->T--> ……-->M

(A=analysis, D=design, C=coding, T=testing, M=maintenance)

Incremental Model: Elements of linear sequential (applied repetitively) with prototyping. As result of use, a plan is developed for next increment.

Advantages:Unlike prototyping, an operational product is delivered at each increment.

Disadvantages:Variable staffing at each increment (task dependent). Risk analysis must be done at each increment.

Page 12: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

12

Spiral Model

Spiral: T<--C<--D<--A T--- >M A-->D C

A-->D(A=analysis, D=design, C=coding, T=testing, M=maintenance)

Spiral Model: couples iterative nature of protoyping with the controlled and systematic aspect of the linear model. Potential for rapid development of incremental versions of SW. 1 spiral might be a paper model next a prototype then beta….etc.

Advantages:Realistic approach to large-scale systems.Developer/customer understand risk at each stage.

Disadvantages: Requires risk assessment expertise; relies on it for success.

Page 13: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

13

Concurrent Development Model

Concurrent: A-->A1-->D-->C-->T-->Integrate-->T-->M A1-->D-->C-->T

A1-->D-->C-->T (A=analysis, D=design, C=coding, T=testing, M=maintenance)

Concurrent Development Model: represented schematically as a series of major technical activities, tasks and their associated states.often used in client/server applications butapplicable to all SW development :

Advantages: provides an accurate picture of project state.

Disadvantages: must be able to decompose project appropriately

Page 14: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

14

Component Based Development

Component based: A-->D-->Library-->Integrate-->T-->M

C(A=analysis, D=design, C=coding, T=testing, M=maintenance)

Component Based Development: emphasizes the creation of classes that encapsulate data and the algorithms to manipulate the data. Reusability. Much like spiral model ie evolutionary and iterative. But composes applications from prepackaged SW components (classes)Process steps:--candidate class is identified --library is searched for existing class--if none exists, then one engineered usingobject-oriented methods.

Advantages: Faster development and lowercosts.

Disadvantages: requires expertise in this type of development

Page 15: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

15

Software Process Models--Comparison

Graphical comparison of these process models:•Basic waterfall model: A-->D-->C-->T-->M

(A=analysis, D=design, C=coding, T=testing, M=maintenance)

•Prototyping: A-->D-->C-->T-->M •RAD: A-->D1 D2-->C-->T Integrate-->T-->M

D2-->C-->T Reuse-->C-->T

•Incremental: A-->D-->C-->T-->M-->A-->D-->C-->T--> ……-->M M•Spiral: T<--C<--D<--A T Component based:

A-->D C A-->D-->Library-->Integrate-->T-->M

A-->D C•Concurrent: A-->A1-->D-->C-->T-->Integrate-->T-->M

A1-->D-->C-->T A1-->D-->C-->T

Page 16: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

16

Formal Methods

Formal Methods: formal mathematical specification of SW. Uses rigorous mathematical notation.

Advantages: --Ambiguity, incompleteness, inconsistency found more easily.--Serves as a basis for program verification. --”promise” of defect-free SW

Disadvantages: --Very time consuming--extensive training required--not a good communication mechanism (especially for customer) --handles syntax well; not so successful with semantics

uses: Safety critical SW (medicine andavionics) or when severe economic hardshipwill be incurred by developer if error occurs

Page 17: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

17

Question: what design methodology encompasses both?

One possibility: UML (unified modeling language)

• graphical language

• supports dynamic behavior

• modular, object-based

• extensions possible (e.g., AUML, “agent UML”)

Page 18: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

18

UML--definition

UML: stands for "unified modeling language”

unifies methods of Booch, Rumbaugh (OMT or Object Modeling Technique), and Jacobson (OOSE or Object-Oriented Software Engineering)

mainly a modeling language, not a complete development method

Early versions -- second half of the 90's

Not all methods we will use are officially part of the UML description

Page 19: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

19

UML--references

Most of the examples below, plus more on UML, issues can be found in:

1. Booch, Rumbaugh, and Jacobson, The Unified Modeling Language User Guide

2. Fowler and Scott, UML Distilled

3. Horstmann, Practical Object-Oriented Development in C++ and Java

4. Pressman, Software Engineering, A Practitioner's Approach

Page 20: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

20

Tools for analysis, specification, and design

We will use the following tools:

Analysis and specification:

•Use cases

•Dataflow diagrams

Analysis, specification, and design:

•Entity-relationship (ER) diagrams

•Class-Responsibility-Collaborator (CRC) cards

•Object message diagrams

•State diagrams

•Sequence diagrams

Page 21: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

21

USE CASES:

a part of the ”Unified Modeling Language" (UML) which we will also use for design

each identifies a way the system will be used and the "actors" (people or devices) that will use it (an interaction between the user and the system)

each use case should capture some user-visible function and achieve some discrete goal for the user

an actual user can have many actor roles in these use cases

an instance of a use case is usually called a "scenario"

Use cases

Page 22: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

22

Example (based on Booch, Rumbaugh, and Jacobson, The Unified Modeling Language User Guide):

Place call

Receive call

Use scheduler

Receive additional

call

Place conference

call

Cellular network

User

Use Case (Example) Key: Use Case Actor “Extends” “Uses”

Validate user

Example use case

System boundary

Page 23: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

23

Use case—detailed example (Pressman)

Example: “SAFEHOME” system (Pressman, Software Engineering, p. 161)

Use case: InitiateMonitoring•Primary actor (1)

•Goal in context (2)

•Preconditions (3)

•Trigger (4)

•Scenario (5)

•Exceptions (6)

•Priority (system development) (7)

•When available (8)

•Frequency of use (9)

•Channel to actor (10)

•Secondary actors (11)

•Channels to secondary actors (12)

•Open issues (13)

Arms/disarms system

Accesses system via internet

Responds to alarm event

Encounters an error condition

Reconfigures sensors

and related system features

Homeowner

System administrator

Sensors

Pressman, p. 163, Figure 7.3

Page 24: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

24

Example: “SAFEHOME” system

Use case: InitiateMonitoring

1. Primary actor: homeowner

2. Goal in context: set the system to monitor sensors when the homeowner leaves the house or remains inside the house

3. Preconditions: system already programmed with homeowner’s password and can recognize the sensors

4. Trigger: homeowner decides to turn on the alarm system

Page 25: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

25

5. Scenario

1. Homeowner observes control panel

2. Homeowner enters password

3. Homeowner selects “stay” or “away”

4. Homeowner observes that read alarm light has come on, indicating the system is armed

Page 26: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

26

6. Exceptions

1. Control panel is not ready; homeowner must check all sensors and reset them if necessary

2. Control panel indicates incorrect password (one beep)—homeowner enters correct password

3. Password not recognized—must contact monitoring and response subsystem to reprogram password

4. Stay selected: control panel beeps twice and lights stay light; perimeter sensors are activated

5. Away selected: control panel beeps three times and lights away light; all sensors are activated

Page 27: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

27

7. Priority: essential, must be implemented

8. When available: first increment

9. Frequency of use: many times per day

10. Channel to actor: control panel interface

11. Secondary actors: support technician, sensors

12. Channels to secondary actors:

support technician: phone line

sensors: hardwired and wireless interfaces

Page 28: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

28

13. Open issues

1. Should there be a way to activate the system without the use of a password or with an abbreviated password?

2. Should the control panel display additional text messages?

3. How much time does the homeowner have to enter the password from the time the first key is pressed?

4. Is there a way to deactivate the system before it actually activates?

Use case diagram?

Page 29: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

29

Example: what would be a use case for: vending machine user

Primary actor: Goal in context: Preconditions: Trigger: Scenario: Exceptions: Priority: (system development): When available: Frequency of use: Channel to actor: Secondary actors: Channels to secondary actors: Open issues:

Page 30: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

30

Note:

Use cases can form a basis for system acceptance tests

For each use case:• Develop one or more system tests to confirm that the use case requirements will be satisfied• Add explicit test values as soon as possible during design phase• These tests are now specifically tied to the use case and will be used as the top level acceptance tests

Also at this stage develop tests for performance and usability requirements (these may be qualitative as well as quantitative)

System Tests

Page 31: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

31

Data flow diagram (DFD):

----graphical technique to show information flow and transforms applied as data move from input to output

----each function or information transformer is represented by a circle or "bubble"

----data labels are placed on arrows showing information flow

----external entities (data "producers" or "consumers") are shown as square boxes

Page 32: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

32

The data flow diagram does not describe the processing sequence; it is not a flowchart. But it can be very useful during requirements analysis for a system being developed.

A DFD can be used to provide a functional model for the system being developed, thus supplementing the class relationship, object message, and state diagram models of UML.

Functional models based on DFD's were part of the Object Modeling Technique (OMT) developed by Rumbaugh, one of the three main designers of UML.

Page 33: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

33

Example (based on examples in Pressman, Software Engineering, A Practitioner's Approach):

external entity

external entity

external entity

external entity

external entity

computer system

input information

input information

input information

output information

output information

Memory Stick

Internet

Memory Stick

CRTKeyboard

Page 34: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

34

ER diagrams

Entity-relationship diagrams / class diagrams:

These diagrams represent the relationships between the classes in the system. These represent a static view of the system.

There are three basic types of relationship:

•inheritance ("is-a")

•aggregation ("has-a”)

•association ("uses")

These are commonly diagrammed as follows:

Page 35: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

35

ER diagram: is-a

is-a: draw an arrow from the derived to the base class:

manager employee

Page 36: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

36

ER diagram--has-a

has-a: draw a line with a diamond on the end at the "container" class. Cardinalities may also be shown (1:1, 1:n, 1:0…m; 1:*, i.e., any number > 0, 1:1…*, i.e., any number > 1):

car tire1 4

Page 37: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

37

ER diagram--uses

uses or association: there are many ways to represent this relationship, e.g.,

car gasstationcompany

employee

employs

works for

Page 38: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

38

CRC cards

CRC cards: class--responsibilities--collaborators cards

"responsibilities" = operators, methods

"collaborators" = related classes (for a particular operator or method)

Make one actual card for each discovered class, with responsibilities and collaborators on the front, data fields on the back. CRC cards are not really part of UML, but are often used in conjunction with it.

Page 39: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

39

Example (based on Horstmann, Practical Object-Oriented Development in C++ and Java):

front back

Class Mailbox

Operations Relationships(Responsibilities) (Collaborators)

get current message Message, Messagequeue

play greeting -----------

Queue of new messagesQueue of kept messagesGreetingExtension numberPasscode

Class Mailbox

Page 40: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

40

Common classes

Common types of classes which the developer can look for include:

•tangible things, e.g., Mailbox, Document

•system interfaces and devices, e.g., DisplayWindow, Input Reader

•agents, e.g., Paginator, which computes document page breaks, or InputReader

•events and transactions, e.g., MouseEvent,CustomerArrival

•users and roles, e.g., Administrator, User

•systems, e.g., mailsystem (overall), InitializationSystem (initializes)

•containers, e.g., Mailbox, Invoice, Event

•foundation classes, e.g., String, Date, Vector, etc.

Page 41: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

41

Example—bank simulation (Horstmann)

Teller 1

Teller 2

Teller 3

Teller 4

Customer 1Customer 3 Customer 2

Horstmann, Mastering Object-Oriented Design in C++, Wiley, 1995

Page 42: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

42

Example—bank simulation (Horstmann), cont.

An initial solution (Horstmann, p. 388):

Event

Departure

Arrival

Customer Bank

EventQueue

Application

Bank Statistics

Page 43: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

43

Example—bank simulation (Horstmann), cont.

An improved solution (Horstmann, p. 391):

Event

Departure

Arrival

Customer Bank

EventQueue

Simulation

Bank Statistics

Page 44: 1 System Design Process Basic problem in embedded systems Combine hardware / software techniques Allow flexibility in boundary Basic steps: --gather requirements,

44

Comparison

What simplifications

have been made?

Why?

Event

Departure

Arrival

Customer Bank

EventQueue

Application

Bank Statistics

Event

Departure

Arrival

Customer Bank

EventQueue

Simulation

Bank Statistics