When a model has been compiled for hardware co-simulation, the generated bitstream can be used in both a model-based Simulink flow, or in M-code executed in MATLAB. The general sequence of operations to access a bitstream in hardware typically follows the sequence described below.
- Configure the hardware co-simulation interface. Note that the
hardware co-simulation configuration is persistent and is saved in the
hwcfile. If the co-simulation interface is not changed, there is no need to re-run this step.
- Create a M-Hwcosim instance for a particular design.
- Open the M-Hwcosim interface.
- Repeatedly run the following sub-steps until the simulation ends.
- Write simulation data to input ports.
- Read simulation data from output ports.
- Advance the design clock by one cycle.
- Close the M-Hwcosim interface.
- Release the M-Hwcosim instance.