Main Content

Simscape Hardware-in-the-Loop Workflow

Simscape support for HDL code generation and workflow to generate HDL code from the models and deploy to target hardware

You can generate HDL code for your plant model that you developed by using Simscape™ blocks and then deploy the generated code to standalone FPGA boards, or to FPGAs onboard the Speedgoat® I/O modules, SoC devices, and so on. By deploying the plant model to an FPGA board, you can accelerate the simulation of your plant model and simulate the model in real time by using Hardware-in-the-Loop (HIL) simulations.

Before you generate HDL code, use the sschdladvisor function to generate an HDL implementation model from Simscape switched linear models. Switched linear models are models that contain blocks such as diodes or switches. These blocks are defined by a linear relationship such as V = IR where R can switch between two or more values depending on the state of the diodes or switches.

After you generate the HDL implementation model, you can use HDL Coder™ to generate code for this model and deploy the generated code to target platforms by using the HDL Workflow Advisor. When you generate the HDL implementation model, you can specify whether to generate the implementation model with single-precision or double-precision floating-point data types. You can also specify insertion of a validation logic in the implementation model to verify whether the HDL implementation numerically matches the original Simscape algorithm.


sschdladvisorOpen Simscape HDL Workflow Advisor
makehdlGenerate HDL RTL code from model, subsystem, or model reference
sschdl.generateOptimizedModelReplace Simscape switches and converter blocks with dynamic switches optimized for FPGA deployment (Since R2024a)
sschdl.updateRuntimeParametersGenerate updated tunable parameter data file for Simscape model (Since R2024a)



Implementation Model and Code Generation

Simscape HDL Workflow Advisor