Nios® V Processor Reference Manual

ID 683632
Date 1/27/2025
Public
Document Table of Contents

3.3.8.2.1. Access Register Command

The Access Register command allows read-write access to the processor registers including GPRs, CSRs, FP registers and Program Counter (dpc in Debug Mode). The Access Register also allows program execution from program buffer. The debugger executes Access Register commands by writing into command register using the Access Register command encoding.
Sequence to execute Access Register Command:
  1. If command.write is 0 and command.transfer is 1, then read data from the register specified by command.regno into the data0.
  2. If command.write is 1 and command.transfer is 1, then write data from the data0 into the register specified by command.regno.
  3. If command.aarpostincrement is 1, increment command.regno.
  4. If command.postexec is 1, execute the Program Buffer.
Figure 9. Accessing Access Register Command
Table 40.  Access Register Command Encoding
Bit Field
31 - 24 23 22 - 20 19 18 17 16 15-0
cmdtype=0 0 aarsize=2 aarpostincrement postexec transfer write regno
Table 41.  Field Description
Field Description
cmdtype 0 indicates Access Register command.
aarsize

2 indicates 32-bit register access.

Others are not applicable in 32-bit Nios® V processor.

aarpostincrement

0: No effect

1: Increment regno after successful register access

postexec

0: No effect

1: Execute program in program buffer

transfer

Acts in conjunction with write field.

0: Ignore value in write field

1: Execute operation specified by write field.

write

0: Copy data from register (Read)

1: Copy data to register (Write)

regno

Register address to be accessed

If the Access Register command fails, the DM stores root causes in the abstractcs.cmderr field. The abstractcs.cmderr field represents the current state of abstract command being executed. If the abstractcs.cmderr field is non-zero, it ignores the writes to the command register. To clear the abstractcs.cmderr field, write 1 for every bit in the field.

Table 42.  cmderr Description
cmderr Description
0 No error.
1 DM is busy.
2 The command is not supported.
3 An exception occurred when executing the command.
4 The processor is not halted.
5 Experiencing bus error.
7 Others

For more information about Access Register command, refer to The RISC-V Debug Specification.