Freescale Semiconductor MCF5480 User Manual

Page 164

Advertising
background image

MCF548x Reference Manual, Rev. 3

4-16

Freescale Semiconductor

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

then {MACSR.PAVx = 1

MACSR.V = 1
if (MACSR.OMC == 1)

then /* accumulation overflow,

saturationMode enabled */

if (result[47] == 1)

then result[47:0] = 0x007f_ffff_ff00
else result[47:0] = 0xff80_0000_0000

}

/* transfer the result to the accumulator */
ACCx[47:0] = result[47:0]

}

MACSR.V = MACSR.PAVx
MACSR.N = ACCx[47]
if (ACCx[47:0] == 0x0000_0000_0000)

then MACSR.Z = 1
else MACSR.Z = 0

if ((ACCx[47:39] == 0x00_0) || (ACCx[47:39] == 0xff_1))

then MACSR.EV = 0
else MACSR.EV = 1

break;
case 2:

/* unsigned integers */

if (MACSR.OMC == 0 || MACSR.PAVx == 0)

then {

MACSR.PAVx = 0
/* select the input operands */
if (sz == word)

then {if (U/Ly == 1)

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

}
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:40] != 0x0000_00)

then {

/* product overflow */

MACSR.PAVx = 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 */

Advertising
This manual is related to the following products: