DSP Input Data Buffers
Last Update: 04-Aug-00
Event Data in both DSPs 1-4 and DSP 5 is stored in separate Data
Buffers for each possible input data source.
A finished event's worth of data in the DSP's FIFO is flagged by the
presence of an input word on the DSP's serial
input port (MCBSP1) which will cause an interrupt to the DSP.
DSP 5 requires these separate buffers to deal with event
interleaving of data from DSPs 1-4 and possible full-readout data.
Separate buffers for each input are not stictly necessary for DSPs 1-4
since data arrives ordered by source and event.
They are used to be more consistent with DSP 5.
The main requirement of the buffer management scheme is speed.
This has several consequences.
- A request for data input to the DSP always takes precedence over
any other process running in the DSP. This implies that we will
use serial port interrupts (at some point).
- No error checking is performed as the data is read into
buffers. The physics algorithm will be responsible for data
verification.
Each buffer will be circular and will be allowed to contain variable size
entries.
This requires a slightly more complicated algorithm for managing
read and write pointers than for the case of fixed element size,
however, savings in memory and speed using this method should be
substantial.
In particular, variable size entries mean that an overflow
memory must be included at the end of each buffer's main
memory to allow events to always be transferred to the buffer in
single blocks by DMA.
Each buffer thus has two components:
- Main Memory: the main part of the buffer. It's size should be
determined by the average event size for the associated input
channel's data times the number of buffer elements required
(16?)
- Overflow Memory: used to absorb input events that would overflow
the Main Memory. This allows us to wrap around the buffer in a
controlled way. It must be larger than the maximum size of an
event on that input.
Writes to the Buffer will be performed by a DMA of the number of words
specified in the DSP FPGA Stack Word
from the DSP FIFO to a starting buffer location contained in a write
pointer kept by the Buffer Manager.
Care must be taken that the data waiting to be written will not
overfill the buffer.
If this is the case, the buffer manager will return a buff_full
condition and return to the main algorithm until memory is released
from the buffers by reading an event.
Another situation that requires care occurs when the stack counter
overflows (>256 words in the data from one input channel). In this
case, a stack word is written to the DSP serial port with the
O-bit (but not the C-bit) set and
with wrdcnt=255. Another stack word is generated for the rest
of the data, or more than one may be necessary if there are more than
256 words remaining.
When a stack counter overflow condition occurs the buffer manager must
recognize it, and continue filling the buffer for this channel with the
next stack word's data. This requires that the buffer manager must
keep track of the starting address for its data and must use a running
sum of the wrdcnt's for each transfer in this channel.
After all the active channels in a DSP have transfered their data,
the buffers are read by the physics algorithm running in the DSP which
puts the event data to a physics event structure
and then signals the buffer manager that the buffer just read is now free.
This structure is then used for all data accesses by the physics algorithm.
Because the physics algorithm may not always keep up with the rate of
data input, pointers to full buffer elements must be maintained in a
read pointer stack which is read as a FIFO.
DSP 1-4 Data Buffers
Since the SLIC has 16 total inputs there can be at most 16
buffers in any DSP.