Intel® Simics® Simulator for Intel® FPGAs: User Guide

ID 784383
Date 4/01/2024
Public
Document Table of Contents

6.3.6. Tracing Breakpoints

Tracing is a way to observe what is going on during the simulation. The Intel® Simics® simulator breakpoint manager includes tracing functionality for several types of events. This means that messages (in fact, Intel® Simics® simulator log messages) are printed when an event of the specified occurs. Such a sequence of messages is what is here is known as a trace. Next are shown some examples on how the trace functionality can be used.

#Intel Simics simulator CLI

simics> bp.control_register.trace -all  
1
simics> bp.list
-------------------------------------------------------------------------
ID  Description                Enabled  Oneshot  Ignore Count   Hit Count
-------------------------------------------------------------------------
1   system...core[0] break     true    false           0           0
    on R/W of any register
-------------------------------------------------------------------------

simics> r 100
Processor system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] is disabled - may take a long time to finish.
[bp.control_register trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] read of currentel
[bp.control_register trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] read of scr_el3
[bp.control_register trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] scr_el3 <- 0xf
[bp.control_register trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] cptr_el3 <- 0x0
[bp.control_register trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] read of currentel
[bp.control_register trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] cntfrq_el0 <- 0x17d78400
[bp.control_register trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] read of midr_el1
[bp.control_register trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] read of midr_el1

simics> bp.delete -all

simics> bp.memory.trace address = 0x0 length = 0x1000 -r

simics> bp.list
----------------------------------------------------------------------------
ID  Description                   Enabled  Oneshot  Ignore Count   Hit Count
----------------------------------------------------------------------------
2    system.cell_context          true     false        0             0
     break matching (addr=0x0,
     len=4096, access=r)
----------------------------------------------------------------------------

simics> r
[bp.memory trace] [trace:1] system.cell_context 'r' access to v:0x138 len=8
[bp.memory trace] [trace:1] system.cell_context 'r' access to v:0x554 len=4
[bp.memory trace] [trace:1] system.cell_context 'r' access to v:0x558 len=8
[bp.memory trace] [trace:1] system.cell_context 'r' access to v:0x560 len=8
[bp.memory trace] [trace:1] system.cell_context 'r' access to v:0x568 len=8
[bp.memory trace] [trace:1] system.cell_context 'r' access to v:0x570 len=8

In the above example, the following actions are being executed:

  • A trace breakpoint is being configured to detect any change in any of the CPU control registers. The core can be selected using the psel command. In this case, the current CPU selected was core0. You can see that this breakpoint trace received the ID 1, and this can be seen in the list of breakpoints using the bp.list command.
  • The trace output are log messages and can be controlled with the log-setup command. For example, each message can be prepended with a time stamp, indicating the processor, program counter and the cycle count at the point where the event occurred.
  • The simulation is run for 100 steps. Here, you can see that some control registers have been accessed and some trace messages have been printed in the Intel® Simics® simulator CLI.
  • All the breakpoints are deleted as preparation of the setup of the next trace breakpoint.
  • A new trace breakpoint is being configured to report a message on any read access to address range 0x0000-0x1000. This gets an ID = 2, which is observed using the bp.list command.
  • The simulation is run again, and the target software is commanded to do a memory read to address 0x000. After this, the new trace messages are displayed in the Intel® Simics® simulator CLI.

Several other types of events can also be traced, such as target console string output and hits at specific source code lines. The trace over source code lines is described later in this document as this requires using a symbol file to provide information to the debugger about the source code.