Presentation is loading. Please wait.

Presentation is loading. Please wait.

1. Embedded Computing 1.1 Introduction 1.2 Complex system and microprocessors 1.3 Embedded system design process 1.4 Formalisms for system designs 1.5.

Similar presentations


Presentation on theme: "1. Embedded Computing 1.1 Introduction 1.2 Complex system and microprocessors 1.3 Embedded system design process 1.4 Formalisms for system designs 1.5."— Presentation transcript:

1

2 1. Embedded Computing 1.1 Introduction 1.2 Complex system and microprocessors 1.3 Embedded system design process 1.4 Formalisms for system designs 1.5 Design example: model train controller

3 Introduction zObject-oriented design. zUnified Modeling Language (UML).

4 System modeling zNeed languages to describe systems: yuseful across several levels of abstraction; yunderstandable within and between organizations. zBlock diagrams are a start, but don’t cover everything.

5 Object-oriented design zObject-oriented (OO) design: A generalization of object-oriented programming. zObject = state + methods. yState provides each object with its own identity. attributes yMethods provide an abstract interface to the object.

6 OO implementation in C++ class display { pixels : pixeltype[IMAX,JMAX]; public: display() { } pixeltype pixel(int i, int j) { return pixels[i,j]; } void set_pixel(pixeltype val, int i, int j) { pixels[i,j] = val; } }

7 OO implementation in C typedef struct { pixels: pixeltype[IMAX,JMAX]; } display; display d1; pixeltype pixelval(pixel *px, int i, int j) { return px[i,j]; }

8 Objects and classes zClass: object type. zClass defines the object’s state elements but state values may change over time. zClass defines the methods used to interact with all objects of that type. yEach object has its own state.

9 OO design principles zSome objects will closely correspond to real-world objects. ySome objects may be useful only for description or implementation. zObjects provide interfaces to read/write state, hiding the object’s implementation from the rest of the system.

10 UML zDeveloped by Booch et al. zGoals: yobject-oriented; yvisual; yuseful at many levels of abstraction; yusable for all aspects of design.

11 UML object d1: Display pixels: array[] of pixels elements menu_items pixels is a 2-D array comment object name class name attributes

12 UML class Display pixels elements menu_items mouse_click() draw_box operationsclass name

13 The class interface zThe operations provide the abstract interface between the class’s implementation and other classes. zOperations may have arguments, return values. zAn operation can examine and/or modify the object’s state.

14 Choose your interface properly zIf the interface is too small/specialized: yobject is hard to use for even one application; yeven harder to reuse. zIf the interface is too large: yclass becomes too cumbersome for designers to understand; yimplementation may be too slow; yspec and implementation are probably buggy.

15 Relationships between objects and classes zAssociation: objects communicate but one does not own the other. zAggregation: a complex object is made of several smaller objects. zComposition: aggregation in which owner does not allow access to its components. zGeneralization: define one class in terms of another.

16 Class derivation zMay want to define one class in terms of another. yDerived class inherits attributes, operations of base class. Derived_class Base_class UML generalization

17 Class derivation example Display pixels elements menu_items pixel() set_pixel() mouse_click() draw_box BW_displayColor_map_display base class derived class

18 Multiple inheritance SpeakerDisplay Multimedia_display base classes derived class

19 Links and associations zLink: describes relationships between objects. zAssociation: describes relationship between classes.

20 Link example zLink defines the contains relationship: message msg = msg1 length = 1102 message msg = msg2 length = 2114 message set count = 2

21 Association example message msg: ADPCM_stream length : integer message set count : integer 0..*1 contains # contained messages # containing message sets

22 Stereotypes zStereotype: the class of an entity in the UML metamodel. It provide an extension mechanism to the UML. yEach modeling element in the UML is represented as a metaclass (classifier, class, state, operation, signal). yA stereotyped metaclass is derived form an existing UML metaclass for recurring combination of elements in an object or class. zExample: y > : double angled brackets

23 Behavioral description zSeveral ways to describe behavior: yinternal view; yexternal view. y state machine y sequence diagram

24 State machines ab state state name Transition triggered by events

25 Event-driven state machines zBehavioral descriptions are written as event-driven state machines. yMachine changes state when receiving an input. zAn event may come from inside or outside of the system.

26 Types of events zSignal: asynchronous event. zCall: synchronized communication. zTimer: activated by time.

27 Signal event > mouse_click leftorright: button x, y: position declaration a b mouse_click(x,y,button) event description

28 Call event cd draw_box(10,5,3,2,blue)

29 Timer event ef tm(time-value) Timeout event 는 e state 에 들어온 후, time-value 시간이 지난 후에 transition 이 일어난다.

30 Example state machine region found got menu item called menu item found 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) event/action conditional/unconditional transitions

31 Sequence diagram zShows sequence of operations over time. zRelates behaviors of multiple objects. HW timing diagram 과 비슷 한 특정 scenario 만을 표현 여러가지 alternative 가능성 표현 부적합

32 Sequence diagram example m: Moused1: Displayu: Menu mouse_click(x,y,button) which_menu(x,y,i) call_menu(i) time lifeline focus of control object

33 Summary zObject-oriented design helps us organize a design. zUML is a transportable system design language. yProvides structural and behavioral description primitives.


Download ppt "1. Embedded Computing 1.1 Introduction 1.2 Complex system and microprocessors 1.3 Embedded system design process 1.4 Formalisms for system designs 1.5."

Similar presentations


Ads by Google