number format multiply divide in STM32H757
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-09 3:11 AM - last edited on ‎2025-01-09 5:26 AM by mƎALLEm
Hi,
- Labels:
-
Other software
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-09 4:51 AM
we are working on real time data, so scaling is not working for us
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-09 7:17 AM
> 1 - I can do 2 16-bit signed fraction number multiply or divide and result should also be in 16-bit signed fraction.
In the same instruction? There isn't an instruction for that. You could make your own macro but it wouldn't be particularly fast, which seems like the goal here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-09 8:11 PM
Please suggest alternative for it, as in other mcu we get this type of functionality
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-09 10:08 PM
> define to convert any integer number (value less will be less than "1"
The only non-negative integer number less than 1 I know of, is 0.
Arm CMSIS-DSP is a library which supports a q15_t type calculations and conversions for 16-bit fraction numbers.
hth
KnarfB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-09 10:42 PM
> Arm CMSIS-DSP is a library which supports a q15_t type calculations and conversions for 16-bit fraction numbers.
Would have been my suggestion, too.
As a side note, this q<nn> datatypes are natively supported by almost all DSPs, usually in the single-instruction fashion the OP asks for.
Cortex M is not a platform otimized for realtime, high-throughput applications.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-09 11:58 PM
For multiplication, (a * b) >> 16 should do. For division - go figure your school task by yourself. ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-10 4:10 AM - edited ‎2025-01-10 4:11 AM
If the number you are dividing by (the divisor) is a constant, or one that changes less frequently than the numerator, then normal practice is to calculate k=1/d (where d = your divisor), save that value, then use: y = x*k (= x/d) as your real-time single cycle divide operation. You can of course wrap other scaling operations into this by using k = s / d, then y = k*x = s*x/d as a single cycle multiply and divide operation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-13 2:53 AM - edited ‎2025-01-14 12:59 AM
@vishalb1911 wrote:we are working on real time data, so scaling is not working for us
That's a non-sequitur - the fact that it's real-time data does not preclude the use of scaling.
Perhaps you do have other reasons why scaling may not work in your particular application - but simply being "real time" is not one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-14 12:57 AM
I believe this is a veiled admission that the project management significantly underestimated the requirements, and chose a MCU with insuffient performance and resources for financial reasons.
A recurring theme, if you ask me.
