Integrated Microcontroller Reference Manual

Multiply-Accumulate Unit (MAC)
MCF52211 ColdFire® Integrated Microcontroller Reference Manual, Rev. 2
4-12 Freescale Semiconductor
break;
case 1:
case 3: /* signed fractionals */
if (MACSR.OMC == 0 || MACSR.V == 0)
then {
MACSR.V = 0
if (sz == word)
then {if (U/Ly == 1)
then operandY[31:0] = {Ry[31:16], 0x0000}
else operandY[31:0] = {Ry[15:0], 0x0000}
if (U/Lx == 1)
then operandX[31:0] = {Rx[31:16], 0x0000}
else operandX[31:0] = {Rx[15:0], 0x0000}
}
else {operandY[31:0] = Ry[31:0]
operandX[31:0] = Rx[31:0]
}
/* perform the multiply */
product[63:0] = (operandY[31:0] * operandX[31:0]) << 1
/* check for product rounding */
if (MACSR.R/T == 1)
then { /* perform convergent rounding */
if (product[31:0] > 0x8000_0000)
then product[63:32] = product[63:32] + 1
else if ((product[31:0] == 0x8000_0000) && (product[32] == 1))
then product[63:32] = product[63:32] + 1
}
/* combine with accumulator */
if (inst == MSAC)
then result[31:0] = acc[31:0] - product[63:32]
else result[31:0] = acc[31:0] + product[63:32]
/* check for accumulation overflow */
if (accumulationOverflow == 1)
then {MACSR.V = 1
if (MACSR.OMC == 1)
then /* accumulation overflow,
saturationMode enabled */
if (result[31] == 1)
then result[31:0] = 0x7fff_ffff
else result[31:0] = 0x8000_0000
}
/* transfer the result to the accumulator */
acc[31:0] = result[31:0]
MACSR.N = result[31]
if (result[31:0] == 0x0000_0000)
then MACSR.Z = 1
else MACSR.Z = 0
}
break;
case 2: /* unsigned integers */