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

ID 784383
Date 12/04/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

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=agilex.sdmmc.bank.regs
------------------------------------
Offset   Name     Size       Value    
------------------------------------
  0        CTRL     4          0 
  4        PWREN    4          0
  8        CLKDIV   4          0     
 12        CLKSRC   4          0
 16        CLKENA   4          0
  :
------------------------------------

simics> print-device-regs bank=agilex.sdmmc.bank.regs pattern="CLK*"
------------------------------------
Offset   Name     Size       Value    
------------------------------------
  8        CLKDIV   4          0     
 12        CLKSRC   4          0
 16        CLKENA   4          0
------------------------------------

In the previous capture, you can see some of the registers that are under the agilex.sdmmc.bank.regs bank. Also, it shows how to use the pattern argument to view only registers that starts with CLK 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 agilex.sdmmc.bank.regs.CTRL
[agilex.sdmmc.bank.regs:CTRL]
 
                                     Bits : 32
                                   Offset : 0x0
                                    Value : 0
 
Bit Fields:
                Use_Internal_Dmac[25..25] : 0    "(Read Write)"
                 Enable_Od_Pullup[24..24] : 0    "(Read Write)"
                   Card_Voltage_B[23..20] : 0000 "(Read Write)"
                   Card_Voltage_A[19..16] : 0000 "(Read Write)"
    Ceata_Device_Interrupt_Status[11..11] : 0    "(Read Write)"
              Send_Auto_Stop_Ccsd[10..10] : 0    "(Read Write)"
                          Send_Ccsd[9..9] : 0    "(Read Write)"
                    Abort_Read_Data[8..8] : 0    "(Read Write)"
                  Send_Irq_Response[7..7] : 0    "(Read Write)"
                          Read_Wait[6..6] : 0    "(Read Write)"
                         Dma_Enable[5..5] : 0    "(Read Write)"
                         Int_Enable[4..4] : 0    "(Read Write)"
                          Dma_Reset[2..2] : 0    "(Read Write)"
                         Fifo_Reset[1..1] : 0    "(Read Write)"
                   Controller_Reset[0..0] : 0    "(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:

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 agilex.sdmmc.bank.regs.CTRL
0x0
simics> set-device-reg agilex.sdmmc.bank.regs.CTRL 0x00000AA0
simics> get-device-reg agilex.sdmmc.bank.regs.CTRL
0xaa0
simics> get-device-offset agilex.sdmmc.bank.regs offset=0 size=4
0xaa0 (LE)
simics> write-device-offset agilex.sdmmc.bank.regs offset=0 size=4 0x00000550
simics> read-device-offset agilex.sdmmc.bank.regs offset=0 size=4
0x550 (LE)
simics> read-device-reg agilex.sdmmc.bank.regs.CTRL
0x550

In the previous capture, several read and write operations are being done to the agilex.sdmmc.bank.regs.CTRL register. It started using the set/get commands to write and read back the 0xAA0 value. After this, the read/write commands are used to write and read back the 0x550 value. When using access by offset, the offset is 0x00, which corresponds to the offset value of CTRL in the register bank of the sdmmc device.