Extract Bits
Output selection of contiguous bits from input signal
Libraries:
Simulink /
Logic and Bit Operations
HDL Coder /
Logic and Bit Operations
Description
The Extract Bits block allows you to output a contiguous selection of bits from the stored integer value of the input signal. Use the Bits to extract parameter to define the method for selecting the output bits.
Select
Upper half
to output the half of the input bits that contain the most significant bit. If there is an odd number of bits in the input signal, the number of output bits is given by the equationnumber of output bits = ceil(number of input bits/2)
Select
Lower half
to output the half of the input bits that contain the least significant bit. If there is an odd number of bits in the input signal, the number of output bits is given by the equationnumber of output bits = ceil(number of input bits/2)
Select
Range starting with most significant bit
to output a certain number of the most significant bits of the input signal. Specify the number of most significant bits to output in the Number of bits parameter.Select
Range ending with least significant bit
to output a certain number of the least significant bits of the input signal. Specify the number of least significant bits to output in the Number of bits parameter.Select
Range of bits
to indicate a series of contiguous bits of the input to output in the Bit indices parameter. You indicate the range in[start end]
format, and the indices of the input bits are labeled contiguously starting at 0 for the least significant bit.
This block does not report wrap on overflow warnings during simulation. To report
these warnings, see the Simulink.restoreDiagnostic
reference
page. The block does report errors due to wrap on overflow.
Examples
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
Version History
Introduced before R2006a
See Also
Bitwise Operator | Bit Clear | Bit Set | Float Extract Bits | Bit Slice (HDL Coder)