Products & Services Solutions Academia Support User Community Company

Learn more about Communications Blockset   

Bit to Integer Converter - Map vector of bits to corresponding vector of integers

Library

Utility Blocks

Description

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

For unsigned integers, if M is the Number of bits per integer, then the block maps each group of M bits to an integer between 0 and 2M-1. As a result, the output vector length is 1/M times the input vector length. For signed integers, if M is the Number of bits per integer , then the block maps each group of M bits to an integer between –2M-1 and 2M-1-1.

If the input signal is a sample-based input, then it must be a vector whose length equals the value for the Number of bits per integer parameter. If the input is frame-based, then it must be a column vector whose length is an integer multiple of Number of bits per integer.

The block can accept input data types double, single, boolean, int8, uint8, int16, uint16, int32, uint32 and ufix1.

Dialog Box

Number of bits per integer

The number of input bits that the block maps to each integer of the output. This parameter must be an integer between 1 and 32.

Input bit order

Defines whether the first bit of the input signal is the most significant bit (MSB) or the least significant bit (LSB). The default selection is MSB.

After bit packing, treat resulting integer value as

Indicates if the integer value input ranges should be treated as signed or unsigned. The default setting is Unsigned.

    Note   This parameter setting determines which Output data type selections are available.

Output data type

If the input values are unsigned integers, you can choose from the following Output data type options:

  • Inherit via internal rule

  • Smallest integer

  • Same as input

  • double

  • single

  • int8

  • uint8

  • int16

  • uint16

  • int32

  • uint32

If the input values are signed integers, you can choose from the following Output data type options:

  • Inherit via internal rule

  • Smallest integer

  • double

  • single

  • int8

  • int16

  • int32

The default selection for this parameter is Inherit via internal rule.

When the parameter is set to Inherit via internal rule, the block determines the output data type based on the input data type.

  • If the input signal is floating-point (either double or single), the output data type is the same as the input data type.

  • If the input data type is not floating-point, the output data type is determined as if the parameter is set to Smallest integer .

When the parameter is set to Smallest integer, the software selects the output data type based on the settings used in the Hardware Implementation pane of the Configuration Parameters dialog box.

  • If ASIC/FPGA is selected, the output data type is the smallest ideal integer or fixed-point data type, based on the setting for the Number of bits per integer parameter.

  • For all other selections, the output data type is the smallest available (signed or unsigned) integer word length that is large enough to fit the ideal minimum bit size.

Examples

Refer to the example on the Integer to Bit Converter reference page: Fixed-Point Integer To Bit and Bit To Integer Conversion (Audio Scrambling and Descrambling Example)

See Also

bi2de, bin2dec

Pair Block

Integer to Bit Converter

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS