Running Cosimulation Sessions

Starting the HDL Simulator for Use with Simulink

The options available for starting the HDL simulator for use with Simulink vary depending on whether you run the HDL simulator and Simulink on the same computer system.

If both tools are running on the same system, start the HDL simulator directly from MATLAB by calling the MATLAB function vsim. Alternatively, you can start the HDL simulator manually and load the EDA Simulator Link MQ libraries yourself. Either way, see Starting the HDL Simulator.

Loading an HDL Module for Cosimulation

After you start the HDL simulator from MATLAB, load an instance of an HDL module for cosimulation with the HDL simulator command vsimulink. Issue the command for each instance of an HDL module in your model that you want to cosimulate. For example:

vsimulink work.manchester

This command opens a simulation workspace for manchester and displays a series of messages in the HDL simulator command window as the simulator loads the HDL module's packages and architectures.

Determining an Available Socket Port Number

To determine an available socket number use: ttcp -a.

Checking the Connection Status

You can check the connection status by clicking the Update diagram button or by selecting Edit > Update Diagram. If there is a connection error, Simulink will notify you.

The MATLAB command pingHdlSim can also be used to check the connection status. If a -1 is returned, then there is no connection with the HDL simulator.

Managing a Simulink Cosimulation Session

To run and test a cosimulation model in Simulink, click Simulation > Start or the Start Simulation button in your Simulink model window. Simulink runs the model and displays any errors that it detects.

If you need to reset a clock during a cosimulation, you can do so by entering HDL simulator force commands at the HDL simulator command prompt or by specifying HDL simulatorforce commands in the Post- simulation command text field on the Tcl pane of your EDA Simulator Link MQ Cosimulation block's parameters dialog box.

If you change any part of the Simulink model, including the HDL Cosimulation block parameters, rerun the simulation or click the Update diagram button or select Edit > Update Diagram so that the diagram reflects those changes.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS