FixPt Logical Operator

Perform the specified logical operation on the inputs.

Description

The FixPt Logical Operation block is a masked S-function that performs the specified logical operation on its inputs. An input value is TRUE (1) if it is nonzero and FALSE (0) if it is zero.

You select the Boolean operation connecting the inputs with the Operator parameter list. The supported operations are given below.

Operation

Description

AND

TRUE if all inputs are TRUE

OR

TRUE if at least one input is TRUE

NAND

TRUE if at least one input is FALSE

NOR

TRUE when no inputs are TRUE

XOR

TRUE if an odd number of inputs are TRUE

NOT

TRUE if the input is FALSE

The number of input ports is specified with the Number of input ports parameter. The output type is specified with the Logical output data type parameter. An output value is 1 if TRUE and 0 if FALSE.

The output data type should represent zero exactly. Data types that satisfy this condition include signed and unsigned integers, and any floating-point data type

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 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. The output is always a scalar.

  • For two or more inputs, the block performs the operation between all of the inputs. If the inputs are vectors, the operation is performed between corresponding elements of the vectors to produce a vector output.

When configured as a multi-input XOR gate, this block performs an addition- modulo-two operation as mandated by the IEEE Standard for Logic Elements.

Parameters and Dialog Box

  • Operator - Logical operator used to connect the inputs.

  • Number of input ports - Number of inputs.

  • Logical output data type - Output data type. You should only use data types that represent zero exactly.

Characteristics

Input Port(s)

Any data type supported by the blockset

Output Port 

Any data type supported by the blockset that can exactly represent zero

Direct Feedthrough

Yes

Sample Time

Inherited

Scalar Expansion

Of inputs

States

0

Vectorized

Yes