Skip to main content
CTabo.1
Senior
June 10, 2024
Solved

Integer overflow modes on Cortex

  • June 10, 2024
  • 4 replies
  • 1811 views

Hello,
I am dealing with fixed-point arithmetic calculations on STM32G0.

To avoid integer overflow risks I have scaled properly all the values involved in calculations, but a mistake can be always possible...

On Texas Instruments DSPs, I have the possibility to switch the integer overflow mode, from wrap to saturate, thanks to a couple of intrinsic instructions.
Is there such a possibility also on Cortex processors (and in particular on Cortex M0+)?

Thank you,
Carlo

This topic has been closed for replies.
Best answer by mƎALLEm

There is no saturation support in M0 /M0+ core but I think it's supported by other Cortex-M like M33:

https://developer.arm.com/documentation/100235/0004/the-cortex-m33-instruction-set/saturating-instructions

4 replies

mƎALLEm
ST Technical Moderator
June 10, 2024
To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
CTabo.1
CTabo.1Author
Senior
June 10, 2024

Thank you @mƎALLEm.
So there isn't an hardware support on Cortex-M processors to switch the integer overflow from wrap mode to saturate mode, like TI.
It must be handled by software...

Regards,
Carlo

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
June 10, 2024

There is no saturation support in M0 /M0+ core but I think it's supported by other Cortex-M like M33:

https://developer.arm.com/documentation/100235/0004/the-cortex-m33-instruction-set/saturating-instructions

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.