Extract Bits
Output of a sample of consecutive bits from an input signal.
blockType: Extract Bits
Path in the library:
|
Description
Block Extract Bits allows you to output a sample of consecutive bits from the stored integer value of the input signal. Use the parameter Bits to extract to determine the method of selecting the output bits.
Values to select in the parameter Bits to extract:
-
Upper half— output of half of the input bits containing the highest bit. -
Lower half— output of half of the input bits containing the least significant bit. -
Range starting with most significant bit— output of a certain number of high-order bits of the input signal, the number of bits is set in the parameter Number of bits. -
Range ending with least significant bit— output of a certain number of least significant bits of the input signal, the number of bits is set in the parameter Number of bits. -
Range of bits— when selecting this value, you must specify the range of consecutive bits of the input signal for output. The range of values is set in the parameter Bit indices in the format[start, end], and the indexes of the input bits are marked sequentially, starting with0for the least significant bit.
Ports
Input
#
IN_1
—
Input signal
scalar | vector | the matrix | N-dimensional array
Details
An input signal specified as a scalar, vector, matrix, or - dimensional array. The floating-point input data passes through the block unchanged. Input data of the type Bool are treated as data of the type UInt8.
| Performing bit operations on signed integers is quite difficult. Difficulties can be avoided by converting the input data type to unsigned integers. |
| Data types |
|
| Complex numbers support |
Yes |
Output
#
OUT_1
—
extracted bits
scalar | vector | the matrix | N-dimensional array
Details
Sequential sampling of extracted bits, specified as a scalar, vector, matrix, or N-dimensional array. The floating-point input data passes through the block unchanged.
| Data types |
|
| Complex numbers support |
Yes |
Parameters
Main
#
Bits to extract —
bit extraction method
Upper half | Lower half | Range starting with most significant bit | Range ending with least significant bit | Range of bits
Details
Select a method for extracting bits from the input signal.
Consider the input signal, which is represented in binary form 110111001:
-
If the value is selected
Upper half— output of half of the input bits containing the highest bit, then the output will be11011in binary format. -
If the value is selected
Lower half— output of half of the input bits containing the least significant bit, the output will be11001in binary format. -
If the value is selected
Range starting with most significant bit— output of a certain number of high-order bits of the input signal, and the number of bits in the parameter Number of bits set3, then the output will be110in binary format. -
If the value is selected
Range ending with least significant bit— output of a certain number of least significant bits of the input signal, and the number of bits in the parameter Number of bits set8, then the output will be10111001in binary format. -
If the value is selected
Range of bitsand a number is indicated[4, 7]adjacent bits of the input signal for output in the parameter Bit indices, then the output will be1011in binary format.
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Number of bits —
number of bits to output
Int64 integer
Details
Select the number of bits to output from the input signal. Signed integers must have at least two bits. Unsigned integers can have no more than one bit.
Dependencies
To use this parameter, set for the parameter Bits to extract meaning Range starting with most significant bit or Range ending with least significant bit.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
# Bit indices — a range of consecutive bits for output
Details
Specify the bit range of the input signal to output in the format [start, end]. The indexes are assigned to the input bits, starting with 0 in the least significant bit.
Dependencies
To use this parameter, set for the parameter Bits to extract meaning Range of bits.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Output scaling mode —
output data scaling mode
Preserve fixed-point scaling | Treat bit field as an integer
Details
Select the zoom mode that will be used to select the output bits.:
-
Preserve fixed-point scaling— The fixed-point scaling of the input data is used to determine the scaling of the output during data type conversion. -
Treat bit field as an integer— the scaling of the input data with a fixed point is ignored, and only the stored integer is used to calculate the type of output data.
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |