Title: SDL Data
1Chapter 5
2Contents
- Data
- Simple data in SDL
- Dynamic generation of process instances
- SDL symbol summary
- Example
35.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
45.2 Simple Data in SDL
Cid (integer) Digit (integer) DCL
no_dig integer DCL cardid integer
5Declaration 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.
6Variable 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.
7Task Symbol
- Used to set the values of data by assignments.
- A task symbol may contain a list of assignments
separated by commas.
8Task 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.
9Input 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.
10Decision Symbol
- Used to choose between different alternative
courses of action upon a question.
11(No Transcript)
12Output Signal with Data
- Full expression can be in signal parameters, not
only variables.
13Process PanelControl
14Process PanelControl (II)
- A special initialization construct
- DCL trial_no Integer 0
- Output symbol where the destination is a process
name
15TIME, Duration, and TIMERS
16TIME, 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
17TIMER Automata
18Process 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
19Use of PId Variables
20Use of PId Variables (II)
21Output Symbols
22Save 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.
235.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.
24Creation of Processes
25PROCESS CUControl
Create Symbol
26Dynamic Process Creation
27Stop Symbol
- Processes are created by their parent.
- A processes terminates when it reaches a stop
symbol. (Note processes may not kill each
other).
28Daemongame System
29Block Structure of Daemongame
30Process and Dynamic Process Creation
315.6 SDL Symbol Summary
32SDL Symbol Summary (II)
33SDL Data Part 2
- SDL data types
- Abstract data types
- Shared variables and enabling conditions
34Operators
- 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 /
35Infix and Prefix Operators
- Integer,Integer -gt Integer
- num Character -gt Integer
- I I1
- N num(X)
- I (I,1)
36Boolean
- "NOT" Boolean -gt Boolean
- "AND" Boolean, Boolean -gt Boolean
- "OR" Boolean, Boolean -gt Boolean
- "XOR" Boolean, Boolean -gt Boolean
- "gt" Boolean, Boolean -gt Boolean
37Character
- "lt" Character, Character -gt Boolean
- "lt" Character, Character -gt Boolean
- "gt" Character, Character -gt Boolean
- "gt" Character, Character -gt Boolean
- Num Character -gt Integer
- Chr Integer -gt Character
38Charstring
- MkString Character -gt Charstring
- Length Charstring -gt Integer
- First Charstring -gt Character
- Last Charstring -gt Character
- "//" Charstring, Charstring -gt Charstring
- SubString Charstring, Integer, Integer
- -gt Charstring
39Duration
- "" Duration, Duration -gt Duration
- "-" Duration -gt Duration
- "-" Duration, Duration -gt Duration
- "" Duration, Real -gt Duration
- "" Real, Duration -gt Duration
- "/" Duration, Real -gt Duration
- "gt" Duration, Duration -gt Boolean
- "lt" Duration, Duration -gt Boolean
- "gt" Duration, Duration -gt Boolean
- "lt" Duration, Duration -gt Boolean
40Time
- "" Time, Duration -gt Time
- "" Duration, Time -gt Time
- "-" Time, Duration -gt Time
- "-" Time, Time -gt Duration
- "lt" Time, Time -gt Boolean
- "lt" Time, Time -gt Boolean
- "gt" Time, Time -gt Boolean
- "gt" Time, Time -gt Boolean
41Integer, Natural
- "-" Integer -gt Integer
- "" Integer, Integer -gt Integer
- "-" Integer, Integer -gt Integer
- "" Integer, Integer -gt Integer
- "/" Integer, Integer -gt Integer
- "mod" Integer, Integer -gt Integer
- "rem" Integer, Integer -gt Integer
- "lt" Integer, Integer -gt Boolean
- "gt" Integer, Integer -gt Boolean
- "lt" Integer, Integer -gt Boolean
- "gt" Integer, Integer -gt Boolean
- Float Integer -gt Real
- Fix Real -gt Integer
42PId
- 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.
43Real
- "-" Real -gt Real
- "" Real, Real -gt Real
- "-" Real, Real -gt Real
- "" Real, Real -gt Real
- "/" Real, Real -gt Real
- "lt" Real, Real -gt Boolean
- "gt" Real, Real -gt Boolean
- "lt" Real, Real -gt Boolean
- "gt" Real, Real -gt Boolean
44New Type Definition (example of abstract data
type)
45Syntype Definition
- syntype example2 integer
- constant 010
- endsyntype
46Enumeration
- An enumeration sort is a sort containing only the
values enumerated in the sort. - newtype KeyPosition
- literals Off, Stand_by, Service_mode
- endnewtype
47Struct
- newtype Person struct
- Name Charstring
- Address Charstring
- PhoneNumber Charstring
- endnewtype
48Array
- 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
49Array (II)
- GENERATOR Array
- (TYPE Index,TYPE Itemsort)
- OPERATORS
- Make! Itemsort?Array
- Modify! Array,Index,Itemsort?Array
- Extract! Array,Index?Itemsort
- AXIOMS
- ...
- ENDGENERATOR Array
50Array (III)
51String
- 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
52String (II)
- MkString Itemsort -gt String
- Length String -gt Integer
- First String -gt Itemsort
- Last String -gt Itemsort
- "//" String, String -gt String
- SubString String, Integer, Integer
- -gt String
53Powerset
- 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 031
- endsyntype
- newtype P1 Powerset(SmallInteger)
- endnewtype
54Powerset (II)
- "IN" Itemsort, Powerset -gt Boolean
- Incl Itemsort, Powerset -gt Powerset
- Del Itemsort, Powerset -gt Powerset
- Length Powerset -gt Integer
- Take Powerset -gt Itemsort
- Take Powerset, Integer -gt Itemsort
- "lt" Powerset, Powerset -gt Boolean
- "gt" Powerset, Powerset -gt Boolean
- "lt" Powerset, Powerset -gt Boolean
- "gt" Powerset, Powerset -gt Boolean
- "AND" Powerset, Powerset -gt Powerset
- "OR" Powerset, Powerset -gt Powerset
55Imported and Exported Value
- The exported declaration and the imported
specification must both be equal to the remote
variable specification.
56Shared Variables
57Shared Variables (II)