Word to Bits
R2026bLibraries:
HDL Coder /
Logic and Bit Operations
Description
The Word to Bits block converts a real number of word length N to a vector of bits. The output of the block is a vector whose length you specify in the Maximum Word Length parameter.
The block treats the first element of the output vector as the least significant bit (LSB) and treats subsequent bits as the next significant bits in ascending order.
This figure shows the conversion of the unsigned integer 72 to its binary representation when you specify a maximum word length of 8. You can also convert a signed integer value to its corresponding binary vector.

This figure shows the conversion of the non-integer value 5.5 to its binary
representation. The output is a binary representation of the stored integer value of 5.5. To
determine stored integer value of a fixed-point real number, use storedInteger function.

Examples
Ports
Input
Output
Parameters
Programmatic Use: Add Block
To add the block programmatically, use the add_block function with one of these library block paths as the source.
"hdlsllib/Logic and Bit Operations/Word to Bits"
Example: add_block("hdlsllib/Logic and Bit Operations/Word to Bits","myModel/myBlock",MakeNameUnique="on")
