Freescale Semiconductor MCF5480 User Manual

Page 162

Advertising
background image

MCF548x Reference Manual, Rev. 3

4-14

Freescale Semiconductor

}
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]

/* check for product overflow */
if ((product[63:39] != 0x0000_00_0) && (product[63:39] != 0xfff

f_ff_1))

then {

/* product overflow */

MACSR.PAVx = 1
MACSR.V = 1
if (inst == MSAC && MACSR.OMC == 1)

then if (product[63] == 1)

then result[47:0] = 0x0000_7fff_ffff
else result[47:0] = 0xffff_8000_0000

else if (MACSR.OMC == 1)

then /* overflowed MAC,

saturationMode enabled */

if (product[63] == 1)

then result[47:0] = 0xffff_8000_0000
else result[47:0] = 0x0000_7fff_ffff

}

/* sign-extend to 48 bits before performing any scaling */

product[47:40] = {8{product[39]}}

/* sign-extend */

/* scale product before combining with accumulator */
switch (SF)

/* 2-bit scale factor */

{

case 0:

/* no scaling specified */

break;

case 1:

/* SF = “<< 1” */

product[40:0] = {product[39:0], 0}
break;

case 2:

/* reserved encoding */

break;

case 3:

/* SF = “>> 1” */

product[39:0] = {product[39], product[39:1]}
break;

}

if (MACSR.PAVx == 0)

then {if (inst == MSAC)

then result[47:0] = ACCx[47:0] - product[47:0]
else result[47:0] = ACCx[47:0] + product[47:0]

}

/* check for accumulation overflow */
if (accumulationOverflow == 1)

then {MACSR.PAVx = 1

Advertising
This manual is related to the following products: