reg

Reads and writes registers.

Syntax

reg export <reg-spec> [<n>] <file>

reg export <file>

reg import <file>

reg <reg-spec> [<n>] [-{d|nr|nv|np} ...] [-s|-ns] [%<conv>]

reg <reg-spec>{..<reg>|#<n>} [-{d|nr|nv|np} ...] [-s|-ns] [%<conv>]

reg all|r:|nr: [-{d|nr|nv|np} ...] [-s|-ns] [%<conv>]

reg <reg-spec> [<n>] [-s|-ns] [%<conv>] =<value>

reg <reg-spec>{..<reg>|#<n>} [-s|-ns] [%<conv>] =<value>

reg -regset

reg

Options

The following table lists and defines options of the reg command.

Table 1. reg Command-line debugger command - Options
Command Description
export Exports all or a set (specified through <reg-spec> [<n>]) of registers into a specified file. The traversal of the register hierarchy is recursive. Existing files are overwritten.
import Imports registers from a specified file.
[none] No option is equivalent to reg -regset .
<reg-spec> [{r|nr}:]<reg> {r|nr} If multiple registers are specified, then the prefix r: causes a recursive, depth-first traversal of the register hierarchy. The prefix nr: prevents recursion. If unspecified, recursion is the default. Note that different levels of the register hierarchy are represented in the manner of a path with forward-slashes '/' used to delimit the register groups. A name that contains a slash itself can be represented with an escape backward-slash '\' followed by the forward-slash. Further note that a backslash in a doubly-quoted Tcl string is itself an escape character -- in this case two backslashes are required. Alternatively, you may use curly braces '{' and '}' to denote your string in which case just one backslash is necessary.
<reg> A register name or a register group name.
..<reg> The end point for a range of registers to access.
<n> Number of registers.
all Specifies all registers.
-d Print detailed data book information.
-nr Print only register group, that is no registers.
-nv Print only register groups and register names, that is no values.
-np Do not print anything to the display, only return the data.
regset Display the register group hierarchy.
-s| -ns Specifies whether each value is to be swapped. For memory, specifies whether each cell is to be swapped. With a setting of -ns, target memory is written in order from lowest to highest byte address. Otherwise, each cell is endian swapped. If unspecified, the setting "config MemSwap" is used.
%<conv> Specifies the type of the data. Possible values for <conv> are given below. The default conversion is set by the radix command for memory and registers and by the config var command for variables.
%x Hexadecimal
%d Signed decimal.
%u Unsigned decimal.
%f Floating point.
%[Q<n>]F Fixed or fractional. The range of a fixed point value depends on the (fixed) location of the decimal point. The default location is set by the config command option MemFixedIntBits .
%s ASCII
Examples

The following table lists and defines examples of the reg command.

Table 2. reg Command-line debugger command - Examples
Command Description
reg -regset Lists all the available register sets on the target chip.
reg R1 Displays the value of register R1.
reg "General Purpose Registers/R1" Displays value of register R1 in the General Purpose Register group.
reg R1 -d Displays detailed "data book" contents of R1, including bitfields and definitions.
reg "nr:General Purpose Registers/R1" 25 Beginning with register R1, display the next 25 registers. Register groups are not recursively searched.
reg R1 =123 Changes register R1 to 0x123 .
reg R1..R5 =5432 Changes registers R1 through R5 to 0x5432 .
reg "General Purpose Registers/R1" =100 Changes register R1 in the General Purpose Register group to 0x100 .
reg export filename Exports all registers from the target to the specified file.
reg export R1 filename Exports the value of register R1 to the specified file.
reg export "General Purpose Registers/R1" 25 filename Beginning with register R1, export the next 25 registers to the specified file.
reg import filename Imports registers from the specified file.