MATLAB: Is it possible to allow Bit to Integer Converter blocks to use word lengths of 32

bitcommunicationscommunications blocksetconversioninteger

The Bit to Integer blocks can only handle number of bits per integer values up to 31. I would like to use 32 to make full use of uint32 signals in my model.

Best Answer

This enhancement has been incorporated in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:
The ability to handle more than 31 bits per integer is not available in the Bit to Integer Converter block in the Communications Blockset.
To work around this issue, split the N-bit data into two (N/2)-bit numbers where (N/2) is less than 31 bits. Pass the two halves separately through the Bit to Integer Converter blocks which convert (N/2) bit data to an integer. Following this, left shift the top half by (N/2) bits and perform a Bitwise OR with the lower half. The resulting output is equivalent to using a single N-bit data Bit to Integer Converter block where N > 31.
The attached model, bit_to_int_32bits.mdl illustrates the above procedure to convert 32-bit data to an integer. As explained above, split the 32-bit integer into two 16-bit integers representing the top and bottom halves. Pass the two halves through two Bit to Integer Converter blocks. Following this, left shift the 16-bit integer representing the top half to make a 32-bit integer and perform a Bitwise OR operation with the other 16-bit integer to result in a 32-bit integer. The attached models, bit_to_int_64bits.mdl and bit_to_int_double.mdl illustrate the process of extending the above example to create a 64-bit Bit to Integer Coverter block and a 52-bit Bit to Integer Converter block, respectively.