circular buffer(its urgent)

Status
Not open for further replies.

ravindra kalla

Junior Member level 2
Joined
Aug 3, 2005
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,519
hi

plz anyone tell me about circular buffer.

can we use concept of circular buffer in memory.
thanx
 

Yes, a circular buffer can be created in memory. You need a read and write pointer and a note of where the top and bottom of the buffer are. When adding things, you write them at the write pointer then increment the pointer. If the pointer is at the top of the buffer, then it is wrapped round to the bottom. A check is also required with the write pointer to make sure it doesn't overflow. When reading, the read pointer is checked first to see if it == write pointer: if it is, then the buffer is empty and nothing cna be read. Otherwise, read the data at pointer then increment.

If reads and writes are allowed to occur in the same cycle, then a dual-port RAM is required. Otherwise, there must be a way to hold off accesses and multiplex onto a single port.

It is really one way of implementing a FIFO. The pointers can be CPU registers in a software implementation, or vectors of flipflops in a hardware implementation.
 

A circular buffer is an area of memory that wraps around from its top to its bottom, like a circle: hence the name.
 

they are useful in building systems that handles input data on the fly. assume u have a fir filter that needs 20 input coefficient to produce an out put
u need a a 20 memory location.
with a circular buffer u can do it with less memory.
I can sedn a C example later.
 

temp. storage?
it can be used when u need instant input to be feed into the system.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…