Skip to content

annotate.py

Annotates an instruction trace with source-code information.

This script parses a human-readable trace, as generated by CVA6 or Snitch's gen_trace.py script, and annotates every instruction in the trace with information on its originating source-code.

Example output:

    ; snrt_hartid (team.c:14)
    ;  in snrt_cluster_core_idx (team.c:47)
    ;  in main (event_unit.c:21)
    ;  asm("csrr %0, mhartid" : "=r"(hartid));
          80000048  x13=0000000a             # csrr a3, mhartid

By default, the source-code information is interleaved in the same file with the instruction trace. If you prefer to have a side-by-side view, the -d/--diff option can be used. In this case, the tool outputs a (fictitious) diff file which can be fed into a diff visualization tool for side-by-side visualization in a GUI, e.g. kompare -o <diff_file>.