RM0440 Rev 4 503/2126
RM0440 Filter math accelerator (FMAC)
513
18.3.11 Examples of filter operation
Figure 50. Filtering example 1
The example in Figure 50 illustrates the beginning of a filter operation. The filter has four
taps (P=4). The X1 buffer size is six and the Y buffer size is two. The FULL_WM and
EMPTY_WM bitfields are both set to 0. Prior to starting the filter, the X1 buffer has been pre-
loaded with four samples, x[0:3] as in Figure 49. So the filter starts calculating the first
output sample, y[0], immediately after the START bit is set. Since the X1FULL flag is not set
(due to two uninitialized spaces in the X1 buffer), the interrupt is asserted straight away, to
request new data. The processor writes two new samples, x[4] and x[5], to the
FMAC_WDATA register, which are transferred to the empty locations in the X1 buffer.
In the mean time, the FMAC finishes calculating the first output sample, y[0], and writes it
into the Y buffer, causing the Y_EMPTY flag to go low. At the same time, the x[0] sample is
discarded, as it is no longer required, freeing up its location in memory (at X1_BASE). The
FMAC can immediately start work on the second output sample, y[1], since all the required
input samples x[1:5] are present in the X1 buffer.
Since the Y_EMPTY flag is low, the interrupt remains active after the processor finishes
writing x[5]. The processor reads y[0] from the FMAC_RDATA register, freeing up its
location in the Y buffer. There are now no samples in the output buffer since y[1] is still being
calculated, so the Y_EMPTY flag goes high. Nevertheless, the interrupt remains active,
because there is still free space in the X1 buffer, which the processor next fills with x[6], and
so on.
Note: In this example, the processor can fill the input buffer more quickly than the FMAC can
process them, so the X1_full flag regularly goes active. However, it struggles to read the Y
buffer fast enough, so the FMAC stalls regularly waiting for space to be freed up in the Y
buffer. This means the filter is not executing at maximum throughput. The reason is that the
x[0]
x[1]
x[6]
x[2]
x[3]
FMAC_PARAM
register write:
FUNC = 8 (FIR Filter)
P = 4
START = 1
FMAC_WDATA
register write:
WDATA = x[5]
FMAC_WDATA
register write:
WDATA = x[4]
FMAC_WDATA
register write:
WDATA = x[6]
FMAC_WDATA
register write:
WDATA = x[7]
XX
XX
Software register access
START
X1_BASE
X1_BASE + 0x1
X1_BASE + 0x2
X1_BASE + 0x3
X1_BASE + 0x4
X1_BASE + 0x5
X1_FULL
Interrupt
x[4]
x[5]
Calculate y[0] using x[0:3] Calculate y[1] using x[1:4] Calculate y[2] using x[2:5]
Y_BASE
Y_BASE + 0x1
XX y[0]
XX y[1]
y[2]
Spare
Spare x[7]
MAC activity
X1 buffer
X1_BUF_SIZE = 6
Y buffer
Y_BUF_SIZE = 2
Y_EMPTY
FMAC_RDATA
register read:
RDATA = y[0]
Spare
No more space in X1 buffer
Calculate y[3] using x[3:6]
FMAC_RDATA
register read:
RDATA = y[1]
Spare
FMAC_WDATA
register write:
WDATA = x[8]
x[8]
y[3]
FMAC_RDATA
register read:
RDATA = y[2]
Calculate y[4] using x[4:7]
FMAC_WDATA
register write:
WDATA = x[9]
FMAC_RDATA
register read:
RDATA = y[3]
Calculate y[5]
x[9]
Stalled
No more space in Y buffer
Spare
Spare
Spare
Spare
Spare
y[3]
MSv47129V1