Products & Services Industries Academia Support User Community Company

Learn more about EDA Link Simulator   

Performing Cross-Network Cosimulation

Why Perform Cross-Network Cosimulation?

You can perform cross-network cosimulation when your setup comprises one machine running MATLAB and Simulink software and another machine running the HDL simulator. Typically, a Windows-platform machine runs the MATLAB and Simulink software, while a Linux or Solaris machine runs the HDL simulator. However, these procedures apply to any combination of platforms that EDA Simulator Link and the HDL simulator support.

Preparing for Cross-Network Cosimulation (MATLAB or Simulink)

Before you cosimulate between the HDL simulator and MATLAB or Simulink across a network, perform the following steps:

  1. Create your design and testing files.

    • Create and compile your HDL design, and create your MATLAB m-function (for MATLAB cosimulation) or Simulink model (for Simulink cosimulation).

    • If you are going to cosimulate with Simulink, use the -novopt option when you compile so that the design is not optimized, and include the -novopt option when you issue the vsim command (see Performing Cross-Network Cosimulation with the HDL Simulator and Simulink). Using the -novopt option retains some unused signals from the design which are required by the Simulink model to run and display the results.

  2. Copy EDA Simulator Link libraries to the machine with the HDL simulator

    1. Go to the system where you installed MATLAB. Then, find the folder in the MATLAB distribution where the EDA Simulator Link libraries reside.

      You can usually find the libraries in the default installed folder:

      matlabroot/toolbox/edalink/extensions/modelsim/platform/productlibraryname_
      compiler_tag.ext

      where the variable shown in the following table have the values indicated.

      VariableValue
      matlabrootThe location where you installed the MATLAB software; default value is "MATLAB/version" where version is the installed release (for example, R2009a).
      platformThe operating system of the machine with the HDL simulator, for example, linux32. (For more information, see Using the EDA Simulator Link Libraries.)
      productlibraryname

      The name of the library files for MATLAB and for Simulink (for example, liblfmhdlc, liblfmhdls).

      See Using the EDA Simulator Link Libraries.
      compiler_tagThe compiler used to create the library (for example, gcc32 or spro). For more information, see Using the EDA Simulator Link Libraries.
      extdll (dynamic link library—Windows only) or so ( shared library extension)

      For a list of all the EDA Simulator Link HDL shared libraries shipped, see Default Libraries in Using the EDA Simulator Link Libraries.

    2. From the MATLAB machine, copy the EDA Simulator Link libraries you plan to use (which you determined in step 2) to the machine where you installed the HDL simulator. Make note of the location to which you copied the link libraries; you'll need this information when you are actually establishing the link. For purposes of this example, the sample code refers to the destination folder as "HDLSERVER_LIB_LOCATION".

If you now want to cosimulate with MATLAB, see Performing Cross-Network Cosimulation with the HDL Simulator and MATLAB. If you want to cosimulate with Simulink, see Performing Cross-Network Cosimulation with the HDL Simulator and Simulink.

Performing Cross-Network Cosimulation with the HDL Simulator and MATLAB

To perform an HDL-simulator-to-MATLAB cosimulation session across a network, follow these steps:

  1. In MATLAB, get an available socket using hdldaemon:

    hdldaemon('socket',0)

    Or assign one (that you know is available):

    hdldaemon('socket',4449)
  2. On the machine with the HDL simulator, launch the HDL simulator from a shell with the following command:

    vsim -foreign "matlabclient /HDLSERVER_LIB_LOCATION/library_name;" design_name

    where the arguments shown in the following table have the values indicated.

    ArgumentValue
    library_nameThe name of the library you copied to the machine with the HDL simulator (in Preparing for Cross-Network Cosimulation (MATLAB or Simulink)).
    design_nameThe VHDL or Verilog design you want to load

  3. In the HDL simulator, schedule the test bench or component (matlabcp or matlabtb). Specify the socket port number from step 1 and the name of the host machine where hdldaemon is running.

Performing Cross-Network Cosimulation with the HDL Simulator and Simulink

When you want to perform an HDL-simulator-to-Simulink cosimulation session across a network, follow these steps:

  1. Launch the HDL simulator from a shell with the following command:

    vsim -foreign "simlinkserver /HDLSERVER_LIB_LOCATION/library_name;
        -socket socket_num" -novopt design_name

    where the arguments shown in the following table have the values indicated.

    ArgumentValue
    library_nameThe name of the library you copied to the machine with the HDL simulator (in Preparing for Cross-Network Cosimulation (MATLAB or Simulink)).
    socket_numThe socket number you have chosen for this connection
    design_nameThe VHDL or Verilog design you want to load

  2. On the machine with MATLAB and Simulink, start Simulink and open your Simulink model.

  3. Double-click on the HDL Cosimulation block to open the Function Block Parameters dialog box.

  4. Click on the Connections tab.

    1. Clear "The HDL simulator is running on this computer." The Connection method is automatically changed to Socket.

    2. In the text box labeled Host name, enter the host name of the machine where the HDL simulator is located.

    3. In the text box labeled Port number or service, enter the socket number from step 1.

    4. Click OK to exit block dialog box, and save your changes.

Next, run your simulation, add more blocks, or make other desired changes. See Simulating an HDL Component in a Simulink Test Bench Environment or Replacing an HDL Component with a Simulink Algorithm.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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