Using Simulink    

Controlling S-Function Execution

Inlining S-functions using the Target Language Compiler increases performance when used with the Simulink Accelerator. By default, however, the Accelerator ignores an inlining TLC file for an S-function, even though the file exists.

One example of why this default was chosen is a device driver S-Function block for an I/O board. The S-function TLC file is typically written to access specific hardware registers of the I/O board. Because the Accelerator is not running on a target system, but rather is a simulation on the host system, it must avoid using the inlined TLC file for the S-function.

Another example is when the TLC file and MEX-file versions of an S-function are not compatible in their use of work vectors, parameters, and/or initialization.

If your inlined S-function is not complicated by these issues, you can direct the Accelerator to use the TLC file instead of the S-function MEX-file by specifying SS_OPTION_USE_TLC_WITH_ACCELERATOR in the mdlInitializeSizes function of the S-function. When set, the Accelerator uses the inlining TLC file and full performance increases are realized. For example:


  Customizing the Simulink Accelerator Build Process Graphical Merge Tool