
C
19
0
MSB
0
0
0
0
0
0
0
7
15
0
0
0
0
0
LSB
C
19
0
MSB
0
0
0
0
15
LSB
Instruction Set Description
4.6.2.40 RRA
RRA[.W]
Rotate right arithmetically destination word
RRA.B
Rotate right arithmetically destination byte
Syntax
RRA.B dst
or
RRA.W dst
Operation
MSB
→
MSB
→
MSB–1
→
... LSB+1
→
LSB
→
C
Description
The destination operand is shifted right arithmetically by one bit position as shown in
. The MSB retains its value (sign). RRA operates equal to a signed division
by 2. The MSB is retained and shifted into the MSB–1. The LSB+1 is shifted into the
LSB. The previous LSB is shifted into the carry bit C.
Status Bits
N:
Set if result is negative (MSB = 1), reset otherwise (MSB = 0)
Z:
Set if result is zero, reset otherwise
C:
Loaded from the LSB
V:
Reset
Mode Bits
OSCOFF, CPUOFF, and GIE are not affected.
Example
The signed 16-bit number in R5 is shifted arithmetically right one position.
RRA
R5
; R5/2 -> R5
Example
The signed RAM byte EDE is shifted arithmetically right one position.
RRA.B
EDE
; EDE/2 -> EDE
Figure 4-40. Rotate Right Arithmetically RRA.B and RRA.W
173
SLAU272C – May 2011 – Revised November 2013
CPUX
Copyright © 2011–2013, Texas Instruments Incorporated