Engee documentation

Bit Concat

Combines up to 16 input words into a single output word.

bit concat

Description

Block Bit Concat combines up to 16 input words into a single output word. Input port L denotes the lowest input word. Input port H indicates the highest input word. For scalar inputs, two or more input signals must be connected to the block. For vector inputs, at least one input must be connected to the block. The output word order from right to left repeats the order of the input words from lowest to highest. For more details on the block operation, refer to the section Algorithms.

Ports

Input

H - high input word
scalar | vector | matrix

Senior word at the block input, which becomes the leftmost value in the combined output signal.

Data types: Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool, Fixed

L - low input word
scalar | vector | matrix

The low-order input word of the block, which becomes the rightmost value in the combined output signal.

Data types: Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Bool, Fixed

Output

Output - combined output word
scalar | vector | matrix

The output is a combined word arranged in the order from the lowest to the highest value of the input words. The maximum output word size is 16 bits.

Data types: Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128, Bool, Fixed

Parameters

Number of Inputs - number of input signals
2 (by default) | a positive integer less than or equal to 16

The number of input signals as a positive integer. The number of input ports on the block icon is updated when the value of the Number of Inputs parameter changes. The minimum number of signals is 1 and the maximum number of signals is 16.

Make sure that the value of Number of Inputs is equal to the number of signals that are connected to the block. If the unit has unconnected inputs, an error will occur during code generation.
Usage in program code

Block parameter

numInputs

Values

целое положительное число, меньшее или равное 16

By default

2

Algorithms

The principle of block operation depends on the number and size of inputs:

  • Single input port: a scalar or vector is input to the input port. If the input is a vector, the code generator combines the individual elements of the vector. For example, if the input vector is [1 2] with data type UInt8, the output combines the elements 1 and 2 so that 1 forms the most significant bit (MSB). The output is a scalar of type UInt16 with bit representation 0000000100000010 = 258.

  • Two input ports: the input port receives any combination of scalars and vectors.

    • If one input port receives a scalar and the other a vector, the code generator performs a scalar expansion. Each element of the vector is combined with the scalar, and the output is a vector of the same dimension as the vector on the input. For example, consider the vector [1 2] fed to the input of port H and the scalar value 3 fed to the input of port L. Both inputs are of data type UInt8. The output is a vector with data type UInt16, which is combined in such a way that the high significant bit is the union of elements 1 and 3, and the low significant bit is the union of elements 2 and 3.

    • If both input ports receive vectors, they must be of the same size. In this case, the last element is the low word and the first element is the high word. For example, consider two input vectors [1 2] and [3 4], which have data type UInt8. The output is a vector with data type UInt16, which is combined such that the high significant bit is the union of elements 1 and 3, and the low significant bit is the union of elements 2 and 4.

  • Three or more input ports (maximum 16): a scalar or vector is input to an input port. All vector inputs must have the same size. For example, consider three vector inputs [1 2], [3 4] and [5 6] such that the vector [1 2] is an input to port H and [5 6] is an input to port L. In this case, the output is a vector that first combines [1 2] and [3 4]. The result of this calculation is then combined with the vector [5 6].

Additional options

C code generation: Yes