beautypg.com

Freescale Semiconductor MCF5480 User Manual

Page 165

background image

EMAC Instruction Set Summary

MCF548x Reference Manual, Rev. 3

Freescale Semiconductor

4-17

result[47:0] = 0xffff_ffff_ffff

}

/* zero-fill to 48 bits before performing any scaling */

product[47:40] = 0

/* zero-fill upper byte */

/* 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] = {0, product[39:1]}
break;

}

/* combine with accumulator */
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

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

}

/* 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:32] == 0x0000)

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

break;

}

This manual is related to the following products: