Polybench® Reference
Results in the addition of two input signals, or: S1 + S2.

S1 + S2

Overview

Adds sample values of all channels to the sample values of the same channels on the other input.

Operator ports

Input S1: Floating point values

Input +S2: Floating point values

Output S1+S2: Floating point values

Properties

Find more information about changing properties here: "Properties Viewer"

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

For more information about the rules and usage of the Caption property, please refer to "Caption property - background and usage".

Documentation
type: See description
Optional documentation of this object. If this object is an operator, the Documentation text is displayed below the operator symbol.

Details

Case 1: equal number of channels
If both input buses contain an equal number of channels, the sample value of every channel at input S1 is added to the value of the channel with the same number at input S2 and put to the same output channel.

Case 2: input with one channel
If one input bus contains one channel and the other input contains more than one channel, the sample value of the single channel input is added to the value of every channel of the other input.

Case 3: unequal number of channels
If the two input buses contain an unequal number of channels, and neither has one channel, then the operator outputs no data and a warning is displayed below the symbol.

It is allowed to connect a signal that feeds back from the output to one of the inputs that originates from the output. It is however recommended to only feed back on the lower (S2) input.

It is not allowed to directly add signals from two different sources. You need to synchronize the signals first, using the Synchronizer ("Synchronizer").

The calculation is also performed on constant values (e.g. from a Constant ("K"); either if one of the inputs is a constant or both.


Example where the Adder counts one-sample wide pulses by using a feedback loop. The Multiplier is used to reset the counter when the button is pressed.

Examples

Example: Adder feedback as counter demo
Demonstrates how the Adder can be used to count pulses, by feeding its output back into one of its inputs. The Multiplier is only added to have a reset mechanism (the counter would work without it). Note that the Level Detector transforms a row of 1's from the Comparator into a single pulse that is 1 and otherwise 0. Without the One Shot, the Adder would count in greater steps than one.
Examples\DF0204003_Adder_feedback_as_counter_demo.xmc