Circular Trigger Buffer
Overview
This operator copies input values into a circular buffer, which has the length specified in the property BufferLength. Samples are copied to the buffer continuously. After BufferLength samples, the oldest samples are shifted out. This way, on every trigger, the buffer will contain the most recent BufferLength samples.The buffer will be placed at the output, as soon as a trigger pulse is read on the trigger input. A trigger is a pseudo-boolean signal that rizes from around 0 to around 1 (see this: "Pseudo-booleans and triggers").
Operator ports
Input S_in: Floating point valuesInput S_trigger: Floating point values
Output V_out: Floating point value buffers
Properties
Find more information about changing properties here: "Properties Viewer"BufferLength
type: Integer valueThe length of the outgoing buffer
VectorOutput
type: True or FalseDetermine if the output buffers are just data buffers (false), or mathematical vectors (true).
Select one of those presets:
True or False
True may also be read like 'yes' and false like 'no'
True or False
True may also be read like 'yes' and false like 'no'
Many operators in Polybench can be used for data buffers as well as for mathematical vectors (describing points in a multi-demensional space). Some of the operators behave differently for buffers and vectors, therefore if you intend to do vector calculation, it is important to set this property.
Caption
type: Word or phraseThe 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 descriptionOptional documentation of this object. If this object is an operator, the Documentation text is displayed below the operator symbol.
Details
Basic working of a circular buffer
A circular buffer is a storage for samples with the property that only the BufferLength last samples are stored. If a new samples is put into the buffer, then the oldest sample is removed, so that the total number of samples always stays BufferLength.The contents of the buffer can be depicted like in the next table. The left column shows the steps, and the right column the identifiers of the samples in the buffer:
N | buffer -------------- 1 | 0 0 0 1 2 | 0 0 1 2 3 | 0 1 2 3 4 | 1 2 3 4 5 | 2 3 4 5 6 | 3 4 5 6 7 | 4 5 6 7 8 | 5 6 7 8 9 | 6 7 8 9 etc.
Properties of the buffer
The circular buffer will be of length BufferLength and will have an irregular sample rate, because the triggers come at irregular moments in time.The trigger input accepts only one channel, because a trigger works for all channels equally. It is not possible to trigger separate channels.
In the starting-up phase, where the buffer does not yet contain samples to fill the complete buffer, the empty spaces are filled with samples that have all values set to 0.
Schematic explanation of the buffer's working
The left rectangle shows 9 floating point samples and 3 trigger samples that arrive at the input of the Circular Trigger Buffer operator. The Circular Trigger Buffer is set up to put out buffers with 3 fields. The first trigger causes sample 1,2 and 3 to be copied to a buffer sample, shown in the right rectangle. The second trigger copies the continuing buffer to the output. Because the trigger came in less than 3 samples, this buffer overlaps and sample 3 is reused in the second buffer. The third trigger again copies the continuing buffer to the output, but because the trigger came later than 3 samples, sample 6 was already overwritten by sample 9, so that sample 6 is lost.
Buffers or vectors
In many cases this operator is used to create buffers of data for statistical purposes, but sometimes the buffers are interpreted as mathematical (complex) vectors, describing points in a multidimensional space. Those vectors use the same infrastructure as ordinary buffers, so there is almost no difference - except that some calculations are different for buffers and vectors.See the VectorOutput property to control this behavior.
Operators that behave differently for buffers and vectors will have extra notes in the manual that describe the way they handle vectors.
Examples
Example: Circular Trigger Example
The Circular Trigger transforms streaming data into vectors linearly. When the last field of the vector is filled, the operator will return to the first field and start over again. At a trigger, the buffer is placed at the output. The output is constant, so it has no frequency.Examples\DF0507020_001_CircularTrigger_Exmp.xmc