DSP MAC Overview

Managing the MAC

The MAC, or “Multiply And Accumulate”, class of dual-operand DSP instructions are commonly used to perform the main Dot Product operation in Finite Impulse Response or FIR filters, as well as in several other DSP algorithms. The uniqueness of the instructions in this category is that they have a ‘split’ view of the data space, which enables them to access data from the X and Y data spaces simultaneously. The basic MAC operation is A = A + x*y, where A is an accumulator, and x and y are the source operands. The values x and y are obtained directly from two W registers, chosen from the subset W4 through W7. Concurrently, the x and y values, which may be required for a subsequent MAC instruction, can be pre-fetched from X and Y data space respectively, using Indirect Addressing. Either W8 or W9 may be used as a pointer into X data space, and either W10 or W11 may be used as a pointer into Y data space.

WRegisters.png

MAC = Multiply And Accumulate

  • Basic operation is A = A + x*y
  • Most fundamental operation used in DSP
  • Requires two simultaneous reads from data memory
    • Data memory is split into X and Y data memory
  • Two reads, one multiply, one add, one write-back all performed in a single cycle
  • Uses pre-defined W registers to accomplish this by pre-fetching

Data Memory Organization

The two data spaces, X and Y, are accessed using two Address Generation Units (X AGU and Y AGU) and separate data paths. These two AGUs are used simultaneously in order to facilitate dual-operand fetch for DSP instructions. It is important to keep in mind that the address boundaries of X and Y-spaces are device dependent.

MemoryOrganization.png

Multiply and Accumulate

As shown in the diagram below, by repeatedly executing a MAC instruction, it is possible to obtain the sum-of-products, or dot product, of 2 arrays, denoted here as X and Y. In this figure, the actions and results of each MAC operation is demarcated by a different color. The X space data can alternatively be pre-fetched from program memory. Thus, it is possible to store some constant data (such as FIR filter coefficients or FFT twiddle factors) in Flash memory, thereby minimizing RAM usage.

MultiplyandAcc.png
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.