I have now found the code replacement library for Cortex M3, but few functions still use the utility functions generated by matlab despite the data-types being the same as in the multiplications replaced with Cortex functions. Any ideas?
Replace wide integer multiplication
18 visualizzazioni (ultimi 30 giorni)
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
0 Commenti
Risposte (2)
Andy Bartlett
il 2 Gen 2020
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
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!