Main Content

Verify AUTOSAR Code with SIL and PIL

As part of developing AUTOSAR software, you can carry out code 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.

Through behavioral and structural comparisons, code verification demonstrates the equivalence between a component model and its generated code. You can:

  • Test numerical equivalence between your component model and generated code by comparing normal mode simulation results against SIL or PIL simulation results.

  • Show the absence of unintended functionality by comparing model coverage against code coverage or performing a traceability analysis.

    • Configure SIL and PIL simulations to generate code coverage metrics.

    • Generate reports that provide bidirectional traceability between model objects and generated code.

With AUTOSAR models, you run SIL and PIL testing by configuring either the top model or Model blocks.

  • For unit-level testing of an AUTOSAR software component, use top model SIL or PIL. You can test a top model that is configured for the AUTOSAR system target file (autosar.tlc) by setting the simulation mode to Software-in-the-Loop (SIL) or Processor-in-the-Loop (PIL).

  • Use Model block SIL or PIL for unit-level testing of a subcomponent referenced from an AUTOSAR software component configured for the AUTOSAR system target file (autosar.tlc). In the Model block for the submodel, set Simulation mode to SIL or PIL and set Code interface to Model reference.

  • Use Model block SIL for unit-level testing of subcomponents referenced from an AUTOSAR software component configured for the AUTOSAR adaptive system target file (autosar_adaptive.tlc). In the Model block for the submodel, set Simulation mode to SIL and set Code interface to Model reference.

    Note

    Model block PIL is not supported for components and subcomponents referenced from an AUTOSAR software component configured for the AUTOSAR adaptive system target file (autosar_adaptive.tlc).

  • For composition-level testing of multiple AUTOSAR software components, reference the component models in a composition, architecture, or test harness model. In the Model block for each component under test, set Simulation mode to SIL or PIL and set Code interface to Top model.

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

If you have Simulink® Test™ software, you can use test harnesses to:

Related Examples

More About