Freescale Semiconductor MCF5480 User Manual

Page 163

Advertising
background image

EMAC Instruction Set Summary

MCF548x Reference Manual, Rev. 3

Freescale Semiconductor

4-15

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

then /* accumulation overflow,

saturationMode enabled */

if (result[47] == 1)

then result[47:0] = 0x0000_7fff_ffff
else result[47:0] = 0xffff_8000_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:31] == 0x0000_0) || (ACCx[47:31] == 0xffff_1))

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

break;

case 1,3:

/* signed fractionals */

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

then {

MACSR.PAVx = 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[23:0] > 0x80_0000)
then product[63:24] = product[63:24] + 1

else if ((product[23:0] == 0x80_0000) && (product[24] == 1))

then product[63:24] = product[63:24] + 1

}

/* sign-extend to 48 bits and combine with accumulator */
/* check for the -1 * -1 overflow case */
if ((operandY[31:0] == 0x8000_0000) && (operandX[31:0] == 0x8000_0000))

then product[71:64] = 0x00

/* zero-fill */

else product[71:64] = {8{product[63]}}

/* sign-extend */

if (inst == MSAC)

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

Advertising
This manual is related to the following products: