EMAC Instruction Set Summary

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]

/*

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)

MOTOROLA

Chapter 3. Enhanced Multiply-Accumulate Unit (EMAC)

3-17

Page 121
Image 121
Motorola MCF5281, MCF5282 user manual Macsr.Z =