Bit Concat
Combines up to 16 input words into a single output word.
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. |
Block parameter |
|
Values |
|
By default |
|
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 typeUInt8
, the output combines the elements1
and2
so that1
forms the most significant bit (MSB). The output is a scalar of typeUInt16
with bit representation0000000100000010 = 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 value3
fed to the input of port L. Both inputs are of data typeUInt8
. The output is a vector with data typeUInt16
, which is combined in such a way that the high significant bit is the union of elements1
and3
, and the low significant bit is the union of elements2
and3
. -
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 typeUInt8
. The output is a vector with data typeUInt16
, which is combined such that the high significant bit is the union of elements1
and3
, and the low significant bit is the union of elements2
and4
.
-
-
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]
.