CLB

CLB

Count Leading Bits (DALU)

CLB

Operation

Assembler Syntax

If Da[39] == 0,

CLB Da,Dn

then 9 – (number of consecutive leading zeros in Da[39:0])

→ Dn

else 9 – (number of consecutive leading ones in Da[39:0]) → Dn

Description

CLB Da,Dn

Counts the leading 0s or 1s according to bit 39 of source Da. It scans bits [39:0] of Da starting from bit 39. The operation loads nine minus the number of consecutive leading 0s or 1s into destination Dn. The result is sign-extended. The range of the result is +8 to –31. This instruction can be used in conjunction with the instruction ASRR for performing fast normalization of the operand. If Da equals zero, then Dn is set to zero.

Status and Conditions that Affect Instruction

None.

Status and Conditions Changed by Instruction

Register Address

Bit Name

Description

Ln

L

Clear the Ln bit in the destination data register.

Example

clb d3,d7

Register/Memory Address

D3

L7:D7

BeforeAfter

$00000 F7434

$0:$FF FFFF FFF5

The number of consecutive zeros is 20, 9 - 20 = -11 ($FFF5)

SC140 DSP Core Reference Manual

A-113

Page 427
Image 427
Freescale Semiconductor SC140 specifications Count Leading Bits Dalu, Clb d3,d7, CLB Da,Dn