Replace wide integer multiplication
Mostra commenti meno recenti
Hello!
I'm using fixed-point data in a Simulink Embedded Coder project. The multipliers henceforth generate code that requires wide integer operations, because two 32-bit fixedpoint types get multiplied into a 64bit type and then shifted. For 32x32 bit multiplication, the code generator uses the utility-function
mul_wide_u32
mul_wide_s32
This function is complex and for my usecase unecessary as the Cortex M3 architecture has the MULL (long multiply) instruction. Is there a way to automatically replace mul_wide_u32 and mul_wide_s32 with custom functions? Since I use fixed point, I'd need to define a multiplication-function for every n of bitshift, so I'd like to replace just the multiplication and let matlab handle the shifting (mul_u32_loSR and so on).
Tl;Dr;: Can I replace generated code strings or functions with custom ones (not replace blocks, but replace generated code)
Thank you
Leon
Risposte (2)
Leon Loeser
il 29 Set 2019
0 voti
Andy Bartlett
il 2 Gen 2020
0 voti
Hi Leon,
Solving the problem may be a simple as turning on support long long for the model.
Please see this article.
and/or this video
Please let us know if that solves the problem
Andy
Categorie
Scopri di più su STMicroelectronics Discovery Boards in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!