Motorola MPC823e Reference Manual page 1276

Microprocessor for mobile computing
Table of Contents

Advertisement

MPC823e Instruction Set—rlwinm
rlwinm
Assembler Syntax
BIT
0
1
2
FIELD
21
BIT
16
17
18
FIELD
SH
Definition
Operation
Description
Description
B-118
rlwinm
rA,rS,SH,MB,ME (Rc = 0)
rlwinm.
rA,rS,SH,MB,ME (Rc = 1)
3
4
5
6
7
19
20
21
22
23
MB
Rotate Left Word Immediate then AND with Mask
← SH
n
r ← ROTL(rS,
)
n
m ← MASK(MB, ME)
rA ← r & m
The contents of rS are rotated left the number of bits specified
by operand SH. A mask is generated having 1 bits from bit MB
through bit ME and 0 bits elsewhere. The rotated data is ANDed
with the generated mask and the result is placed into rA.
rlwinm can be used to extract, rotate, shift, and clear bit fields
using the methods shown below:
To extract an n field, that starts at bit position b in rS,
right-justified into rA (clearing the remaining 32 – n bits
of rA), set SH = b + n, MB = 32 – n, and ME = 31.
To extract an n field, that starts at bit position b in rS, left-
justified into rA (clearing the remaining 32 – n bits
of rA), set SH = b, MB = 0, and ME = n – 1.
To rotate the contents of a register left (or right) by n bits,
set SH = n (32 – n), MB = 0, and ME = 31.
To shift the contents of a register right by n bits, by setting
SH = 32 – n, MB = n, and ME = 31. It can be used to clear
the high-order b bits of a register and then shift the result
left by n bits by setting SH = n, MB = b – n and
ME = 31 – n.
To clear the low-order n bits of a register, by setting
SH = 0, MB = 0, and ME = 31 – n.
MPC823e REFERENCE MANUAL
8
9
10
11
12
S
24
25
26
27
28
ME
13
14
15
A
29
30
31
RC
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents