
Multiply Accumulate (MAC)
CY8C24xxx Preliminary Data Sheet
270
Document No. 38-12011 Rev. *E
December 22, 2003
25.2
Application Description
25.2.1
Multiplication with No
Accumulation
For simple multiplication, the MAC block will accept two 8-bit
signed numbers as the multiplicands for a multiply opera-
tion. The product of the multiplication is stored in a 16-bit
signed form. Four registers are involved with simple multipli-
cation: MUL_X, MUL_Y, MUL_DH, and MUL_DL.
To execute a multiply, simply write a value to either the
MUL_X or MUL_Y registers. Immediately after the write of
the multiplicand, the product will be available at registers
MUL_DH and MUL_DL. After reset of the part at power up
or after an external reset, the MAC registers will not be reset
to zero. Therefore, after the write of the first multiplicand, the
product will be indeterminate. After the write of the second
multiplicand, the product registers will be updated with the
product of the first and second multiplicands (assuming one
of the writes was to MUL_X and the other was to MUL_Y).
Multiplication is associative so the order in which you write
to X and Y does not matter.
To summarize whenever a value is written to either of the
multiply input registers, MUL_X or MUL_Y, the product of
MUL_X and MUL_Y is calculated and stored in MUL_DH
and MUL_DL.
25.2.2
Accumulation After Multiplication
Accumulation of products is a feature that is implemented on
top of simple multiplication. When using the MAC to accu-
mulate the products of successive multiplications, two 8-bit
signed values are used for input. The product of the multipli-
cation is accumulated as a 32-bit signed value.
The user has the choice to either cause a multiply/accumu-
late function to take place or a multiply only function. The
user selects which operation is performed by the choice of
input register. The multiply function occurs immediately
whenever the MUL_X or the MUL_Y multiplier input regis-
ters are written, and the result is available in the MUL_DH
and MUL_DL multiplier result registers. The multiply/accu-
mulate function is executed whenever there is a write to the
MAC_X or the MAC_Y multiply/accumulate input registers
and the result is available in the ACC_DR3, ACC_DR2,
ACC_DR1, and ACC_DR0 accumulator result registers. A
write to MUL_X or MAC_X is input as the X value to both the
multiply and multiply/accumulate functions. A write MUL_Y
or MAC_Y is input as the Y value to both the multiply and
multiply/accumulate functions. A write to the MAC_CL0 or
MAC_CL1 registers will clear the value in the four accumu-
late registers.
To clear the accumulated products, simply write to either of
the MAC_CLx registers.
25.3
Register Definitions
25.3.1
MUL_X Register
The multiply X (MUL_X) register is one of the two multipli-
cand registers for the signed 8-bit multiplier in the PSoC
MAC. When this write only register is written, the product of
the written value and the current value of the MUL_Y regis-
ter is calculated.
For additional information, reference the
MUL_X register on
page 144
.
25.3.2
MUL_Y Register
The multiply Y (MUL_Y) register is one of the two multipli-
cand registers for the signed 8-bit multiplier in the PSoC
MAC. When this write only register is written, the product of
the written value and the current value of the MUL_Y regis-
ter is calculated.
For additional information, reference the
MUL_Y register on
page 145
.
25.3.3
MUL_DH Register
The product of the multiply operation on the MUL_X and
MUL_Y registers is stored as a signed 16-bit value. The
read only multiply data high (MUL_DH) register holds the
most significant byte of the 16-bit product.
For additional information, reference the
MUL_DH register
on page 146
.
25.3.4
MUL_DL Register
The product of the multiply operation on the MUL_X and
MUL_Y registers is stored as a signed 16-bit value. The
read only multiply data low (MUL_DL) register holds the
least significant byte of the 16-bit product.
For additional information, reference the
MUL_DL register
on page 147
.
25.3.5
MAC_X/ACC_DR1
This register performs two distinct functions; therefore, two
names are used to refer to the same address. When the
address is written, a multiply operation with accumulation is
performed. The multiply accumulate X (MAC_X) register is
one of the two multiplicand registers for the signed 8-bit mul-
tiply with accumulate operation. When this register is writ-
ten, the product of the written value and the current value of
the MAC_Y register is calculated, then that product is added
to the 32-bit accumulators value. When this address is read,
the accumulator's data register 1 is read. This register holds
the second of four bytes used to hold the accumulator's
value. This byte is the most significant of the lower 16 bits of
the accumulator's value.
For additional information, reference the
MAC_X/ACC_DR1
register on page 148
.