Table of Contents Previous Chapter 36 The Master Library

36 The Master Library

This chapter covers the following topics:

Introduction

In this chapter the source code of the runtime library for applications generated by the SDT C Code Generator is described. The chapter covers basically three topics.

  1. The sections "File Structure" on page 2128, "The Symbol Table" on page 2131, and "The SDL Model" on page 2157 describe the runtime model for programs generated by the SDT C Code Generator.
    Mainly it is the data structure used to represent various SDL objects that is discussed, both from the static point of view (the type definitions), and from the dynamic point of view (what information it represents and how it is initialized, changed, and used).
    The full runtime model that is used during simulations (with the monitor) is described. From this model, an optimization is made to obtain an application (not using the monitor). The optimization is discussed under "Compilation Switches" on page 2269.
  2. The section "Structure of Generated Code" on page 2199 contains information about the code generated by the C Code Generator. The generated code is described in detail (although some details are omitted).
    There are explanations and examples showing what the generated code looks like, but not why it looks like it does. There are also some comments indicating in what circumstances different generated objects (functions, types, variables, and so on) are used.
  3. In the sections "Compilation Switches" on page 2269, "Creating a New Library" on page 2289, and "Adaption to Compilers" on page 2295, different aspects on how to make new versions of the runtime library are discussed.
    The compilation switches treated in the section "Compilation Switches" on page 2269 are used to determine the properties of the runtime library and the generated C code, while section "Creating a New Library" on page 2289 shows how to make new versions of the runtime library using for example new combinations of compilation switches.
    In the section "Adaption to Compilers" on page 2295, porting issues are discussed.

File Structure

The runtime library is structured into a number of files. These are:

Description of Files

scttypes.h

This file contains type definitions and extern declarations of variables and functions. The file is included by sctsdl.c, sctpred.c, sctutil.c, sctmon.c, sctpost.c, sctos.c, and by each generated C file.

sctlocal.h

This file contains type definitions and extern declarations of variables and functions that are used only in the kernel. This file is not included in generated code.

sctpred.h

This file contains type definitions and extern declarations handling the predefined data types in SDL (except PId, which is in scttypes.h). Macros used to implement the predefined generators in SDL can also be found here. This file is included in generated code via scttypes.h.

sctsdt.c

In this file the implementation of the SDL operations can be found, together with the functions used for scheduling. In more detail, this file contains groups of functions for:

sctpred.c

The functions implementing the operations defined in the SDL predefined data types can be fund in this file. Operators for PId is implemented in sctsdl.c.

sctutil.c

This file contains basic read and write functions together with functions to handle reading and writing of values of abstract data types, including the predefined data types. It also contains the functions for traces handling, text trace, GR trace, and MSC trace.

sctmon.c

The sctmon.c file contains the functions that implement the monitor interface, that is, interpreting and executing monitor commands.

sctpost.c

This file contains all the basic functions that are used to connect a simulator with the other parts of SDT.

sctos.c

In this file, some functions that represent the dependencies of hardware, operating system and compiler are placed.

The basic functions necessary for an application are a function to read the clock and a function to allocate memory.

To move a generated C program plus the runtime library to a new platform (including a new compiler), the major changes are to be made in this file, together with writing a new section in scttypes.h to describe the properties of the new compiler.

sctworld.o

This is a pre-linked object file containing sctsdl.o, sctutil.o, sctmon.o, sctpost.o, sctos.o and post.o.

A pre-linked file gives a faster link operation when generating an application. This file is of course only present if the hardware platform supports pre-linking.

post.h and sdt.h

These files are included in sctpost.c if the communication mechanism with other SDT applications should be part of the actual object code version of the library. post.h contains the function interface, while sdt.h contains message definitions.

post.o

This file contains the implementation of functions needed to send messages, via the SDT Postmaster, to other tools in SDT.

 
Table of Contents Next Chapter