Operations:

Format

Syntax:

Operation:

Operands:

Architecture revision

Opcode

1

mtsr SystemRegisterAddress, Rs

SystemRegister[SystemRegisterAddress << 2] = Rs;
SystemRegisterAddress  ∈ {0, 4, 8, ..., 1020}

Rev1+

111000111011

Rs

00000000

SystemRegisterAddress

12

4

8

8

Description

The instruction copies the value in the specified register to the specified system register. Note that special timing concerns must be considered when operating on the system registers, see the Implementation Manual for details.

Status Flags:

Q:

Not affected.

V:

Not affected.

N:

Not affected.

Z:

Not affected.

C:

Not affected.

Note:

Some system registers are implementation defined. If writing a system register that does not exist, or to a register that is read only, the instruction is executed but no registers are updated.

With the exception of accessing the JECR and JOSP system registers, this instruction can only be executed in a privileged mode. Execution from any other mode will trigger a Privilege Viola- tion exception. JECR and JOSP can be accessed from all modes with this instruction.

The instruction mtsr JOSP, Rx must be used with care. The programmer must ensure that no change of flow instruction nor an INCJOSP instruction follows mtsr JOSP, Rx within a number of instructions. This number of cycles is implementation defined. It should also be noted, that this is true even if the instructions are not to be executed. For instance the sequence

mtsr JOSP, Rx retj incjosp

will execute with an incorrect result. In practice this warning will only affect programmers writing their own Java Virtual Machine based on the AVR32 Java Extension module.