TC4x PPU Coverage Analysis

From emmtrix Wiki
Jump to navigation Jump to search

During development of a library for the Infineon AURIX TC4x Parallel Processing Unit (PPU), we had to fulfil safety-critical process requirements (ISO 26262, ASPICE). One key deliverable was proof of structural code coverage for every safety-relevant unit test.

Traditional host-based coverage tools (e.g. gcov, llvm-cov) assume that the code under test can be built and run natively on the host. Because PPU kernels are developed in a C dialect (Vector C Code) containing PPU-specific SIMD instructions, compiling and executing tests on the host was impossible.

We therefore created a coverage workflow that runs the compiled PPU binary inside the PPU simulator.

Simulation-Based Coverage Workflow

Example HTML coverage report for PPU

Unlike classic host-based coverage methods, we do not rely on code instrumentation. Instead, the PPU simulator itself provides detailed trace data of every instruction executed during each test run. This ensures that coverage is measured directly on the final machine code without modifying the binary.

Our implementation utilizes TASKING SmartCode for compiling the PPU code and the Synopsys ARC nSIM Instruction Set Simulator for executing the tests. This setup allows for precise tracking of executed instructions and branches during simulation.

Our coverage process follows a simple three-step workflow:

  1. Record per-test coverage Each unit test is executed inside the PPU simulator, which generates raw coverage data indicating all executed instructions and branches for that single test.
  2. Merge results After all tests have run, we merge the individual coverage data into one consolidated dataset representing the entire project’s coverage.
  3. Generate an HTML report The merged coverage data is converted into a human-readable HTML report, allowing developers and quality engineers to review overall coverage levels and identify untested code areas down to the source line.

This approach ensures that our coverage analysis is:

  • Target-accurate, because it is based on the real PPU machine code
  • Non-intrusive, since it requires no code changes or instrumentation
  • Fully automatable, integrating seamlessly into our CI/CD pipelines
  • Example HTML coverage report for vectorized C code for PPU
    Generically extensible, allowing adaptation to other toolchains and simulators beyond the current setup

See Also

Interested?

Interested in applying this coverage workflow to your own projects?

→ Contact us at emmtrix.com/company/contact.

External Links