Documentation

Batch Mode Cosimulation of Manchester Receiver

This example illustrates using MATLAB® to start ModelSim® in batch mode and performing cosimulation with Simulink® using the HDL Verifier™ HDL Cosimulation block.

The commands displayed in the illustration above show the following steps:

  • The call to the HDL Verifier vsim command starts HDL simulator in batch mode by setting the 'runmode' property to 'Batch'. Issuing vsim also launches the HDL simulator, and additional commands (specified in manchestercmds.m) compile the HDL design and load the HDL Verifier HDL cosimulation library.

     vsim('tclstart', manchestercmds, 'runmode', 'Batch');
  • If you are running on a Linux® machine, the HDL simulator process starts in the background. On Windows®, a new command window opens for HDL simulator. MATLAB and Simulink now wait to begin cosimulation.

  • The HDL Verifier pingHdlSim command detects if the HDL simulator server is ready for cosimulation. The timeout argument to pingHdlSim specifies that it will wait for 100 seconds for HDL simulator to start. If HDL simulator fails to start within that time, an error is reported.

     pingHdlSim(100);
  • Simulink begins cosimulation when MATLAB detects (through pingHdlSim) that the HDL simulator server is ready.

     sim('manchester_batch',[0 50000]);

  • When the cosimulation completes, the HDL simulator exits automatically.

Was this topic helpful?