AnsweredAssumed Answered

Coldfire V2 EMAC help

Question asked by Ron Ferrari on Apr 2, 2014
Latest reply on May 3, 2014 by Shaun James


I am looking for some suggestions on how to use the MAC or EMAC.

I am using CodeWarrior 7.1 and the MCF52235.


I am not doing any special DSP code or algorithm, just need to do a 16x16 multiple and accumulate as quickly as possible.

The 16 x 16 multiply and accumulate must be done 8 times spread through a function and other code.

I am working in C, so for example I have:


register int Input1;          // defined as int, but value limited to 12 bits so multiply and accumulate won't overflow 32-bits.

register int Sum;


Input1 = read A2D

Sum += Input1 x Input1;

... other code

Input 1 = read A2D

Sum += Input1 x Input1

... other code, etc

... after summing 8 times save the Sum


Defining Input1 and Sum as registers made the assembly faster.

Is it possible to use the MAC or EMAC staying in C?   Are there compiler extensions for these registers?

If I use inline assembly I don't see how to know what register the compiler chose for these values.


This is my first experience with CodeFire and hardware multipliers.

Thanks for the help.