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

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

5.4.3.2. Inspecting Device Registers

Intel® Simics® simulator provides several commands that allow you to inspect status and configuration registers in a device.

The print-device-regs command allows you to obtain information about the registers in a device bank. The syntax of this command is the following:

print-device-regs bank [pattern] [-s]

The bank argument can be either a device or a bank object (i.e., device.bank.<bank-name> ). If this argument is a device, the register information of all banks in the device are listed. The pattern argument is used as a filter to show only the registers that match the pattern provided. The register information is listed starting from the lower register offset, but the -s argument can be used to list the register alphabetically.

The following is a capture of the Intel® Simics® simulator console showing some examples of using the print-device-regs command:

# Intel Simics simulator CLI  
simics> print-device-regs bank=system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.regs
------------------------------------
Offset   Name     Size     Value    
------------------------------------
0x0      HRS00     4      0x10000
0x4      HRS01     4      0x32
0x8      HRS02     4      0x30000
0xc      HRS03     4      0x0
0x10     HRS04     4      0x2000
:                         0x28000001
------------------------------------

simics> print-device-regs bank=system.board.fpga.soc_
inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank pattern="SRS*"
------------------------------------
Offset   Name     Size    Value    
------------------------------------
0x200    SRS00     4      0x0
0x204    SRS01     4      0x47200
0x208    SRS02     4      0x0
0x20c    SRS03     4      0xclb0033
:     
------------------------------------

In the previous capture, you can see some of the registers that are under the system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.regs bank. Also, it shows how to use the pattern argument to view only registers that starts with SRS prefix. In both examples, you can see the offset, the size, and current value of the register.

You can also get detailed information about a specific register. For this, use the print-device-reg-info command to view information about all fields that integrate this register, including its name, range/width in bits, access type (R/W, RO, and so on), and value. The following is the register syntax:

print-device-reg-info register

The register argument is the register path (device.bank.register) for which you want to obtain the information. The following capture of the Intel® Simics® simulator console shows an example of how the print-device-reg-info command is being used:

# Intel Simics simulator CLI 
simics> print-device-reg-info  system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank.SRS03
 [system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank.SRS03]

                     Bits : 32
                   Offset : 0x20c
                    Value : 203096115 (0x0c1b0033)

Bit Fields:
    Reserved_15 @ [31:30] : 00      "(Read Only)"
           Cidx @ [29:24] : 001100  "(Read Write)"
             Ct @ [23:22] : 00      "(Read Write)"
            Dps @ [21:21] : 0       "(Read Write)"
           Cice @ [20:20] : 1       "(Read Write)"
          Crcce @ [19:19] : 1       "(Read Write)"
            Scf @ [18:18] : 0       "(Read Write)"
            Rts @ [17:16] : 11      "(Read Write)"
      Reserved_8 @ [15:9] : 0000000 "(Read Only)"
              Rid @ [8:8] : 0       "(Read Write)"
             Rece @ [7:7] : 0       "(Read Write)"
             Rect @ [6:6] : 0       "(Read Write)"
             Msbs @ [5:5] : 1       "(Read Write)"
             Dtds @ [4:4] : 1       "(Read Write)"
              Ace @ [3:2] : 00      "(Read Write)"
              Bce @ [1:1] : 1       "(Read Write)"
             Dmae @ [0:0] : 1       "(Read Write)"

There is a list of commands that are recommended to access registers in devices. These commands can be classified into the following categories depending on the action and side effects:

  • Target register: Describes how the register to access is indicated. It can use a register name or an offset. The argument for each of these two cases is as follows:
    • By register name:
      <command> reg_name device.bank.regs.<reg_name>) [field]
    • By offset:
      <command> bank(device.bank.regs) offset=<offset> size=<size> 

    In case of “By offset” operation, the offset corresponds to the offset of the register in the bank indicated and the size corresponds to the number of bytes to access in the register.

  • Operation Direction: Describes if the operation to the register is read or write. In the case of write operations, the value to be written in the register is an additional argument to be provided to the command.
    • Side effects: This classification implies that the command can be non-intrusive or not. In the case of having side effects, the write or read operation can create undesired effects in the simulation, such as the trigger of interrupt or exception.

The following table lists commands that can be called:

Table 13.  Commands to Inspect Device Registers
Operation Direction Target Register Commands
No Side Effects Side Effects
Write By Name set-device-reg write-device-reg
By Offset set-device-offset write-device-offset
Read By Name get-device-reg read-device-reg
By Offset get-device-offset read-device-offset

The following Intel® Simics® simulator console capture shows an example on how you can use some of the above commands:

# Intel Simics simulator CLI

simics> get-device-reg system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank.SRS03
0xc1b0033

simics> set-device-reg system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank.SRS03 0xFF

simics> get-device-reg system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank.SRS03
0xff

simics> get-device-offset system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank offset = 0x20c size=4
0xff (LE)

simics> write-device-offset system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank offset = 0x20c size=4 0xCC

simics> read-device-offset system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank offset = 0x20c size=4
0xcc (LE)

simics> read-device-reg system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank.SRS03
0xcc

In the previous capture, several read and write operations are being done to the system.board.fpga.soc_inst.hps_subsys.agilex_hps.sdmmc.bank.sdmmc_bank.SRS03 register. It started using the set/get commands to write and read back the 0xFF value. After this, the read/write commands are used to write and read back the 0xCC value. When using access by offset, the offset is 0x20C, which corresponds to the offset value of SRS03 in the register bank of the sdmmc device.