I've a question about the simple integer multiplication.
I'm amplifying an ADC result with a gain factor: the problem is that I do the moltiplication with the simple integer multiplication "*"(with is translated to IMPY.L in asm) and the core does not saturate the output; if accidentally the original signal grow too much the moltiplication overflows. This happens even if I enable saturation on the core.
Attached you can find an example project that runs on DSC Full Chip Simulator and a screenshot of the overflowed result.
My question is: is there a way to do this multiplication with saturation?
The only alternative I've found till now is to calculate the limit of the unamplified signal and to limit it...
I'm using Codewarrior for MCU version 10.6; the target is a MC56F84763.
Thanks everyone for your help!
From the screenshot, I see that you have used the intrinsic function, for example the __turn_on_sat(), can you use the intrinsic function to compute the integer multiply function?
for example :
Hope it can help you
Hi XiangJun Rong,
thanks for your reply;
the intrinsics mult_r is a fractional multiplication: it doesn't suit my need of amplifying a number (that is FRAC16(0.2) * 2 = FRAC16(0.4))...
I tried with the mult_r_int() instruction with no result: it is translated as a IMPY.L which, as the DSP56800ERM says, does not use the MAC output limiter; and the code deployed on the target confirmed this...
Yesterday I was trying to do it with no result forcing the use of the Data Limiter which I think is disabled in the example above because the result of the multiplication is read through the instruction move.w A0,A... (see below the example on the reference manual)
It should be great to find such an easy solution to limit this operation...
Thanks everyone :-)