Engee documentation

Bit to Integer Converter

Maps a vector of bits to the corresponding vector of integers.

blockType: BitToIntegerConverter

Path in the library:

/Basic/Logic and Bit Operations/Bit to Integer Converter

Description

Block Bit to Integer Converter maps groups of bits in the input vector to integers in the output vector.

Number set by the parameter Number of bits per integer(M) :

  • For unsigned integers, the block matches each group of an integer bit in the range . As a result, the length of the output vector in times less than the length of the input vector.

  • For signed integers, the block matches each group of an integer bit in the range .

Ports

Entrance

In — input signal
bit scalar | vector is a column of bits

The input signal is in the form of a scalar or a column vector of bits with a length multiple of the value specified in the parameter Number of bits per Integer(M). The input data must be bits with values 0 or 1.

Data types: Int8, Int16, Int32, UInt8, UInt16, UInt32, Float32, Float64, Bool

Output

Out — pass output signal:q[<br>] integer | vector-column of integers

The output signal returned as an integer or a column vector of integers. The After bit packing, treat resulting integer values as parameter determines whether the output integers are interpreted as unsigned or signed.

  • When the input bits are treated as unsigned, each integer in the output is in the range [0, (2M-1)].

  • When the input bits are treated as signed, each integer in the output is in the range [(-2M-1 ), (2M-1-1)].

Parameters

Number of bits per integer(M) — number of bits per integer (M)
3.0 (default) | an integer in the range [1, 32]

The number of input bits mapped to each integer in the input as an integer in the range of values [1, 32].

Programmatic use

Block parameter

nbits

Values

an integer in the range [1, 32]

By default

3.0

Input bit order — the order of the bits at the input
MSB first (default) | LSB first

Determine whether the first bit of the input signal is the high bit (MSB) or the low bit (LSB).

Programmatic use

Block parameter

bitOrder

Values

MSB first | LSB first

By default

MSB first

After bit packing, treat resulting integer values as — treat output values as signed or unsigned numbers
Unsigned (default) | Signed

Specify whether the output values should be treated as signed numbers (Signed) or unsigned numbers (Unsigned).

Programmatic use

Block parameter

signedOutputValues

Values

Unsigned | Signed

By default

Unsigned

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 vary depending on the desired signification 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

Additional options

C code generation: Yes