Bit Concat
Concatenates up to 128 input words into single output
Libraries:
HDL Coder /
Logic and Bit Operations
Description
The Bit Concat block concatenates up to 128 input words into a single
output. The input port labeled L designates the lowest-order input word.
The input port labeled H designates the highest-order input word. For
scalar inputs, two or more input signals should be connected to the block. For vector inputs,
at least one input should be connected to the block. The block uses the bitconcat function such that the right-to-left ordering of words in the output
follows the low-to-high ordering of input signals. To learn how the block operates, see Algorithms.
Ports
Input
Output
Parameters
Algorithms
The block uses the bitconcat function to compute the result. How
the block operates depends on the number and dimensions of the inputs, as follows:
Single input: The input is a scalar or a vector. When the input is a vector, the code generator concatenates the individual vector elements. For example, if the input vector is
[1 2]that has the data typeufix4, the output concatenates the elements1and2such that1forms the MSB (Most Significant Bit). The output is:y = dec2bin('00010010') = 18
Two inputs: Inputs are any combination of scalar and vector.
When one input is scalar and the other is a vector, the code generator performs scalar expansion. Each vector element is concatenated with the scalar, and the output has the same dimension as the vector. For example, consider a vector
[1 2]input to theHport and a scalar value3as input to theLport. Both inputs have the data typeufix4. The output is a vector that concatenates such that the MSB is a concatenation of elements1and3, and the LSB is a concatenation of elements2and3.y = [dec2bin('00010011') dec2bin('00100100')] = [19 35]
When both inputs are vectors, they must have the same size. In this case, the last element is the lowest-order word and the first element is the highest order word. For example, consider two input vectors
[1 2]and[3 4]that have the data typeufix4. The output is a vector that concatenates such that the MSB is a concatenation of elements1and3, and the LSB is a concatenation of elements2and4.y = [dec2bin('00010011') dec2bin('00100100')] = [19 36]
Three or more inputs (up to a maximum of
128inputs): Inputs are uniformly scalar or vector. All vector inputs must have the same size. For example, consider three vector inputs[1 2],[3 4], and[5 6]such that vector[1 2]is input to theHport and[5 6]is input to theLport. In this case, the output is a vector that first concatenates[1 2]and[3 4].temp = [dec2bin('00010011') dec2bin('00100100')] = [19 36]
The result of this computation is then concatenated with the vector
[5 6]to produce the output.y = [dec2bin('000100110101') dec2bin('001001000110')] = [309 582]
