![]() |
![]() |
![]() |
![]() |
![]() |
Introduction
Application Areas for the Cadvanced/Cbasic SDL to C Compiler
There are a number of application areas for the Cadvanced/Cbasic SDL to C Compiler, for example:
- Functional simulation and debugging of protocol specifications
- Debugging of system designs described in SDL
- Generation of applications, including embedded system applications with real time characteristics
- Performance simulations
- Simulation of the behavior behind a user interface prototype
In this part of the manual, the general behavior of the code generator and its application for simulation and debugging are discussed. The possibility to generate simulators is described in The SDL Simulator.
Functional Simulation and Debugging
During the validation of a specification or design of an application expressed in ITU SDL, you can use the Cadvanced/Cbasic SDL to C Compiler as a tool for simulation to help you understand and debug the behavior of a system description. (See The SDL Simulator.)
Errors arising from two different areas have to be considered in the validation process. In the language domain, errors due to illegal or illogical usage of the language concepts might be introduced into the specification; while in the problem domain, logical errors might be introduced.
With traditional computer program development, most illegal uses of language concepts are found by compilers or by run-time systems. Examples are syntax errors, missing declarations, division by zero, or indexing an array out of its bounds.
In the problem domain, however, the only feasible ways of detecting logical errors in non-trivial programs are testing and proofreading. When it comes to specifications in SDL, language domain errors can be detected by using the SDL Analyzer, which can be seen as a compiler without a code generation facility (see The SDL Analyzer). To detect problem domain errors, testing by simulating the specification is the main procedure available. Please see also The SDL Explorer.
The specification of a protocol in SDL, for instance, specifies a signal interface by giving a hypothetical implementation of the components in the protocol. This strategy immediately brings up two different purposes for simulating the behavior of a system specification: to understand the external view and to understand the internal view.
In the external view, the signal interface is of concern, while the internal behavior of the system specification (the behavior of the processes in the system) is of little or no interest. In the internal view, the internal behavior of the system specification is of concern, while the external signal interface is simply seen as part of the internal behavior.
A simulation of the internal behavior of a system specification constitutes an important part of the validation of the specification, both as a debugging tool and as a means to increase the understanding of the dynamic behavior of the specification. A designer of a system might use this kind of simulation to understand the specification better.
The ability to simulate and debug applications generated by the code generator at an SDL level is a very important feature towards achieving the correct overall behavior of the application. The debugging facilities provided by the SDL Suite have much in common with interactive debuggers for ordinary programming languages. The debugging is performed on a host computer.
Another application of the code generator as a simulator generator, is of course in SDL education, where simulation, especially of the internal behavior of a system specification, can serve as a powerful way of clarifying the semantics of SDL concepts.
Performance Simulation
The Cadvanced/Cbasic SDL to C Compiler can be used for performance simulations. You describe the performance model of the actual system using SDL. This model can be translated to a simulation and executed. By introducing measurements of interesting data, such as queue lengths, delays, and so on, into the SDL model, it is possible to gather statistical data during the execution of the simulation. In The Performance Library, you can find a description of the performance simulation facilities.
To simplify this kind of simulation, a number of SDL abstract data types and their implementations have been developed, where, for example, random number generation and handling of queues are supported. Please see The ADT Library.
Validation
The SDL Explorer uses the code produced by the Cadvanced/Cbasic SDL to C Compiler to form a program suitable for validation of an SDL system. The Explorer uses state space exploration and can be used to:
The Explorer is described in The SDL Explorer.
Communicating Simulations
You can specify that a generated C program should be able to communicate over the PostMaster, which is the mechanism used for communication between the SDL Suite tools. Signals sent from the SDL system (the generated program) to the environment and signals coming to the SDL system from the environment can be handled. This facility makes it, for example, possible to develop simulation programs for two communicating systems, execute them using the SDL Suite and obtain communication between the systems.
As a generated C program does not know what it communicates with, it can of course communicate with any type of application, as long as the application is connected to the PostMaster (the communication medium) and sends signals according to the defined format. How to achieve this is described in Using the Public Interface.
A very interesting group of such applications are user interfaces. By connecting a user interface and an SDL simulation you can achieve several things: You can, for example, build well-designed application oriented user interfaces that present what is going on in a simulation, or you can in a simple way define the logic behavior behind a user interface during its prototyping phase.
Overview of the Cadvanced/Cbasic SDL to C Compiler
To facilitate the validation of SDL specifications or descriptions, the SDL Analyzer contains an SDL parser, an SDL semantic checker, and the Cadvanced/Cbasic SDL to C Compiler.
Creating a C Program
To obtain an executable program that behaves according to an SDL description, you enter the SDL description into the SDL Analyzer, which contains the Cadvanced/Cbasic SDL to C Compiler. If the SDL description is syntactically and semantically correct, a C program is generated. You then compile this program using an ordinary C compiler and link it with a predefined SDL run-time library to form an executable program. See Figure 498.
As indicated above, the C code generation facility contains two components:
- The SDL to C Compiler, which can be seen as a back-end to the SDL Analyzer. This component generates a C program.
- Predefined and precompiled C units, which implement an SDL runtime library and the command line user interface of a simulator, that is, a monitor system. The run-time library also includes a communication mechanism which makes it possible to trace the execution of SDL transitions in the SDL Editor. There are several versions of the library that are suitable to different application areas for the generated C code, see Libraries.
Executing a C Program as a Simulator
The generated C program uses an internal data representation of the SDL objects in the system, for example process instances and signal instances. The process instances will execute transitions in a quasi-parallel manner. During a transition, SDL actions such as tasks, decisions and signal outputs are executed according to the semantics of SDL.
You interact, using SDL terminology, with the simulator through a monitor system, which contains a number of commands to:
- Control the execution of transitions.
- Examine the status of objects in the system.
- Turn log facilities on and off.
- Affect the system by, for example, sending signal instances from the environment to the system.
Contents of This Chapter
You can find more details on creating and executing a C program in the following sections:
- In Generating a C Program, the process of generating a C program is described.
- In Abstract Data Types, implementation aspects especially concerning abstract data types, are described.
- In Directives to the Cadvanced/Cbasic SDL to C Compiler, possibilities to give additional information to the Cadvanced/Cbasic SDL to C Compiler are discussed.
- The section Using Cadvanced/Cbasic SDL to C Compiler to Generate C++, contains considerations on class definitions as C++ code and the utilization of the classes as C++ code in SDL tasks.
- In Restrictions, the Cadvanced/Cbasic SDL to C Compiler restrictions are covered.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |