RL78 problem with hardware multiplier/divider accumulator in G13 CPUs with GCC compiler V15.01

 
I have some code in an INTERRUPT service routine that multiplies two 16 bit values into a 32 bit result
 
I also have some code in the main loop that multiplies two 16 bit values into a 32 bit result
 
Looking at the Interrupt function I see that it uses the Hardware multiplier/divider accumulator to do the grunt work
Looking at the main loop Code I see that it uses the Hardware multiplier/divider accumulator to do the grunt work
==>> The problem I have noticed is that the main loop sometimes gets wrong results
 
I am using the GCC Compiler V15.01
 
Solution 1 ) how to tell the GCC C Compiler to NOT use the Hardware multiplier/divider accumulator in INTERRUPT functions !!!!
Solution 2) Turn off and back on INTs in the main loop around the Hardware multiplier/divider accumulator code  to prevent ISR getting in the middle
Solution 3) Use a software shift and Add method to do the multiply 
 
My preference is to use Solution 1)
   
Parents Reply Children
No Data