dsp56800e Freescale Semiconductor, Inc, dsp56800e Datasheet - Page 231

no-image

dsp56800e

Manufacturer Part Number
dsp56800e
Description
16-bit Digital Signal Controller Core
Manufacturer
Freescale Semiconductor, Inc
Datasheet
The other bit-manipulation instructions (BFTSTH, BFTSTL, BFCHG, BFCLR, and BFSET) work with a
full 16-bit mask, so no shifting is required.
This unit can optionally be bypassed, passing through a 16-bit mask directly to the 16-bit masking unit.
7.1.2
The 16-bit masking logic selects which of the bits in a 16-bit word will be operated on by the
bit-manipulation unit. Bits that are set to one in the mask are tested when the bit-manipulation operation is
performed. Bits that are set to zero in the mask are ignored.
Example 7-2 demonstrates an instruction that specifies a bit mask. The 4 bits that are set to one, bits 7–4,
are selected by the 16-bit masking unit, and only these 4 bits are tested and then cleared by the
bit-manipulation unit. The result of the test is stored in the status register’s carry bit. All other bits in the
X0 register (bits 15–8 and bits 3–0) are ignored and not modified by this instruction.
Note that bit masks are always specified with the use of an immediate value. The DSP56800E instruction
set does not support mask values in a register.
7.1.3
The 16-bit testing logic tests all bits that are specified in the immediate mask value. It is capable of
determining if the selected bits are either all ones or all zeros. The result of the test is then recorded in the
status register’s carry bit. Based on the instruction used, the testing logic performs the following:
For the BFTSTH, BRSET, BFCHG, BFCLR, and BFSET instructions:
For the BFTSTL and BRCLR instructions:
These testing steps are performed before any modifications are made to the operand (by the BFCHG,
BFCLR, and BFSET instructions). Only the carry bit in the status register is affected.
Freescale Semiconductor
Tests the selected bits for ones
Sets the C bit if all tested bits are one
Clears the C bit if not all tested bits are ones
Tests the selected bits for zeros
Sets the C bit if all tested bits are zero
Clears the C bit if not all tested bits are zeros
16-Bit Masking Logic
16-Bit Testing Logic
BRCLR
BRSET
BRCLR
BFCLR
Example 7-1. Examples of Byte Masks in BRSET and BRCLR Instructions
#$0081,X0,LABEL1; Immediate Mask in lower byte
#$81,X:$3,LABEL1; Immediate Mask in lower byte
#$8100,X0,LABEL1; Immediate Mask in upper byte
#$00F0,X0
Example 7-2. Using a Mask to Operate on Bits 7–4
; Immediate Mask = $00F0
Bit-Manipulation Unit
Bit-Manipulation Unit Overview and Architecture
7-3

Related parts for dsp56800e