Skip to main content
Graduate II
June 10, 2024
Solved

Integer overflow modes on Cortex

  • June 10, 2024
  • 1 reply
  • 1769 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

    1 reply

    CTabo.1Author
    Graduate II
    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ƎALLEmAnswer
    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