Main Content

Code Verification Through Software-in-the-Loop and Processor-in-the-Loop Execution

MATLAB® Coder™ supports software-in-the-loop (SIL) and processor-in-the-loop (PIL) execution, which enables you to verify production-ready source code and compiled object code. With these execution modes, you can reuse test vectors developed for your MATLAB functions to verify the numerical behavior of library code.

In SIL execution, through a MATLAB SIL interface, the software compiles and runs library code on your development computer. In PIL execution, through a MATLAB PIL interface, the software cross-compiles and runs production object code on a target processor or an equivalent instruction set simulator. Before you run a PIL execution, you must set up a PIL connectivity configuration for your target.

The workflow for generating and verifying code is:

  1. Set up MATLAB Coder.

  2. Fix errors detected at design time.

  3. Generate MEX function.

  4. Test MEX function.

  5. Generate C/C++ library code.

  6. Verify generated C/C++ code through SIL or PIL execution — requires Embedded Coder® license.

In step 4, you verify code that is generated for execution within MATLAB. However, this code is different from the standalone code generated for libraries. In step 6, with an Embedded Coder license, you use SIL or PIL execution to verify the standalone code.

For more information, use the following table.