Polybench® Reference
Takes the input value as an integer and converts the bits into pseudo-boolean signals in separate channels.

Signal To Bits

Overview

Use this operator to convert a natural value (integer) into multiple channels that each represent one binary bit of the value.

Some devices offer a signal channel with encoded boolean flags, all in one value. This operator is able to select the bits of the value, so that you can process their individual binary states.

Operator ports

Input S0: Floating point values

Output Boolean: Floating point values

Properties

Find more information about changing properties here: link

How many bits
type: Integer value
Specifies the first N number of bits of the input value that are converted to N output channels. Changing this value also changes the number of output channels.


Caption
type: Word or phrase
The name of the object in the project. This name must not contain '.' or '$' characters.

Every object has the Caption property. This property is very important, because it is the name by which Polybench recognizes this object.
It is allowed to give multiple objects the same name, as long as the objects are of the same type. In that case, a reference to this caption includes all the objects with the same caption.
In Polybench, every object can be addressed by an Address specifier, which starts with the dollar sign, for example: $My Page.My Object. 'My Page' would be the Caption of a page, and 'My Object' the Caption of an object on that page.

Documentation
type: See description
Optional documentation of this object.

It is good practice to write in short notes why you have used this object, and why its properties are set the way they are set. If this object is an operator, the Documentation text is displayed below the operator symbol.

Details

To describe the usage of this operator, we take an example:
Suppose your device outputs in a signal channel 8-bit integer values. Each binary bit in that value stands for an alarm from the device. You are interested to find out the values of each bit.

You take a Signal to Bits operator and connect the signal channel to the input. In the How many bits property you define that you want to extract the first 8 bits.

The Signal to Bits operator now gets 8 channels at its output. The first channel represents the first bit, the second channel the second bit, etc. Each bit now becomes a signal that is either 0 for a False or 1 for a True.

Limitations

- Only one signal channel must be connected to the input. If you connect a signal bus with more than one channel, a warning is displayed below the operator symbol.
- The number of bits is limited to 64
- If the input value is not a natural, but a real number, then the value is truncated to an integer before the bits are analysed.

More information

Read more about pseudo-boolean states here: link.

Examples

Example: Single Bit Decoder Demo
Demonstrates the use of the Signal To Bits operator to create a Single Bit Decoder. The input of this schematic is a pulse train, where each pulse must have a length of one sample period. Every next pulse, the next output channel becomes high.
The middle part of the schematic counts the input pulses and converts that count to a 2^N value, which serves as input to the Signal To Bits.
Examples\DF0600158_001_Single_Bit_Decoder_with_Signal_To_Bits_Demo.xmc