2 mac instruction set summary, Mac instruction set summary -8, 3 muls/mulu – Freescale Semiconductor ColdFire MCF52210 User Manual

Page 84: 4 scale factor in mac or msac instructions

Advertising
background image

Multiply-Accumulate Unit (MAC)

MCF52211 ColdFire® Integrated Microcontroller Reference Manual, Rev. 2

4-8

Freescale Semiconductor

int macsr;

} macState;

The following assembly language routine shows the proper sequence for a correct MAC state save. This
code assumes all Dn and An registers are available for use, and the memory location of the state save is
defined by A7.

MAC_state_save:

move.l macsr,d7

; save the macsr

clr.l d0

; zero the register to ...

move.l d0,macsr

; disable rounding in the macsr

move.l acc,d5; save the accumulator

move.l mask,d6

; save the address mask

movem.l #0x00e0,(a7); move the state to memory

This code performs the MAC state restore:

MAC_state_restore:

movem.l (a7),#0x00e0; restore the state from memory

move.l #0,macsr

; disable rounding in the macsr

move.l d5,acc; restore the accumulator

move.l d6,mask

; restore the address mask

move.l d7,macsr

; restore the macsr

Executing this sequence type can correctly save and restore the exact state of the MAC programming
model.

4.3.1.3

MULS/MULU

MULS and MULU are unaffected by fractional-mode operation; operands remain assumed to be integers.

4.3.1.4

Scale Factor in MAC or MSAC Instructions

The scale factor is ignored while the MAC is in fractional mode.

4.3.2

MAC Instruction Set Summary

Table 4-6

summarizes MAC unit instructions.

Table 4-6. MAC Instruction Summary

Command

Mnemonic

Description

Multiply Signed

muls <ea>y,Dx

Multiplies two signed operands yielding a signed result

Multiply Unsigned

mulu <ea>y,Dx

Multiplies two unsigned operands yielding an unsigned result

Multiply Accumulate

mac Ry,RxSF

msac Ry,RxSF

Multiplies two operands, then adds/subtracts the product
to/from the accumulator

Multiply Accumulate
with Load

mac Ry,RxSF,Rw

msac Ry,RxSF,Rw

Multiplies two operands, combines the product to the
accumulator while loading a register with the memory
operand

Load Accumulator

move.l {Ry,#imm},ACC

Loads the accumulator with a 32-bit operand

Store Accumulator

move.l ACC,Rx

Writes the contents of the accumulator to a CPU register

Advertising
This manual is related to the following products: