Download Fixed-Point Blockset User's Guide

Transcript
Bitwise Operator
Purpose
10Bitwise Operator
Library
Bits
Description
The Bitwise Operator block is a masked S-function that performs the specified
bitwise operation on its operands.
Perform the specified bitwise operation on the inputs
Unlike the logic operations performed by the Logical Operator block, bitwise
operations treat the operands as a vector of bits rather than a single number.
You select the bitwise Boolean operation with the Operator parameter list.
The supported operations are given below.
Operation
Description
AND
TRUE if the corresponding bits are all TRUE
OR
TRUE if at least one of the corresponding bits is TRUE
NAND
TRUE if at least one of the corresponding bits is FALSE
NOR
TRUE if no corresponding bits are TRUE
XOR
TRUE if an odd number of corresponding bits are TRUE
NOT
TRUE if the input is FALSE (available only for single input)
Unlike Simulink’s Bitwise Logical Operator block, the Bitwise Operator block
does not support shift operations. Refer to “Shifts” on page 4-41 to learn how to
perform shift operations with the Fixed-Point Blockset.
The size of the output depends on the number of inputs, their vector size, and
the selected operator:
• The NOT operator accepts only one input, which can be a scalar or a vector.
If the input is a vector, the output is a vector of the same size containing the
bitwise logical complements of the input vector elements.
• For a single vector input, the block applies the operation (except the NOT
operator) to all elements of the vector. If a bit mask is not specified, then the
output is a scalar. If a bit mask is specified, then the output is a vector.
10-31