Rotr - Hitachi SH7750 Programming Manual

High-performance risc engine superh (sh) 32-bit risc mcu/mpu series
Hide thumbs Also See for SH7750:
Table of Contents

Advertisement

10.78

ROTR

One-Bit Right
Rotation
Format
ROTR
Rn
Description
This instruction rotates the contents of general register Rn one bit to the right, and stores the result
in Rn. The bit rotated out of the operand is transferred to the T bit.
Operation
ROTR(long n) /* ROTR Rn */
{
if ((R[n]&0x00000001)==0) T=0;
else T=1;
R[n]>>=1;
if (T==1) R[n]|=0x80000000;
else R[n]&=0x7FFFFFFF;
PC+=2;
}
Example
ROTR
R0
Rev. 2.0, 03/99, page 348 of 396
ROTate Right
Summary of Operation
LSB → Rn → T
MSB
ROTR
;Before execution R0 = H'00000001, T = 0
;After execution
Instruction Code
0100nnnn00000101 1
LSB
R0 = H'80000000, T = 1
Shift Instruction
Execution
States
T
T Bit
LSB

Advertisement

Table of Contents
loading

Table of Contents