Back to the glossary

Embedded and systems

Processor-in-the-loop (PiL)

In processor-in-the-loop testing, the compiled production code runs on the real target processor or an equivalent board, while the environment and plant are still simulated on a PC.

Also known as: PIL testing, processor in the loop

The gap between SiL and HiL

In software-in-the-loop testing, the code runs on the development machine, with a different compiler and a different processor architecture. In hardware-in-the-loop testing, the finished control unit sits on the test bench. PiL lies in between: the code is built with the target compiler and runs on the real microcontroller, but without the complete electronics and without a real-time test bench.

What PiL uncovers

  • Differences caused by the target compiler and its optimisations
  • Fixed-point and rounding effects, data type limits, overflows
  • Execution time and stack usage on the real processor
  • Problems with byte order or memory alignment

How PiL is set up

Typically an evaluation board with the target processor exchanges data with the simulation on the PC through a debug interface such as JTAG or SWD, or a serial link. This often does not run in real time but synchronised step by step.

A common technique is back-to-back testing: the same inputs run through MiL, SiL and PiL, and the results must match within a tolerance.