SPRUI30H November 2015 – May 2024 DRA745 , DRA746 , DRA750 , DRA756
In certain applications, it is desirable to maintain circular buffers for input data and intermediate results. Thus, circular buffer addressing is supported in VCOP.
Circular buffer addressing option is encoded in the circ_buf field taking up bits 23..20 of base address:
The base address does not need to be aligned to the circular buffer size, in the abive example’s case, 0x400. To avoid any single load/store straddle the circular buffer boundary, the base address and the pointer increments must all be aligned to the access size of each iteration.
For example, when loading N data points of halfword data, where N = 8. Access size = 16, so the base address and any pointer increment must be aligned to multiples of 16.
Hardware adjusts the memory address for circular buffering by this process:
circ_buf = (base >> 20) & 0xF; // extract circ_buf
mask = (0x200 << circ_buf) - 1; // mask = size of buffer - 1
cbuf = (base & 0xFFFFF) & ~mask; // find base addr of buffer
addr = cbuf + (base + agen) & mask; // add offset from base of buffer
For example, base = 0x10420, agen = 0xFF0.
The agen is allowed to go over the circular buffer many times over to wrap back inside, and that agen can even go backward to wrap from the beginning to the end of the buffer.