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

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

6.3.4. Hardware Access Breakpoints

Intel® Simics® simulator provides the capability to create breakpoints associated with the access of registers in a device. This can be useful to debug target software as you can identify whenever a register or set of registers is accessed. There are several Intel® Simics® simulator commands that you can use for this.

Table 21.  Commands to Create Breakpoints

Command

Description

bp.bank.break Enables breaking the simulation on register bank accesses.
bp.bank.run-until Runs the simulation until the specified register bank access occurs.
bp.bank.trace Enables tracing of register bank accesses. When this is enabled, every time the specified register bank access occurs during simulation, a message is printed.
bp.bank.wait-for Postpones execution of a script branch until the specified register bank access occurs.

These commands allow you to set a breakpoint in a read or write access to a full bank of registers or in single register defined by its name or by its offset. It also allows you to set a breakpoint in accessing a set of registers defined with an address range or when the register gets written to a specific value.

The following capture shows some examples that demonstrate the use of these commands. To exercise these scenarios, the target software must generate read/write accesses to the objects specified in the commands:
#Intel Simics simulator CLI 

# Exercise 1
simics> bp.bank.break system.board.fpga.soc_inst.hps_subsys.agilex_hps.gpio0.bank.regs -r
Breakpoint 1: Will break on read access on system.board.fpga.soc_inst.hps_subsys.agilex_hps.gpio0.bank.regs
simics> r
running> devs agilex.gpio0.bank.regs
-------------------------------------------------------------------------
Count   Device                      Space                  Range
-------------------------------------------------------------------------
    0   system....gpio0...   system....phys_mem  0x10c03200 - 0x10c032ff
-------------------------------------------------------------------------
[system...agilex_hps.gpio0.bank.regs] Breakpoint 1: system...agilex_hps.gpio0.bank.regs read at 
offset=0xfc size=0x4 value=0x0 ini=system...agilex_hps.core[0]

Exercise 1 sets a breakpoint on a read access to any of the registers under the gpio0 device. This creates a breakpoint with the ID 1. The simulation is run and at this point, it is expected that the target software does a read access to a register under this bank (address 0x10c032fc used in this example). After doing the read access, you can observe that the simulation was stopped as a consequence of the breakpoint trigger.

#Intel Simics simulator CLI

# Exercise 2

simics> devs system.board.fpga.soc_inst.hps_subsys.agilex_hps.gpio1.bank.regs
-----------------------------------------------------------------
      Device               Space                   Range
-----------------------------------------------------------------
system...bank.regs  system...phys_mem     0x10c03300 – 0x10c033ff
-----------------------------------------------------------------

simics> print-device-regs system.board.fpga.soc_inst.hps_subsys.agilex_hps.gpio1

------------------------------------------------
Offset      Name                Size      Value
------------------------------------------------
0          GPIO_SWPORTA_DR        4         0
4          GPIO_SWPORTA_DDR       4         0
:
116        GPIO_CONFIG_REG1       4       0x1ff0f2
------------------------------------------------

simics> bp.bank.trace system.board.fpga.soc_inst.hps_subsys.agilex_hps.gpio1.bank.regs register = GPIO_CONFIG_REG1
1
simics> bp.bank.run-until system.board.fpga.soc_inst.hps_subsys.agilex_hps.gpio1.bank.regs register=GPIO_CONFIG_REG1 -w value=0xcafe
simics> bp.bank.run-until system.board.fpga.soc_inst.hps_subsys.agilex_hps.gpio1.bank.regs register=GPIO_CONFIG_REG1 -w value=0xcafe
[bp.bank trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.gpio1.bank.regs read at offset=0x74 size=0x4 value=0x1ff0f2 ini=system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0]
[bp.bank trace] [trace:1] system.board.fpga.soc_inst.hps_subsys.agilex_hps.gpio1.bank.regs write at offset=0x74 size=0x4 value=0xcafe ini=system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0]
simics>
Exercise 2 sets two breakpoints over the GPIO_CONFIG_REG1 register in GPIO1 device (at offset 0x10c03300 in this example):
  • The first one is a trace to detect any read/write operation in the register, this gets an ID of 1.
  • The second breakpoint is set with the run-until command. This breakpoint is configured to trigger on a write operation to the same register with the value 0xcafe.
After this command, the simulation automatically runs in the background and the Intel® Simics® simulator waits for any of the events to occur.

In this example, a read operation to the register is done in the target software followed by the expected write operation. After this, you can see that a couple of messages are printed describing the read and write operations and also the simulation is stopped as a consequence of the last breakpoint.

The command used to set up the breakpoints presented in this section can be called directly over the objects used as argument. For this, the following commands can be used instead:

  1. <object>.regs.bp-break-bank
  2. <object>.regs.bp-run-until-bank
  3. <object>.regs.bp-trace-bank
  4. <object>.regs.bp-wait-for-bank