- Build your Simscape model.
- Open the Simscape HDL Workflow Advisor for your model.
- In the 'Generate implementation model' task, set the 'Data type precision' option to 'Fixed-point'.
- Run the Advisor task to generate the HDL implementation model.
- Use HDL Coder to generate HDL code from the fixed-point implementation model.
Implementing variable resistor as suggested by Mathworks with fixed point output
4 次查看(过去 30 天)
显示 更早的评论
Hello,
I saw this interesting solution
that you provided and I tried it: it works fine but I discovered that it automatically force to use floating point data type.
Do you know how is possible to force to use fixed point? I tried to read the documentation but I'm not able to find anything.
thanks
Michele
0 个评论
回答(1 个)
Ronit
2025-7-15
Yes, it is possible to generate a fixed-point HDL implementation model from a Simscape-based variable resistor or inductor model, but there are some important clarifications regarding where fixed-point is supported in the workflow.
Simscape simulation itself always runs in floating-point (double or single). Fixed-point support is available for the HDL implementation model (the Simulink subsystem generated from your Simscape model).
This means you can generate a fixed-point compatible subsystem for HDL code generation, but you cannot run the original Simscape block in fixed-point.
To enable fixed-point output for HDL code Generation, please follow these steps:
Refer to the following documentation link on how to use Fixed-Point Precision to generate the implementation model: https://www.mathworks.com/help/releases/R2024b/hdlcoder/ug/validate-hdl-implementation-model-and-resolve-numerical-mismatches.html#mw_2e512b1a-a4ae-4bca-a3d0-0bad8fb77419
Note: You cannot force the Simscape block itself to run in fixed-point, only the generated HDL implementation model can use fixed-point. All Simscape simulation and validation logic are floating-point. The fixed-point configuration applies only to the implementation model used for HDL code generation.
I hope this helps with your query!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Troubleshooting 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!