Main Content

Verify AUTOSAR C Code with SIL and PIL

As part of developing AUTOSAR software for the Classic Platform, you can carry out model-based verification of AUTOSAR software components by using software-in-the-loop (SIL) and processor-in-the-loop (PIL) simulations. Use SIL for verification of generated source code on your development computer, and PIL for verification of object code on your production target hardware. For example:

  • You can run a top model that is configured for the AUTOSAR system target file (autosar.tlc) by using the Software-in-the-Loop (SIL) and Processor-in-the-Loop (PIL) simulation modes.

  • You can use Model block SIL or PIL to test AUTOSAR top-model or submodel code:

    • To test an AUTOSAR software component model, use a harness model that references the AUTOSAR component model. In the Model block, set Simulation mode to SIL or PIL and set Code interface to Top model.

    • To test a submodel that is not mapped to AUTOSAR inside an AUTOSAR model, open the AUTOSAR model. In the Model block for the non-AUTOSAR submodel, set Simulation mode to SIL or PIL and set Code interface to Model Reference.

For more information, see Simulation with Top Model (Embedded Coder) and Simulation with Model Blocks (Embedded Coder).

You can create a SIL or PIL block for a component configured for the AUTOSAR system target file. For example:

  1. Open an AUTOSAR software component model.

  2. Open the Configuration Parameters dialog box.

    • In the Hardware Implementation pane, set appropriate properties.

    • In the Code Generation pane, clear the Generate code only option.

    • In the Code Generation > Verification, set advanced parameter Create block to SIL.

  3. To generate code and create a SIL block for the model, enter Ctrl+B.

  4. Add the generated block to a harness model that supplies test vectors or input.

  5. Run simulations with the harness model.

However, SIL and PIL block verification does not support code generated for Simulink Function and Function Caller blocks, for example, in AUTOSAR client-server configurations.

Related Examples

More About