

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Circular buffers, a type of first-in-first-out (fifo) data storage solution commonly used in digital signal processing algorithms. The text compares shifted buffers and circular buffers, explaining the advantages of the latter. It includes pseudo-code for implementing a circular buffer.
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!
This work is produced by The Connexions Project and licensed under the Creative Commons Attribution License †
Abstract Circular buers are used for rst-in-rst-out (FIFO) buers.
When performing DSP algorithms data needs to be stored as it is being input. Only a certain amount of data is kept. New data is saved and the old data is removed. This is a rst-in-rst-out (FIFO) buer. There are two ways to implenent the FIFO buer. One is to shift the data and the other is to implement a circular buer.
There are two ways of implementing a FIFO buer. Both methods start with dening an array that is the length of data needed to be stored. The rst method of implementing a FIFO buer is to add the new data to the beginning of the buer and shifting the old data in the buer. The last value that is shifted out is discarded or used before it is removed.
Figure 1
To implement the FIFO buer by shifting the following pseudo-code can be used. N - number of coecients x(n) - stored input data, n = 0...N- input_sample - variable that contains the newest input sample ∗Version 1.2: Feb 28, 2011 11:38 pm US/Central †http://creativecommons.org/licenses/by/3.0/
// Shift in the new sample. Note the data is shifted starting at the end. for (i=N-2; i>=0; i--){ x[i+1] = x[i]; } x[0] = input_sample
The second method is the more preferable method since it takes less processing. In this method a circular buer is implemented. An index keeps track of the current point in the buer. The data in the buer does not get shifted, the index gets incremented and wrapped around when it gets to the end of the buer. The element after the current index is the last value in the circular buer. The following gure shows the circular buer after the index has already wrapped around.
Figure 2
In the following gure is an example of a FIFO circular buer with the number elements equal to 7. In the gure the current index is 3 and that is where the new sample is stored. The last element in the buer is in element 4.
Figure 3: FIFO buer implemented using a circular buer