cancel
Showing results for 
Search instead for 
Did you mean: 

Integer overflow modes on Cortex

CTabo.1
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions

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 on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

View solution in original post

4 REPLIES 4
SofLit
ST Employee

Hello,

https://community.st.com/t5/stm32-mcus-products/32-sum-with-saturation/td-p/467407

https://www.eevblog.com/forum/microcontrollers/converting-to-cortex-m0-asm/

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

Thank you @SofLit.
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

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 on "Accept as Solution" on the reply which solved your issue or answered your question.
PS: This is NOT an online support (https://ols.st.com) but a collaborative space. So please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.

Thank you for informations.

Regards,
Carlo