Freescale Semiconductor MCF54455 Reference Manual page 143

Table of Contents

Advertisement

Enhanced Multiply-Accumulate Unit (EMAC)
MACSR.PAVn = 0
/* select the input operands */
if (sz == word)
then {if (U/Ly == 1)
}
else {operandY[31:0] = Ry[31:0]
}
/* perform the multiply */
product[63:0] = operandY[31:0] * operandX[31:0]
/* check for product overflow */
if (product[63:40] != 0x0000_00)
then {
}
/* zero-fill to 48 bits before performing any scaling */
/* scale product before combining with accumulator */
switch (SF)
{
case 0:
case 1:
case 2:
case 3:
}
/* combine with accumulator */
if (MACSR.PAVn == 0)
then {if (inst == MSAC)
}
/* check for accumulation overflow */
if (accumulationOverflow == 1)
5-19
then operandY[31:0] = {0x0000, Ry[31:16]}
else operandY[31:0] = {0x0000, Ry[15:0]}
if (U/Lx == 1)
then operandX[31:0] = {0x0000, Rx[31:16]}
else operandX[31:0] = {0x0000, Rx[15:0]}
operandX[31:0] = Rx[31:0]
/* product overflow */
MACSR.PAVn = 1
MACSR.V = 1
if (inst == MSAC && MACSR.OMC == 1)
then result[47:0] = 0x0000_0000_0000
else if (MACSR.OMC == 1)
then /* overflowed MAC,
saturationMode enabled */
result[47:0] = 0xffff_ffff_ffff
product[47:40] = 0
/* 2-bit scale factor */
/* no scaling specified */
break;
/* SF = "<< 1" */
product[40:0] = {product[39:0], 0}
break;
/* reserved encoding */
break;
/* SF = ">> 1" */
product[39:0] = {0, product[39:1]}
break;
then result[47:0] = ACCx[47:0] - product[47:0]
else result[47:0] = ACCx[47:0] + product[47:0]
/* zero-fill upper byte */
Freescale Semiconductor

Advertisement

Table of Contents
loading

Table of Contents