1. Synchronous Data Flow Domain
- data driven: the availability of particles at the inputs of a star enables it
- star without any inputs are always enabled
- star without any inputs are always enabled
- the firing of a star is determined during start-up phase (statically scheduled)
- number of inputs/outputs remains constant throughout execution of system
- delays can be introduced anywhere
- all feedback loops must have delays to avoid deadlock
- all feedback loops must have delays to avoid deadlock
- system execution is stopped when specified number of iterations is reached
- graph consistency is easily checked
- to maintain balance consumption of particles on each arc
- find rA, rB, rC such as
- find rA, rB, rC such as
2. Consistency and iteration in SDF
Consider the following schematic.
- a1, a2 and b2 are the number of data generated at each execution of a star.
- b1, c1 and c2 are the number of data necessary for having the corresponding star (b or c) having a run.
- rA, rB, rC are the repetition factors of each star.
The graph is considered as consistent if the following equation has a solution :
- rA * a1 = rC * c1
- rA * a2 = rB * b1
- rB * b2 = rC * c2
- for consistent graph a solution exists
- the smallest non zero integer solution determines what is an iteration for the system (in term of number of firing for each star)
3. Consistency and iteration example for SDF

- rA * 16 = rC * 16
- rA = rB * 128
- rB * 128 = rC
at each iteration:
- A will be fired rA = 128 times
- B will be fired rB = 1 time
- C will be fired rC = 128 times
4. Delays in SDF
- delays are not consired as stars but as a property of the arc connecting two stars
- there are two types of delays: initializable or not
System Palette
5. Parameter setting
- value : 2
- expression : 2*PI
- parameter from an embedding galaxy : freq
- expression with parameter : 2*PI/(1+freq)
- from a file : <~/mystar/test/freq_value.txt
- Tcl expression : ! "expr sqrt(2.0 / {freq})"
- special tcl : ! "range 0 5"
- 0 1 2 3 4 5
- 0 1 2 3 4 5
- array parameter : 1 2 [3]
- 1 2 2 2
- 1 2 2 2
6. Overview of SDF palettes (1)
- Signal sources= signal generators
- Signal sinks= for display, file writing
- Arithmetics= adders, multipliers, amplifiers
- Non Linear functions= cosine functions, log, quantizer
- Logic= boolean operators and comparators
- Control= communicators, distributors, up/down samplers, forks
- Conversion for type conversion
- Matrix functions= matrix operations
- Matlab Functions= for communication with Matlab processes
- Signal Processing= fixed/adaptive filters, convolution
- Spectral Analysis= spectral estimation
- Communication= digital communications, shapers, speech coders, QAM encoders
- Telecommunications= touchtone generators, decoders, channel models, PCM coders
- Spatial Array Processing= models of sensors, Doppler effects, beamformers
- Image / Video processing= edge detection, DCT coding, motion compensation, ...
7. Creating New Stars: principles
A star is created in writing a source code.The best solution is to pick up the closest available star and to modify it. The following sections will describe the main parts of a star.
- general description: name, domain, documentation, author, copyright, location, ...
///////////////// START OF LISTING ////////////////
defstar {
// GENERAL INFORMATION ON THE STAR
// the name of the star
name { Template }
// the domain SDF, BDF, CGC, ...
domain { SDF }
// a short description of the star function
desc { This template star just take an input
and output the same value if it lies between
the defined limits else it outputs the nearest
limit. }
// this allows the use of SCCS or RCS
// version control systems
version { %W% %G% }
author { Ma pomme }
copyright {
Copyright Free&ALter Soft (c) 1997 - 2000 - right to copy
modify, distribute given to anybody. No guaranty of any kind.
Use at your own risk. }
// Just to precise where it lies. It is just an indication
// and you can put whatever you like
location { my SDF }
// Used to generate keywords for the automatic
// documentation generation.
// .Id is a nroff command
explanation {
.Id "Template"
.Id "clamping"
}
//
// END OF GENERAL STAR INFORMATION DEFINITION
8. Creating New Stars: principles
Source code template : code and protected data///////////////// START OF A NEW LISTING PART ////////////////
// list of h files that will be included
hinclude { <stdio.h>,"my_code.h" }
// list of cc files that will be included
ccinclude { "my_code.cc" }
//
// variables of the star the value of which will be kept
// from a call to another
protected {
#define YES 0
int star_state;
}
9. Creating New Stars: principles
Source code template: declaration of inputs / outputs///////////////// START OF A NEW LISTING PART ////////////////
// START OF EXTERNAL VIEW DEFINITION
// Definition of an input
input {
// name of the input
name { pixel_image }
// data type that will come from the input
type { FLOAT_MATRIX_ENV }
// description of the input
desc { Input pixel picture }
}
// Definition of an output
output {
name { output }
type { int }
desc { }
}
The type of an input or output may be one of the following :
- int
- float
- fix
- complex
- anytype
- INT_MATRIX_ENV
- FLOAT_MATRIX_ENV
- COMPLEX_MATRIX_ENV
- FIX_MATRIX_ENV
- message
10. Creating New Stars: principles
Source code template: parameter definition///////////////// START OF A NEW LISTING PART ////////////////
// State definition
// A state is internal to a star.
// It may be set before a run.
// Afterthat the star may modify the value.
// It is typically used for star parameters
defstate {
name { BlockSize }
type { int }
// A default value : very very useful
default { 8 }
desc { "Number of pixels in a block" }
}
// END OF EXTERNAL VIEW DEFINITION
The type of a parameter may be one of the following :
- int
- float
- complex
- string
- intarray
- floatarray
- complexarray
- precision
- stringarray
11. Creating New Stars: principles
Source code template: behavioural description: set-up///////////////// START OF A NEW LISTING PART ////////////////
// STAR FUNCTION DEFINITION
// setup : executed once at the beginning of the run
setup {
/* In setup, go and wrapup, I can put classical
C comments */
input.setSDFParams(3,2);
output.setSDFParams(5,4);
} // end setup
setSDFParams functions allows to define the number of samples required for a firing of star (for input), or the number of samples generated by a star at each run.
- The first parameter is the number of samples on input to enable star firing : n
- The second parameter is the number of the last sample (except the current) needed by the star : n-1
12. Creating New Stars: principles
Source code template: behavioural description: 'go'///////////////// START OF A NEW LISTING PART ////////////////go {
// Data declaration
float temporary;
//
// The current (numbered 0) data on the input
// is transfered to temporary
temporary = input%0;
//
// The function of the star itself
temporary *=2;
//
// Temporary is sent on the output
output%0 << temporary;
//
} // end go
13. Creating New Stars: principles
source code template: behavioural description: 'wrap_up'///////////////// START OF A NEW LISTING PART ////////////////wrapup {
} // end of wrapup
// END OF STAR FUNCTION DEFINITION
} // end of star
14. Summary:
- general description: name, domain, documentation, copyright and author
- declaration of I/O
- parameter definition
- behavioural description:
16. Creating New Stars: step by step
- write source code for function description based on star source template
- copy it to desired directory in Ptolemy tree
- open "Make Star" window ('*') and fullfill general description
- click on the 'OK' button
- -> generation of source files ('.cc','.h','.t') with preprocessor PTLANG
- -> c++/g++ compilation
- -> generation of object file linked to simulation kernel
- -> automatic generation of a new icon
- -> generation of source files ('.cc','.h','.t') with preprocessor PTLANG
- if necessary use debugger...
17. LAB 2 - STAR WRITING
Creating New Stars: a design applicationExample: threshold function: output(n)= max ( MIN, min(input(n), MAX))

18. LAB 3
![]() |
Précédent | Suivant | Plan | 01/03/00 | PTOLAB |


