Engee documentation

Bitwise Operator

Performs a specified bitwise operation on the input signals.

blockType: Bitwise Operator

Path in the library:

/Basic/Logic and Bit Operations/Bitwise Operator

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

Int64

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 NOT accepts 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

Int64

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

AND

true if all the relevant bits are 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 there are no corresponding bits true

XOR

true if there are an odd number of corresponding bits true

NOT

true If the input is false (only available for one entry)

Values

AND | OR | NAND | NOR | XOR | NOT

Default value

AND

Program usage name

logicop

Tunable

No

Evaluatable

No

# Use bit mask — use a bitmask
Logical

Details

Check the box to use a bitmask.

Default value

true (switched on)

Program usage name

UseBitMask

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

1

Program usage name

NumInputPorts

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

OR

1 for each corresponding input bit that you want to set to 1

Clear the bit

AND

0 for each corresponding input bit that you want to set to 0

Get a bit

AND

1 for each corresponding input bit that you want to get

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

0b11011001

Program usage name

BitMask

Tunable

Yes

Evaluatable

Yes

Additional options

C code generation: Yes