Pseudo-booleans and triggers
OverviewA number of operators in Polybench use trigger inputs, binary states or pseudo-boolean output. This background article explains the various terms that are used in the Polybench documentation.
On or Off in signalsPolybench was created to process digitized signals from physiological sources. However, in the processing of those signals, often all kinds of control signals are required. The most common control signal is a signal that is interpreted as either ON or OFF - or True or False if you like. If a value is used to flag ON or OFF, then that value is said to have a binary state, and that the value is a boolean value (called after the mathematician George Boole).
Polybench does not have a special data type for boolean values. Instead, booleans are represented by ordinary real numbers. The advantage of booleans that are expressed as real numbers, is that mathematical calculations in Polybench can easily mix boolean and real values. In addition to that, real values can now become booleans, just by interpreting them as booleans.
In Polybench, by definition a boolean 'False' (OFF) is 0, and a boolean 'True' (ON) is 1. But because the boolean values are actually just values in the Real domain (0.000... and 1.000...), the ON and OFF states are not precise. Therefore, in Polybench we often talk about pseudo-booleans. For example, in some cases 'True' is defined to be a value of close to 1, or greater than one, and 'False' to be a value of close to 0, or less than zero.
Sometimes this is a little dangerous, because if a value is never exactly True or False, then there must be a gray area in which it is not clear whether the value is interpreted as True or False. This gray area lies between 0 and 1, probably somewhere in the middle. If you would have a signal that slowly rises from 0 to 1, then you are not certain about which point in time the signal changes from False to True. Therefore: for boolean control, never use slowly changing signals.
If you require to translate a slowly changing signal into a more precisely defined pseudo-boolean signal, then you should use the Level Detector ("Level detector").
TriggersA trigger in Polybench is defined to be a transition from pseudo-boolean False (0) to pseudo-boolean True (1). This transition does not have to happen in the shortest possible time (between two adjacent signal samples), but in many cases it is advisable to use a quick transition, in order to prevent indeterministic behavior.
StatesA state tells if a signal currently has a pseudo-boolean False (0) or pseudo-boolean True (1) value. So, whereas a trigger is about the transition from false to true and has the shortest possible time period (one sample), a state is about the current value of the signal, which can stay like that for a longer time period.
Below, the figure shows a demonstration of getting a trigger from a signal, and then getting a state from triggers.
The Level Detector ("Level detector") is used to make two triggers of the signal. Note the Trigger and Reset settings of the Level Detector. Then, a Flip Flop (which actually is a basic memory element, "Flip-Flop (set/reset)") is used to make a state signal of the two triggers.