188
MicroBlaze Processor Reference Guide
UG081 (v14.7)
Chapter 5:
MicroBlaze Instruction Set Architecture
clz
Count Leading Zeros
Description
This instruction counts the number of leading zeros in register rA starting from the most significant
bit. The result is a number between 0 and 32, stored in register rD.
The result in rD is 32 when rA is 0, and it is 0 if rA is 0xFFFFFFFF.
Pseudocode
n
←
0
while (rA)[n] = 0
n
←
n + 1
(rD)
←
n
Registers Altered
•
rD
Latency
•
1 cycle
Notes
This instruction is only available when the parameter
C_USE_PCMP_INSTR
is set to 1.
clz
rD, rA
Count leading zeros in rA
1 0 0 1 0 0
rD
rA
0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0
0
6
1
1
1
6
2
1
3
1