Main Content

Integer to Bit Converter

Map vector of integers to vector of bits

  • 库:
  • Communications Toolbox / Utility Blocks

  • Integer to Bit Converter block

Description

TheInteger to Bit Converterblock maps each integer (or fixed-point value) in the input vector to a group of bits in the output vector.

This block is single-rate and single-channel. The block maps each integer value (or stored integer when you use a fixed point input) to a group ofMbits, using the selection for theOutput bit orderto determine the most significant bit. The resulting output vector length isMtimes the input vector length.

Ports

Input

expand all

Input signal, specified as an integer or a lengthNcolumn vector of integers.

IfMis specified by theNumber of bits per integer(M)parameter:

  • When theNumber of bits per integerparameter is set toUnsigned, input values must be integers in the range [0, (2M– 1)].

  • When theNumber of bits per integerparameter is set toSigned, input values must be integers in the range [(–2M-1), (2M– 1– 1)].

During simulation, the block performs a run-time check and issues an error if any input value is outside of the appropriate range. When the block generates code, it does not perform this run-time check.

Data Types:double

Output

expand all

Output signal, returned as a scalar or column vector of bits of lengthM·N.

Parameters

expand all

Number of input bits mapped to each integer in the input, specified as an integer in the range [1, 32].

Indicate if the integer value input ranges should be treated as signed or unsigned.

Define whether the first bit of the output signal is the most significant bit (MSB) or the least significant bit (LSB).

Specify the data type of the output bits. You can choose one of the followingOutput data typeoptions:

  • Inherit via internal rule–– The block determines the output data type based on the input data type.

    • If the input signal is floating-point (eithersingleordouble), 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 toSmallest integer.

  • Smallest integer––The block selects the output data type based on settings used in theHardware Implementation Pane(Simulink)of the Configuration Parameters dialog box.

    • If you selectASIC/FPGA为设备供应商,the output data type is the ideal one-bit size (ufix1).

    • For all other device vendor selections, the output data type is an unsigned integer with the smallest available word length, as defined in the Hardware Implementation settings (for example, uint8)

  • Same as input

  • double

  • single

  • uint8

  • uint16

  • uint32

Block Characteristics

Data Types

Boolean|double|fixed point[a]|integer|single

Multidimensional Signals

no

Variable-Size Signals

yes

[a]ufix(1)只有在ASIC / FPGA selec时输出ted in the Hardware Implementation Pane.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

See Also

Blocks

Functions

Introduced before R2006a