Bitwise Operator
Performs a specified bitwise operation on the input signals.
blockType: Bitwise Operator
Path in the library:
|
Description
Block Bitwise Operator performs a specified bitwise operation for one or more operands. Unlike logical block operations Logical Operator bitwise operations treat operands as a vector of bits, rather than as a single value.
The block icon changes depending on the selected operation in the parameter Operator.
The number of input ports of the block is set by the parameter Number of input ports.
Restrictions on block operations
Block Bitwise Operator It does not support shift operations. For shift operations, use the block Shift Arithmetic.
Ports
Output
#
OUT_1
—
Output signal
scalar | vector | the matrix
Details
The output signal. Its type must represent zero exactly. Data types satisfying this condition include signed and unsigned integer data types.
The size of the block output depends on the number of input parameters, the size of the vector, and the operator you choose. If the bitmask is not specified, then the output is a scalar, otherwise a vector.
| Data types |
|
| Complex numbers support |
Yes |
Input
#
IN_1
—
Input signal
scalar | vector | the matrix
Details
The input signal is in the form of a scalar or vector.
The number of input ports of the block is set by the parameter Number of input ports.
-
Operator
NOTaccepts only one Input, which can be a scalar or a vector. If the Input represents a vector, the output represents a vector of the same size containing the results of a given logical operation on the elements of the input vector. -
For one input vector, the block applies an operation (except for the operator
NOT) to all elements of the vector. -
For two or more Inputs, the block performs an operation between all Inputs. If the input parameters are vectors, the block performs an operation between the corresponding elements of the vectors, thus forming an output vector of the same size.
| Data types |
|
| Complex numbers support |
Yes |
Parameters
Main
#
Operator —
bitwise logical operator
AND | OR | NAND | NOR | XOR | NOT
Details
Bitwise logical operator for block operands. The following bitwise operations are available:
| Bitwise operation | Description |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Use bit mask —
use a bitmask
Logical
Details
Check the box to use a bitmask.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Number of input ports —
number of input signals
Int64 integer
Details
The number of entrances. There can be more than one input port.
Dependencies
To use this option, uncheck the box. Use bit mask.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Bit Mask —
bitmask for communication with a single input
Scalar / array of real numbers
Details
Set a bitmask for communication with a single input. This parameter reads values as hexadecimal values.
You can use a bitmask to set, receive, or clear (reset) the input bit.
| Action | Parameter Value Operator | Bitmask |
|---|---|---|
Set the bit |
|
|
Clear the bit |
|
|
Get a bit |
|
|
Suppose you want to set the fourth bit of an 8-bit input vector. The bitmask will be 00010000 which you can specify as 2^4 for the parameter Bit Mask. To clear a bit, use a bit mask. 11101111 which you can specify as 27+26+25+23+22+21+2^0 for the parameter Bit Mask.
Dependencies
To use this option, check the box Use bit mask.
| Default value |
|
| Program usage name |
|
| Tunable |
Yes |
| Evaluatable |
Yes |