Main Content

Batch Mode Cosimulation of Manchester Receiver

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

1. ModelSim/QuestaSim

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]);

2. Xcelium

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

  • The call to the HDL Verifier nclaunch command starts HDL simulator in batch mode by setting the 'runmode' property to 'Batch'. Issuing nclaunch also compiles and elaborates the HDL design, and loads the HDL Verifier HDL cosimulation library.

nclaunch( ...
       'rundir', 'TEMPDIR', ...
       'tclstart', { ...
         ['exec xmvlog -64bit -linedebug ' vlogFiles{:}], ...
          'exec xmelab -64bit -access +rwc manchester', ...
          'hdlsimulink manchester' }, ...
          'runmode', 'Batch');
  • The HDL simulator process starts in the background. 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_incisive',[0 50000]);

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