I was recently asked, "Do you have some kind of list or simple rules to get high performance generated code using Real-Time Workshop?" I put the question to my colleague (and first guest blogger) Tom Erkkinen, and he came up with the following.
- Use ERT based targets
- Use Code Generation Advisor, with efficiency as top priority
- Inline parameters
- For floating point, use single precision signals (if your application allows for it)
- For fixed point, remove unnecessary saturation checks
- Limit use of nonvirtual buses, except at model boundaries
- Use reusable subsystems
- Use TFL when ANSI-C is insufficient
- Use state machines only when really needed, otherwise consider using truth tables
- Consider using Simulink lookup tables, your legacy tables may not be as optimized
What are your tips?
Do you use generated code in production? Leave a comment with your tips for generating high-performance code here.
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.