Skip to Main Content Skip to Search
Product Documentation

Code Generation Pane: SIL and PIL Verification

Code Generation: SIL and PIL Verification Tab Overview

Create SIL block and configure word size portability, code coverage for SIL testing, and code execution profiling

Configuration

This tab appears only if you specify an ERT–based system target file.

See Also

Numerical Equivalence Checking

Enable portable word sizes

Specify whether to allow portability across host and target processors that support different word sizes.

You can enable portable word sizes to support SIL testing of your generated code. For a SIL simulation, select SIL in the Create block field, or use top-model or Model block SIL simulation mode.

Settings

Default: off

On

Generates conditional processing macros that support compilation of generated code on a processor that supports a different word size than the target processor on which production code is intended to run (for example, a 32-bit host and a 16-bit target. This allows you to use the same generated code for both software-in-the-loop (SIL) testing on the host platform and production deployment on the target platform.

Off

Does not generate portable code.

Dependencies

When you use this parameter, you should set Emulation hardware on the Hardware Implementation pane to None.

Command-Line Information

Parameter: PortableWordSizes
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

ApplicationSetting
DebuggingOn
TraceabilityOn
EfficiencyOff
Safety precautionNo impact

See Also

Create block

Generate a SIL or PIL block

Settings

Default: None

None

No SIL or PIL block generated.

SIL

Create a SIL block with an S-function to represent the model or subsystem. The coder generates an inlined C or C++ MEX S-function wrapper that calls existing handwritten code or code previously generated by the code generation software from within the Simulink product. S-function wrappers provide a standard interface between the Simulink product and externally written code, allowing you to integrate your code into a model with minimal modification.

When you select this option, the software:

  1. Generates the S-function wrapper file model_sf.c (or .cpp) and places it in the build directory.

  2. Builds the MEX-file model_sf.mexext and places it in your working directory.

  3. Creates and opens an untitled model with a SIL block containing the S-function.

PIL

Create a PIL block that contains cross-compiled object code for a target processor or equivalent instruction set simulator. When you select this option, the software creates and opens an untitled model with a PIL block. With this block, you can verify the behavior of object code generated from subsystem or top-model components.

Use Target Connectivity API to control the way code compiles and executes in the target environment.

Command-Line Information

Parameter: CreateSILPILBlock
Type: string
Value: 'None' | 'SIL' | 'PIL'
Default: 'None'

Recommended Settings

ApplicationSetting
DebuggingOn
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

See Also

Code coverage tool

Specify a code coverage tool

Settings

Default: None

None

No code coverage tool specified

BullseyeCoverage

Specifies the BullseyeCoverage™ tool from Bullseye Testing Technology™

LDRA Testbed

Specifies the LDRA Testbed® tool from LDRA Software Technology

Dependencies

You cannot specify this parameter if Create block is either SIL or PIL.

If you do not specify a tool, Configure Coverage appears dimmed. If you specify a tool, click Configure Coverage to open the Code Coverage Settings dialog box.

See Also

Measure task execution time

Specify whether to collect execution time profiles for tasks in generated code

Settings

Default: off

On

Collect measurements of execution times. Data obtained from instrumentation probes added to SIL or PIL test harness.

Off

No measurement of execution times

Dependencies

When you use this parameter, you must also specify a workspace variable. The software uses this variable to collect execution time measurements.

Command-Line Information

Parameter: CodeExecutionProfiling
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

ApplicationSetting
DebuggingOn
TraceabilityOn
EfficiencyOff
Safety precautionOff

See Also

Measure function execution times

Specify whether to collect execution times for functions inside generated code

Settings

Default: off

On

Collect execution times for functions. Data obtained from instrumentation probes placed inside code generated from atomic subsystems and model reference hierarchies.

Off

No execution times collected for functions inside generated code

Dependencies

To use this parameter, you must also select the Measure task execution time check box and specify a workspace variable.

Command-Line Information

Parameter: CodeProfilingInstrumentation
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

ApplicationSetting
DebuggingOn
TraceabilityOn
EfficiencyOff
Safety precautionOff

See Also

Workspace variable

Specify workspace variable that collects measurements and allows viewing and analysis of execution profiles

Settings

Default: executionProfile

When you run simulation, software generates specified workspace variable as an rtw.pil.ExecutionProfile object. To view and analyse execution profiles, use methods from the rtw.pil.ExecutionProfile and rtw.pil.ExecutionProfileSection classes.

Dependency

You can only specify this parameter if you select the Measure task execution time check box. Otherwise the field appears dimmed.

Command-Line Information

Parameter: CodeExecutionProfileVariable
Type: string
Value: any valid string
Default: none

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityAny valid string
EfficiencyNo impact
Safety precautionNo impact

See Also

Save options

Specify whether to save all code profiling measurement and analysis data to base workspace

Settings

Default: Summary data only

Summary data only

Save only code profiling summary data to a rtw.pil.ExecutionProfile in the base workspace. Use this option to limit the amount of data that the software saves to base workspace. For example, if you are concerned that your computer may not have enough memory to store all time measurements for a long simulation. The software calculates metrics for the code execution report as the simulation proceeds, without saving raw data to memory. To view these metrics, use the rtw.pil.ExecutionProfile report method.

All measurement and analysis data

Save all code profiling measurement and analysis data to a rtw.pil.ExecutionProfile object in the base workspace. In addition to viewing the code execution report, this option allows you to analyze data using rtw.pil.ExecutionProfile and rtw.pil.ExecutionProfileSection methods.

Dependency

You can only specify this parameter if you select the Measure task execution time check box. Otherwise the field appears dimmed.

Command-Line Information

Parameter: CodeProfilingSaveOptions
Type: string
Value: 'SummaryOnly' | 'AllData'
Default: 'SummaryOnly'

See Also

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS