Rotcr - 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.76

ROTCR

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

Advertisement

Table of Contents
loading

Table of Contents