SPRUIM2H May 2020 – October 2023 AM2431 , AM2432 , AM2434 , AM6411 , AM6412 , AM6421 , AM6422 , AM6441 , AM6442
The following steps are performed by the PRU firmware for multiply and accumulate mode:
1. Enable multiply and accumulate MAC_MODE.
(a) Set R25[1-0] = 1 for accumulate mode.
(b) Store MAC_MODE to MAC using XOUT instruction with the following parameters:
- Device ID = 0
- Base register = R25
- Size = 1
2. Clear accumulator and carry flag.
(a) Set R25[1-0] = 2 to clear carry flag (R25[1]=1) and clear accumulator (R25[0]=0).
(b) Store accumulator to MAC using XOUT instruction on R25.
3. Load operands into R28 and R29.
4. Multiply and accumulate, XOUT R25[1-0] = 1
Repeat step 4 for each multiply and accumulate using same operands.
Repeat step 3 and 4 for each multiply and accumulate for new operands.
5. Load the accumulated product into R26, R27, and the ACC_CARRY status into R25 using the XIN instruction.
Firmware can load/seed the accumulator by doing XOUT of R27:R26. This will also clear the carry flag.
Steps one and two are required to set the accumulator mode and clear the accumulator and carry flag.