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

ID 784383
Date 7/08/2024
Public
Document Table of Contents

5.4.5. Logging

The Intel® Simics® models generally output log messages for various kinds of events. The log mechanism in Intel® Simics® simulator offers a very powerful system for configuring which log messages to display based on a log level that can be configured to apply to the complete system or focused on a specific object. Depending on the configuration, the result may generate large volumes of output, and because of this, you must be cautious about the configuration used. Also, there are options that allow us to capture the log into files for later inspection, as well as used in scripts to stop Intel® Simics® simulation or take other actions when a log message appears.

The log-setup command is used to display current logging configuration or change the configuration. There are many arguments that this command can receive and in the following sections, you can review some of them.

When calling the log-setup command without any argument, this displays the overall logging system configuration. The following capture shows an example of calling this command:

# Intel Simics simulator CLI
 
simics> log-setup
Time stamp      : disabled
Picoseconds     : disabled
Real time       : disabled
Log to console  : enabled
Include group   : disabled
Include level   : disabled
Log file        : (disabled)

The description of these settings is the following:

Table 14.   log-setup Command Settings
Parameter Description Enable/Disable
Object If provided, the log setup applies to the object selected. If not provided the setup is done over the full system.
Time stamp If enabled, the log output includes virtual time stamps: the name of the current processor, its current program counter value, and its current cycle count. [-time-stamp]
[-no-time-stamp]

Picoseconds

If enabled, the log output includes virtual time stamps in picoseconds. [-pico-seconds]
[-no-pico-seconds]
Real time If enabled, the output includes wall clock time stamps. [-real-time]
[-no-real-time]
Log to console If enabled, the output is displayed in the Intel® Simics® simulator CLI. [-console]
[-no-console]
Include group If enabled, the log group is part of the output. [-group]
[-no-group]
Include level If enabled, the log level is part of the output. [-level]
[-no-level]
Log File [logfile]
[-no-log-file]

The format of the log-setup command is the following:

log-setup [object] [-time-stamp] [-no-time-stamp] [-pico-seconds] 
[-no-pico-seconds] [-real-time] [-no-real-time] [-console] [-no-console]
[-group] [-no-group] [-level] [-no-level] [logfile = filename] [-no-log-file]

The following example shows an example of how this command is being used:

# Intel Simics simulator CLI

simics> log-setup system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox -time-stamp -pico-seconds -real-time -group -level logfile = sdmMB.log

simics> log-setup system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox
Time stamp      : enabled
Picoseconds     : enabled
Real time       : enabled
Disassemble     : disabled
Log to console  : enabled
Include group   : enabled
Include level   : enabled
Log file        : sdmMB.log

simics> log-level system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox 4
[system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox] Changing log level: 1 -> 4

simics> r
[system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox info Default_Log_Group 4] 
{system.board.fpga.soc_inst.hps_subsys.agilex_hps.core[0] 0x0 1} [19:00:11.0658] {5000 ps} SDM BB fuses cache reset
:
:
simics> ls
.cproject     .project    .settings       artifactory
 compiler.mk  doc         modules         sdmMB.log   simics-eclipse
:
:      

The above example shows that log-setup command is being called to configure the logging for the system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox device. Here, the command is enabling all the flags and also saving the log file into the sdmMB.log file in the host system file system. Note that after running the simulation some messages are printed in the CLI (because Log to console parameter is enabled by default). The printed messages from the system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox includes all the components that were enabled when calling the log-setup command. The capture also shows that the sdmMB.log file was created as expected.

Something additional to note from the previous capture is the calling of the log-level command. This command is used to get or set the log level of an object or set of objects. The syntax of this command is the following:

log-level [object] [level] [-all] [-r]

The level argument indicates the new log level requested for the object defined as argument. If the -all parameter is provided, the log level applies globally for all the objects in the system. If -r argument is provided, the log level is applied recursively to all the objects under the object hierarchy.

The log messages to be printed are those which have a log level less than or equal to the ones configured on the object. In the above example, the messages to be printed are messages with log level below or equal to 4.

The log messages also can be classified by type, depending on the nature of the message. The types to be classified are:

Table 15.  Types of Log Messages
Type Description
“info" Use this type for harmless information or debug messages.
“error” Use when an error prevents the simulation from running properly. This type does not have any log-level.
“spec-viol” Use when a target program runs a command that violates the device specification.
“unimpl” Use when a model does not implement a specific functionality, bit, or register.
“critical” Use for signaling serious errors that a model may not be able to resume from. The simulation is stopped.

Similarly, like log levels, you can configure which log types to display on each object. To set this log type to an object, you can use the log-type command with the following syntax:

log-type [object] [-enable|-disable] ["log-type"] [all] [-r]

If the command is called without parameters, it lists the log type set in all the objects in the system. If the command is called providing only an object, it displays the log type for the object provided. If you want to change the log type for a specific object, you must provide the log type as [log-type] argument. An object can have more than one type, so all the messages that match these types are printed. You can use -enable and -disable flags to add and remove a single log type. If you use all argument, all the log types are applied to the object. The -r flag can be used to apply the log type to object recursively under the object provided.

The following is an example of how you can use the log-type command:

# Intel Simics simulator CLI

simics> log-type system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox
system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox:
enabled log types: "info" "error" "spec-viol" "unimpl" "critical"
disabled log types: 
agilex.sdm_mailbox.bank:
enabled log types: "info" "error" "spec-viol" "unimpl" "critical"
disabled log types:
:
simics> log-type -r system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox info
system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox:
enabled log types: "info"
disabled log types: "error" "spec-viol" "unimpl" "critical"
agilex.sdm_mailbox.bank:
enabled log types: "info"
disabled log types: "error" "spec-viol" "unimpl" "critical"
:
simics> log-type -r system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox -enable error
system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox:
enabled log types: "info" "error"
disabled log types: "spec-viol" "unimpl" "critical"
agilex.sdm_mailbox.bank:
enabled log types: "info" "error"
disabled log types: "spec-viol" "unimpl" "critical"
:
simics> log-type -r system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox -disable error
system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox:
enabled log types: "info"
disabled log types: "error" "spec-viol" "unimpl" "critical"
agilex.sdm_mailbox.bank:
enabled log types: "info"
disabled log types: "error" "spec-viol" "unimpl" "critical"

simics> log-level system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox 4 -r
[system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox] Changing log level recursively: 1 -> 4

simics> r
[agilex.sdm_mailbox info] SDM BB fuses cache reset
[system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox.bank.regs info] Write 
to register regs.FLAGS (addr 0xffa3000c) <- 0x00000103
[system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox.bank.regs info] Write 
to register regs.URG (addr 0xffa30008) <- 0x00000000
[system.board.fpga.soc_inst.hps_subsys.sdm.sdm_mailbox.bank.regs info] Write 
to register regs.DOORBELL_TO_HPS (addr 0xffa30480) <- 0x00000000
:
:

The log-level and log-type commands can also be applied directly over the object using the following format:

<object>.log-level 
<object>.log-type