IBM
Contents Index Previous Next



Generating a C Program


A generated C program can be used for several things, for example as a simulator, as an explorer, or as an application with the behavior defined by the translated SDL system. The process of generation of simulators, explorers, or applications, see below, is started in the Organizer, in the make dialog (see Make) or by the quick buttons for simulation and validation (see Quick Buttons).

The SDL Analyzer, which contains the C code generation facility, can also be started as a stand-alone tool. For more information about this possibility please see The Analyzer Command Line UI.

Process of Generating a C Program

There are four steps that must be performed to start the execution of, for example, a simulator:

  1. The SDL Analyzer and its built-in Cadvanced/Cbasic SDL to C Compiler create a program expressed in C source code.
  2. The generated C file (or files) is compiled.
  3. The compiled file (or files) is linked together with a predefined library.
  4. The executable program that is created in the link operation is started.

This process has been automated and requires no user knowledge about compiling or linking of programs. The process is initiated in the Organizer using the quick buttons for simulation and validation, or by using the Make dialog.

A C program can only be generated for an SDL system. The C code that constitutes the program can, however, be generated on multiple files, which means that a local change in, for example, a block diagram only requires a regeneration and recompilation of the code for that unit. The object files, (the compiled versions of the C files) for the other unchanged units can then be used in the link operation to form a new executable program. This feature in automatically used by the make facility and the quick buttons, to minimize the amount of work and thus the turn-around time, for the process from a change in the SDL system to a new simulator (for example).

The separation of the C code for an SDL system can be decided by the user. The Edit Separation command from the Generate menu is used for that purpose, see Edit Separation. The effect on the generated file structure and some guidelines of how to use separation can be found in the section Selecting File Structure for Generated Code - Directive #SEPARATE.

Executing a C Program

The generated C programs can in principle be compiled as either a simulator, an explorer, or an application. Generated applications have no further connection with the SDL Suite and are executed as any other application.

A generated simulator or explorer can however be started in two different ways:

The SDL Unit for Which Code is Generated

The first time a C program is generated for a system, the complete system will be selected for analysis and C code generation. After that only the unit (system or block) that is changed will be selected. Note that the lowest level of possible regeneration object is a block. That block may not be a block type, or be part of a block type or system type. The reason that a process cannot be generated without regenerating the enclosing block, is that internal process information about, for example, formal parameters are used to generate code for other processes within the same block.

Errors During Code Generation

Errors that may occur during code generation are internal errors. That is, errors due to not yet implemented features of SDL, and errors related to problems with opened or closed operations of files.

An error message starts with an SDT references and is followed by a description of the error, including a error number. Example:

ERROR 884 Not implemented: Signal refinement 

http://www.ibm.com/rational
Contents Index Previous Next