5.5.2 References to variables

References to variables generally have the following syntax:

%{varname[optional_bitrange]optional_format_spec}

Note:

The percentage sign %, braces {…}, and square brackets […] shown here are literal characters. In the rest of this topic, square brackets are used to indicate optional components.

varname

The set of defined variable names depends on the context in which the format string is returned. It might also be possible to access fields of sibling objects, in which case varname can contain dots as hierarchy level separators.

optional_bitrange

If this is included, the specified bits are extracted from the numeric variable, or the specified characters are extracted from a string variable. The syntax of optional_bitrange is:

range[.range]…

Where range is either:

pos
Extract a single bit at pos.
msb:lsb
Extract the range of bits from MSB to LSB, where msb >= lsb.

pos, msb, and lsb are positive decimal numbers. The dot is a literal character that separates multiple ranges.

optional_format_spec

The default is :x for numeric types and :s for strings. The syntax is:

:[width][.precision][format_char]

Or:

:(enum_spec[|enum_spec]…)

Where:

width
The minimum number of characters to be printed for a number or for a string. Unused leading characters are filled with zeros for x and b and with spaces for d and u. If width is less than zero, the value is left-adjusted and the rightmost characters are filled with spaces.
precision
For e, f, and g, the number of precision digits. For s, the maximum number of characters to print.
format_char
Specifies the format in which values are printed. It can be one of the following:
xHexadecimal, without the leading 0x. The client decides whether to use uppercase or lowercase hex, the guideline is lowercase.
dSigned decimal. Either a minus sign for negative numbers or no sign.
uUnsigned decimal.
bBinary.
eScientific notation.
f and gFloating-point number. The value must be exactly 32 bits or 64 bits wide.
yExact symbol lookup. The value is looked up in the symbol table, with an exact match, but see the note following this list. If found, this is replaced by the symbol name. If not found, this is replaced by the hexadecimal value with a leading 0x.
YLower bound symbol lookup. The value is looked up in the symbol table, searching for the symbol that has the highest value that is less than or equal to the value of the specified symbol, see the note following this list. If found, which is usually the case, this is replaced by symbol_name+offset_in_hex or just symbol_name on an exact match. If not found, this is replaced by the hexadecimal value with a leading 0x.
sString. Can only be used for string types.

Note:

Some contexts might require the lower bits of an address to be masked out, depending on the target instance and the symbol type, for example ignoring bit[0] for Arm® cores.
enum_spec
Instead of displaying the numeric value, display literal text. The format of enum_spec is:
text[=number]
This allows you to specify dense or sparse enum symbols for numeric values. The counting of non-explicit enum numbers follows the C rules, starting at zero, and uses last_number+1 if no number is specified.

To output a literal %, use two percentage signs, %%. In addition, all percentage signs that are not followed by either { or [ are treated as a literal %. Enum strings cannot contain the | or ) characters.

Errors might occur if names are undefined, or if objects return an error when being read. In this case, the reference should be replaced with (error: <reason>).

Examples

%{mode} -> Display variable 'mode' in hex according to its bitwidth.
%{fifo_len:u} -> Display variable as unsigned decimal integer.
%{address:4x} -> Display address as hex integer with 4 digits for N < 2**16 and > 4 digits for bigger values
%{perm:(---|--x|-w-|-wx|r--|r-x|rw-|rwx)} -> Display permissions as 'rwx' field.
%{status[7:0]} -> Display 2 hex digits for the 8-bit value taken from bits[7:0].
%{status[7:0.15:12]} -> Display 3 hex digits for the 12-bit value taken from bits[7:0] as msb and bits[15:12] as lsb
%{pc:y} -> Display symbol.
Non-ConfidentialPDF file icon PDF version101196_0100_03_en
Copyright © 2018, 2019 Arm Limited or its affiliates. All rights reserved.