Table of Contents
Bitwise Concatenate
Concatenates binary bits of logical or integral types into larger integral types.
Library
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
qc_open_library('quarc_library/Logic Operations')Description
The Bitwise Concatenate block concatenates the bits of integral types into larger integral types. For example, it can concatenate two bytes to form a word, where one byte is the LSB and the other byte is the MSB of the word. The block can concatenate the elements of a single vector into a scalar, or it can concatenate multiple inputs into a single output. Logical (boolean) inputs are treated as bits so that individual bits can be concatenated into an integral type.
For example, suppose there is a single uint8 vector input with two elements. The output will be a uint16 scalar that is the combination of the two bytes. If the Most-significant first option is not checked, then the first element of the vector input will become the least-significant byte (LSB) of the output and the second element of the vector input will become the most-significant byte (MSB) of the output. If the Most-significant first option is checked, then the first element of the vector input will become the MSB of the output and the second element of the vector input will become the LSB of the output.
Consider another example. Suppose there are two uint8 scalar inputs. The output will be a uint16 scalar that is the combination of the two inputs. If the Most-significant first option is not checked, then the first input will become the least-significant byte (LSB) of the output and the second input will become the most-significant byte (MSB) of the output. If the Most-significant first option is checked, then the first input will become the MSB of the output and the second input will become the LSB of the output.
If the inputs are vectors instead, then the output will also be a vector, in which each element of the output is the concatenation of the corresponding element of each input.
When the input(s) are logical, or boolean, the Bitwise Concatenate block treats the input(s) as individual bits and concatenates the bits into an unsigned integral type large enough to hold the given number of bits. This feature can be very useful for creating bitmasks, particularly when used in conjunction with the
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
doc('mux');When concatenating signed integral types, the output will be sign-extended. For example, concatenating three signed 8-bit integers produces a 24-bit integer result which is signed-extended and output from the block as a 32-bit signed integer. To avoid sign extension, pass the three bytes as unsigned 8-bit integers instead, or add a fourth input which is a constant zero.
Input Ports
The number of inputs is determined by the Number of inputs parameter. When there is a single input it concatenates the elements of the input vector into a scalar output. When there are multiple inputs, it concatenates across each input to produce the output. In this case, if the inputs are vectors then the output will be a vector of the same size.
All inputs must have the same data type and dimensions.
Output Ports
The output is the concatenation of the inputs. The output data type is determines by the input data types and dimensions.
Data Type Support
The Bitwise Concatenate block supports all the built-in integral types as well as boolean inputs. It can produce integer data types at the output up to 64 bits in size. Boolean inputs are treated as individual bits. Hence, the Bitwise Concatenate block can concatenate bits into an integer.
Parameters and Dialog Box
Number of inputs
The number of inputs to the block. If there is only one input, then it concatenates the elements of the input to produce a scalar output. If there is more than one input, then it concatenates across inputs to produce the output. In that case, if the inputs are vectors then the output is a vector of the same dimensions.
Most-significant first (tunable offline)
If this option is checked then the first element or input is used as the most-significant portion of the concatenated output. Otherwise, it is the least-significant portion.
For example, if there are two uint8 inputs then the output will be a uint16. If Most-significant first is not checked, then the first input will become the least-significant byte (LSB) of the uint16 output, and the second input will become the most-significant byte (MSB). If the Most-significant first option is checked, then the first input becomes the MSB and the second input becomes the LSB.
Targets
Target Name |
Compatible* |
Model Referencing |
Comments |
---|---|---|---|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
Last fully supported in QUARC 2018. |
|
Rapid Simulation (RSIM) Target |
Yes |
Yes |
|
S-Function Target |
No |
N/A |
Old technology. Use model referencing instead. |
Normal simulation |
Yes |
Yes |
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.