Chapter 5 SDL - Data 2007, rev. 08 SEG2101 Chapter 5.

Slides:



Advertisements
Similar presentations
Slide 1 Specification & Description Language (SDL) - Part II.
Advertisements

Slide 1 Specification & Description Language (SDL) - Part II.
Elementary Data Types Scalar Data Types Numerical Data Types Other
Chapter 8 Arrays and Strings
Introduction to scripting
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
Chapter 8 Arrays and Strings
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Python Primer 1: Types and Operators © 2013 Goodrich, Tamassia, Goldwasser1Python Primer.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
FDT Foil no 1 Basic SDL Specification and Description Language Basic SDL.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
MOTOROLA and the Stylized M Logo are registered in the US Patent & Trademark Office. All other product or service names are the property of their respective.
1 An SDL Tutorial Two primary elements: –Structure –Identifies the various components of the system, and the communication paths among them. –Components:
Java Programming: Guided Learning with Early Objects Chapter 1 Basic Elements of Java.
Introduction Every program takes some data as input and generate processed data as out put . It is important to know how to provide the input data and.
Chapter 4 Stacks
Protocol Modeling Eng. Ahmed Badr Tutorial 2 Theoretical
Chapter 6 JavaScript: Introduction to Scripting
State Machine Model.
CHP - 9 File Structures.
Introduction to the C Language
Type Checking Generalizes the concept of operands and operators to include subprograms and assignments Type checking is the activity of ensuring that the.
Type Checking, and Scopes
Chapter 3 Assignment and Interactive Input.
Chapter 2 Scanning – Part 1 June 10, 2018 Prof. Abdelaziz Khamis.
Computer Programming BCT 1113
Array, Strings and Vectors
Chapter 2: Input, Processing, and Output
Data Structure and Algorithms
Java Primer 1: Types, Classes and Operators
Documentation Need to have documentation in all programs
Data Structures and Algorithms
DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++
C Language VIVA Questions with Answers
Objectives Identify the built-in data types in C++
Selenium WebDriver Web Test Tool Training
The Selection Structure
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
JavaScript: Functions.
Stacks Chapter 4.
Java Programming: From Problem Analysis to Program Design, 4e
Primitive Types Vs. Reference Types, Strings, Enumerations
Introduction to the C Language
Chapter 3 Introduction to Classes, Objects Methods and Strings
Topics Introduction to File Input and Output
Introduction to C++ Programming
Variables ICS2O.
CIS16 Application Development and Programming using Visual Basic.net
PHP.
An introduction to UML 2 for modelling communications
Process Identification (PId)
Chapter 6 Control Statements: Part 2
Python Primer 1: Types and Operators
Review for Final Exam.
Languages and Compilers (SProg og Oversættere)
Linux Shell Script Programming
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
7 Arrays.
The Data Element.
Chapter 2: Input, Processing, and Output
The Data Element.
Topics Introduction to File Input and Output
Introduction to C Programming
Presentation transcript:

Chapter 5 SDL - Data 2007, rev. 08 SEG2101 Chapter 5

Contents Data Simple data in SDL Dynamic generation of process instances SDL symbol summary Example 2007, rev. 08 SEG2101 Chapter 5

5.1: What is Data? The bytes of a computer normally play two different roles. Some bytes are parts of the program, while others are manipulated by the programs.  control and data Data is usually used to represent spatial information whereas control is used for temporal information about behavior progress. Data exists over time. Abstract data types 2007, rev. 08 SEG2101 Chapter 5

5.2: Simple Data in SDL Cid (integer) Digit (integer) DCL no_dig integer DCL cardid integer 2007, rev. 08 SEG2101 Chapter 5

Declaration of Variables DCL is the keyword which precedes data declaration. A list of names follows DCL and the line is terminated by a sort name. The common predefined types: Boolean, Character, Charstring, Integer, Natural, and Real. 2007, rev. 08 SEG2101 Chapter 5

Variable Declaration & Manipulation A process may locally use and manipulate data stored in variables. The variable may be initialized when it is created at interpretation time to a certain value. During a transition the process can use and manipulate its own local variables, using the task construct. 2007, rev. 08 SEG2101 Chapter 5

Task Symbol Used to set the values of data by assignments. A task symbol may contain a list of assignments separated by commas. 2007, rev. 08 SEG2101 Chapter 5

Task Symbol (II) Variable occurrences on the right of an assignment operator means extracting the value from the variable. Operations are associated with types. Variables on the left of the assignment operator are modified to become the expression value of the right-hand side. 2007, rev. 08 SEG2101 Chapter 5

