Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow Handling in arm_fir_q31 Function #175

Open
lokesh-0706 opened this issue Apr 23, 2024 · 2 comments
Open

Overflow Handling in arm_fir_q31 Function #175

lokesh-0706 opened this issue Apr 23, 2024 · 2 comments
Labels
question Further information is requested

Comments

@lokesh-0706
Copy link

In CMSIS/DSP/Source/FilteringFunctions/arm_fir_q31.c, the FIR filter implementation uses wraparound for accumulator overflow and saturation for output overflow. Is this intended behaviour?

And also, Would it be possible to consider providing a more unified approach to overflow handling within this function? Ideally, offering the option to choose either:

  • Wraparound for both accumulator and output overflow, or
  • Saturation for both accumulator and output overflow.
@JonatanAntoni JonatanAntoni transferred this issue from ARM-software/CMSIS_5 Apr 29, 2024
@JonatanAntoni
Copy link
Member

@lokesh-0706, I moved your question to the new home of CMSIS-DSP and leave it up the maintenance team to respond.

@christophe0606
Copy link
Contributor

@lokesh-0706 It is intended behavior. With q31 in general CMSIS-DSP requires the signal to be pre-scaled to avoid saturation.
The reason is that instruction set can saturate MAC to q30 but not q31 and for performance reason we do not want to scale to q30, saturate and scale back to q31 for each sample.

Note that if you build for Helium instruction set (Cortex-M55 or M85), you get saturation in this case since it is supported by the vector instruction set (but documentation has not been updated to highlight this).

@christophe0606 christophe0606 added the question Further information is requested label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants