Bit to Integer Converter
Maps a vector of bits to the corresponding vector of integers.
Description
The Bit to Integer Converter block maps groups of bits in the input vector to integers in the output vector.
The number is specified by the parameter Number of bits per integer(M) :
-
For unsigned integers, the block maps each group of M bits to an integer in the range [0, (2M - 1)]. As a result, the length of the output vector is times smaller than the length of the input vector.
-
For signed integers, the block maps each group of M bits to an integer in the range [(-2M-1), (2M-1 - 1)].
Ports
Input
In - input signal
bit scalar
| bit vector-column
Input signal, as a scalar or vector-column of bits with a length multiple of the value specified in the Number of bits per Integer(M) parameter. Input data must be bits with values 0
or 1
.
Data types: Int8
, Int16
, Int32
, UInt8
, UInt16
, UInt32
, Float32
, Float64
, Bool
.
Output
Out - output signal
integer
| vector-column of integers
Output signal returned as an integer or vector-column of integers. The After bit packing, treat resulting integer values as parameter specifies whether the output integers are interpreted as unsigned or signed.
-
When the input bits are treated as unsigned, each output integer is in the range [0, (2M- 1)].
-
When the input bits are treated as signed, each output integer is in the range [(-2M-1 ), (2M-1 - 1)].
Parameters
Number of bits per integer(M) - number of bits per integer (M)
3.0 (by default)
| an integer in the range [1, 32]
The number of input bits mapped to each integer input as an integer in the value range [1, 32].
Block parameter |
|
Values |
|
By default |
|
Input bit order - input bit order
MSB first (by default)
| LSB first
Determine whether the first bit of the input signal is a high bit (MSB
) or a low bit (LSB
).
Block parameter |
|
Values |
|
By default |
|
After bit packing, treat resulting integer values as - treat output values as numbers with or without sign
Unsigned (by default)
| Signed
Specify whether the output values should be treated as signed (Signed
) or unsigned (Unsigned
) numbers.
Block parameter |
|
Values |
|
By default |
|
Output data type - output data type
Float16
| Same as input
| Float64
| Float32
| Int8
| Int16
| Int32
| UInt8
| UInt16
| UInt32
The available values of Output data type change depending on the desired characterisation of the output data.
If the output integers are `Signed', you can select one of the following output data type options:
-
Float32
. -
Float64
-
Int8
-
Int16
-
`Int32
If the output integers are Unsigned
, in addition to the above options are added:
-
Same as input
. -
Float32
-
Float64
-
Int8
-
`Int16
-
`Int32
-
`UInt16
-
`UInt32