Input Signal with Data Values carried by input signals must be transferred to local variables There is no way to access the input signal again after it has been consumed. 2007, rev. 08 SEG2101 Chapter 5

Decision Symbol Used to choose between different alternative courses of action upon a question. 2007, rev. 08 SEG2101 Chapter 5

2007, rev. 08 SEG2101 Chapter 5

Output Signal with Data Full expression can be in signal parameters, not only variables. 2007, rev. 08 SEG2101 Chapter 5

Process PanelControl 2007, rev. 08 SEG2101 Chapter 5

Process PanelControl (II) A special initialization construct DCL trial_no Integer := 0; Output symbol where the destination is a process name 2007, rev. 08 SEG2101 Chapter 5

TIME, Duration, and TIMERS 2007, rev. 08 SEG2101 Chapter 5

TIME, Duration, and TIMER (II) Time: data type NOW is a predefined variable Duration: data type TIMER: a special type of object with operations SETactive RESETinactive and sending a message when time period has elapsed 2007, rev. 08 SEG2101 Chapter 5

TIMER Automata 2007, rev. 08 SEG2101 Chapter 5

Process Identification (PId) Each SDL process has a unique identifier, a value of data type PId. Special value NULL (no process) Predefined variables SELF: the process itself OFFSPRING: the most recent process created by SELF PARENT: SELF is OFFSPRING of PARENT SENDER: the process that sent the last signal received and processed by SELF 2007, rev. 08 SEG2101 Chapter 5

Use of PId Variables 2007, rev. 08 SEG2101 Chapter 5

Use of PId Variables (II) 2007, rev. 08 SEG2101 Chapter 5

Output Symbols 2007, rev. 08 SEG2101 Chapter 5

Save Symbol Save symbol assures that a set of signals will be bypassed until the process has entered a different state. Then the saved signals will be processed; they remain in the input queue in their original order. Example below: in all states but Idle, Code will be saved. Code signal will only be handled in the Idle state. 2007, rev. 08 SEG2101 Chapter 5

5.5: Dynamic Generation of Process Instances In SDL, a process may create other processes. The creation is shown by a dashed line from PARENT to OFFSPRING. Blocks cannot be generated dynamically. 2007, rev. 08 SEG2101 Chapter 5

Creation of Processes 2007, rev. 08 SEG2101 Chapter 5

PROCESS CUControl Create Symbol 2007, rev. 08 SEG2101 Chapter 5

Dynamic Process Creation 2007, rev. 08 SEG2101 Chapter 5

Stop Symbol Processes are created by their parent. A processes terminates when it reaches a stop symbol. (Note: processes may not kill each other). 2007, rev. 08 SEG2101 Chapter 5

Daemongame System 2007, rev. 08 SEG2101 Chapter 5

Block Structure of Daemongame 2007, rev. 08 SEG2101 Chapter 5

Process and Dynamic Process Creation 2007, rev. 08 SEG2101 Chapter 5

5.6: SDL Symbol Summary 2007, rev. 08 SEG2101 Chapter 5

SDL Symbol Summary (II) 2007, rev. 08 SEG2101 Chapter 5

SDL Data: Part 2 SDL data types Abstract data types Shared variables and enabling conditions 2007, rev. 08 SEG2101 Chapter 5

Operators Data types in SDL are Predefined types, such as Integer, etc. Programmer-defined types: They are defined using keywords Newtype or syntype. Examples are: Subranges of Integer Enumerations Arrays Record types (called structure in C, like objects with attributes) Abstract data types (not much used) For every data type defined in SDL, the following operators are always defined: Assignment ‘:=’ Test for equality ‘=’ Test for non-equality ‘/=’ 2007, rev. 08 SEG2101 Chapter 5

Infix and Prefix Operators “+” : Integer,Integer -> Integer; num : Character -> Integer; I := I+1; N := num(‘X’); I := “+”(I,1); 2007, rev. 08 SEG2101 Chapter 5

Boolean "NOT" : Boolean -> Boolean "AND" : Boolean, Boolean -> Boolean "OR" : Boolean, Boolean -> Boolean "XOR" : Boolean, Boolean -> Boolean "=>" : Boolean, Boolean -> Boolean 2007, rev. 08 SEG2101 Chapter 5

Character "<" : Character, Character -> Boolean; Num : Character -> Integer; Chr : Integer -> Character; 2007, rev. 08 SEG2101 Chapter 5

Charstring MkString : Character -> Charstring; Length : Charstring -> Integer; First : Charstring -> Character; Last : Charstring -> Character; "//" : Charstring, Charstring -> Charstring; SubString : Charstring, Integer, Integer -> Charstring; 2007, rev. 08 SEG2101 Chapter 5

