Freescale Semiconductor ColdFire MCF52210 User Manual

Page 89

Advertising
background image

Multiply-Accumulate Unit (MAC)

MCF52211 ColdFire® Integrated Microcontroller Reference Manual, Rev. 2

Freescale Semiconductor

4-13

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

then {

MACSR.V = 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:32] != 0x0000_0000)

then {

/* product overflow */

MACSR.V = 1

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

then result[31:0] = 0x0000_0000

else if (MACSR.OMC == 1)

then /* overflowed MAC,

saturationMode enabled */

result[31:0] = 0xffff_ffff

}

/* scale product before combining with accumulator */

switch (SF)

/* 2-bit scale factor */

{

case 0:

/* no scaling specified */

break;

case 1:

/* SF = “<< 1” */

if (product[31] == 1)

then {MACSR.V = 1

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

then result[31:0] = 0x0000_0000

else if (MACSR.OMC == 1)

then /* overflowed MAC,

saturationMode enabled */

result[31:0] = 0xffff_ffff

}

else product[31:0] = {product[30:0], 0}

break;

case 2:

/* reserved encoding */

break;

case 3:

/* SF = “>> 1” */

product[31:0] = {0, product[31:1]}

break;

}

/* combine with accumulator */

if (MACSR.V == 0)

Advertising
This manual is related to the following products: