5.5.3 Conditional formatting

In some cases, the formatting of a variable might depend on the value of one or more bits in that variable or in another variable.

This can be expressed with the map statement:

%[map|varname[optional_bitrange]|default|key1=format1[|key2=format2]…]

The variable is replaced with either the default or any of the specified formats. It is replaced with the format that is defined for a specific numeric value (key) if the variable has this numeric value. If the variable has a value that is not listed in the mapping, then it is replaced with the default. default and all specified formats might in turn contain map statements and variable references. default and the formats might contain literal = characters.

For example, this statement prints either a 10-bit index or a 20-bit address in the status register, depending on bit[31] in the status register:

%[map|status[31]||0=index=status[11:2]|1=address=status[19:0]]
Non-ConfidentialPDF file icon PDF version101196_0100_03_en
Copyright © 2018, 2019 Arm Limited or its affiliates. All rights reserved.