Duration "+" : Duration, Duration -> Duration; "*" : Duration, Real -> Duration; "*" : Real, Duration -> Duration; "/" : Duration, Real -> Duration; ">" : Duration, Duration -> Boolean; "<" : Duration, Duration -> Boolean; ">=" : Duration, Duration -> Boolean; "<=" : Duration, Duration -> Boolean; 2007, rev. 08 SEG2101 Chapter 5

Time "+" : Time, Duration -> Time; "+" : Duration, Time -> Time; "<" : Time, Time -> Boolean; "<=" : Time, Time -> Boolean; ">" : Time, Time -> Boolean; ">=" : Time, Time -> Boolean; 2007, rev. 08 SEG2101 Chapter 5

Integer, Natural "-" : Integer -> Integer; "+" : Integer, Integer -> Integer; "-" : Integer, Integer -> Integer; "*" : Integer, Integer -> Integer; "/" : Integer, Integer -> Integer; "mod" : Integer, Integer -> Integer; "rem" : Integer, Integer -> Integer; "<" : Integer, Integer -> Boolean; ">" : Integer, Integer -> Boolean; "<=" : Integer, Integer -> Boolean; ">=" : Integer, Integer -> Boolean; Float : Integer -> Real; Fix : Real -> Integer; 2007, rev. 08 SEG2101 Chapter 5

PId The type PId is used as a reference to process instances. PId has only one literal, Null. All other values are obtained from the SDL predefined variables Self, Sender, Parent, and Offspring. 2007, rev. 08 SEG2101 Chapter 5

Real "-" : Real -> Real; "+" : Real, Real -> Real; "<" : Real, Real -> Boolean; ">" : Real, Real -> Boolean; "<=" : Real, Real -> Boolean; ">=" : Real, Real -> Boolean; 2007, rev. 08 SEG2101 Chapter 5

New Type Definition (example of abstract data type) 2007, rev. 08 SEG2101 Chapter 5

Syntype Definition syntype example2 = integer endsyntype; constant 0:10; endsyntype; 2007, rev. 08 SEG2101 Chapter 5

Enumeration An enumeration sort is a sort containing only the values enumerated in the sort. newtype KeyPosition literals Off, Stand_by, Service_mode endnewtype; 2007, rev. 08 SEG2101 Chapter 5

Struct newtype Person struct endnewtype; Name Charstring; Address Charstring; PhoneNumber Charstring; endnewtype; 2007, rev. 08 SEG2101 Chapter 5

Array The predefined generator Array takes two generator parameters, an index sort and a component sort. There are no restrictions in SDL on the index and component sort. newtype A1 Array(Character, Integer) endnewtype; 2007, rev. 08 SEG2101 Chapter 5

Array (III) 2007, rev. 08 SEG2101 Chapter 5

String The String generator takes two generator parameters, the component sort and the name of an empty string value. A value of a String type is a sequence of component sort values. There is no restriction on the length of the sequence. newtype S1 String(Integer, Empty) endnewtype; 2007, rev. 08 SEG2101 Chapter 5

String (II) MkString : Itemsort -> String Length : String -> Integer First : String -> Itemsort Last : String -> Itemsort "//" : String, String -> String SubString : String, Integer, Integer -> String 2007, rev. 08 SEG2101 Chapter 5

Powerset The Powerset generator takes one generator parameter, the item sort, and implements a powerset over that sort. A Powerset value can be seen as: for each possible value of the item sort it indicates whether that value is member of the Powerset or not. syntype SmallInteger = Integer constants 0:31 endsyntype; newtype P1 Powerset(SmallInteger) endnewtype; 2007, rev. 08 SEG2101 Chapter 5

Powerset (II) "IN" : Itemsort, Powerset -> Boolean Incl : Itemsort, Powerset -> Powerset Del : Itemsort, Powerset -> Powerset Length : Powerset -> Integer Take : Powerset -> Itemsort Take : Powerset, Integer -> Itemsort "<" : Powerset, Powerset -> Boolean ">" : Powerset, Powerset -> Boolean "<=" : Powerset, Powerset -> Boolean ">=" : Powerset, Powerset -> Boolean "AND" : Powerset, Powerset -> Powerset "OR" : Powerset, Powerset -> Powerset 2007, rev. 08 SEG2101 Chapter 5

Imported and Exported Value The exported declaration and the imported specification must both be equal to the remote variable specification. 2007, rev. 08 SEG2101 Chapter 5

Shared Variables 2007, rev. 08 SEG2101 Chapter 5

Shared Variables (II) 2007, rev. 08 SEG2101 Chapter 5