Lmbd, Leftmost bit detection lmbd – Texas Instruments TMS320C67X/C67X+ DSP User Manual
Page 201
![background image](/manuals/208542/201/background.png)
Leftmost Bit Detection
LMBD
3-141
Instruction Set
SPRU733
Leftmost Bit Detection
LMBD
Syntax
LMBD (.unit) src1, src2, dst
.unit = .L1 or .L2
Compatibility
C62x, C64x, C67x, and C67x+ CPU
Opcode
31
29
28
27
23
22
18
17
13
12
11
5
4
3
2
1
0
creg
z
dst
src2
src1/cst5
x
op
1 1 0 s p
3
1
5
5
5
1
7
1
1
Opcode map field used...
For operand type...
Unit
Opfield
src1
src2
dst
uint
xuint
uint
.L1, .L2
110 1011
src1
src2
dst
cst5
xuint
uint
.L1, .L2
110 1010
Description
The LSB of the src1 operand determines whether to search for a leftmost 1 or 0
in src2. The number of bits to the left of the first 1 or 0 when searching for a 1
or 0, respectively, is placed in dst.
The following diagram illustrates the operation of LMBD for several cases.
1
1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
x
0 1 x x x x x x
x x x x x x x x x x x x x x x
x
x
x x
x
x
x
x
x x x x x x x
0
0
0
x x
x
0
1
x
x x x x x x x x
x
x
x
x
x
x
x
x
When searching for 1 in src2, LMBD returns 4:
When searching for 0 in src2, LMBD returns 32:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8
7 6
5 4
3
2 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8
7 6
5 4
3
2 1 0
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8
7 6
5 4
3
2 1 0
When searching for 0 in src2, LMBD returns 0: