This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Rouding problem using ARM DSP command

Note: This was originally posted on 27th December 2011 at http://forums.arm.com

Wish everyone have a happy holiday season!

I am trying to use ARM DSP command smulwx and smlawx command to implement an IIR filter, found a big DC offset in the result. Looking into it, I found it is because these commands will do (32bits X 16bits)>>16, so basically they are doing floor, instead of round. I can duplicate this in Matlab. Wondering whether anyone use these commands before and how to solve this issue.

Difficulty to me is that these DSP commands have no intermitent result, it will do multiplication and then arithmatic shifting 16 bits, good thing is that it fast, but there is no middle result that i can grab to do rounding myself. checked the document from ARM, there is no option to let these commands to do round instead of floor. I am surprised why they do not do this...

Thank you.

Parents
  • Note: This was originally posted on 28th December 2011 at http://forums.arm.com


    Wish everyone have a happy holiday season!

    I am trying to use ARM DSP command smulwx and smlawx command to implement an IIR filter, found a big DC offset in the result. Looking into it, I found it is because these commands will do (32bits X 16bits)>>16, so basically they are doing floor, instead of round. I can duplicate this in Matlab. Wondering whether anyone use these commands before and how to solve this issue.

    Difficulty to me is that these DSP commands have no intermitent result, it will do multiplication and then arithmatic shifting 16 bits, good thing is that it fast, but there is no middle result that i can grab to do rounding myself. checked the document from ARM, there is no option to let these commands to do round instead of floor. I am surprised why they do not do this...

    Thank you.


    I'd say, add first something to a and b so you get (a*b+0x8000)>>16.

    42BS
Reply
  • Note: This was originally posted on 28th December 2011 at http://forums.arm.com


    Wish everyone have a happy holiday season!

    I am trying to use ARM DSP command smulwx and smlawx command to implement an IIR filter, found a big DC offset in the result. Looking into it, I found it is because these commands will do (32bits X 16bits)>>16, so basically they are doing floor, instead of round. I can duplicate this in Matlab. Wondering whether anyone use these commands before and how to solve this issue.

    Difficulty to me is that these DSP commands have no intermitent result, it will do multiplication and then arithmatic shifting 16 bits, good thing is that it fast, but there is no middle result that i can grab to do rounding myself. checked the document from ARM, there is no option to let these commands to do round instead of floor. I am surprised why they do not do this...

    Thank you.


    I'd say, add first something to a and b so you get (a*b+0x8000)>>16.

    42BS
Children
No data