- 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 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Ronit
le 15 Juil 2025
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 commentaires
Voir également
Catégories
En savoir plus sur Troubleshooting dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!