| EDA Simulator Link™ MQ | ![]() |
VCD files include data that can be graphically displayed or analyzed with postprocessing tools. An example of such a tool is the ModelSim vcd2wlf tool, which converts a VCD file to a WLF file that you can then view in a ModelSim wave window. This section shows how you might apply the vcd2wlf tool, as follows:
Place a copy of the Manchester Receiver Simulink demo manchestermodel.mdl in a writable directory.
Open your writable copy of the Manchester Receiver model. For example, select File > Open, select the file manchestermodel.mdl and click Open. The Simulink model should appear as follows.

Open the Library Browser.
Replace the Signal Scope block with a To VCD File block, as follows:
Delete the Signal Scope block. The lines representing the signal connections to that block change to red dashed lines, indicating the disconnection.
Find and open the EDA Simulator Link™ MQ block library.
Copy the To VCD File block from the Library Browser to the model by clicking the block and dragging it from the browser to the location in your model window previously occupied by the Signal Scope block.
Double-click the To VCD File block icon. The Block Parameters dialog appears.

Type MyVCDfile.vcd in the VCD file name text box.
Type 4 in the Number of input ports text box.
Click OK. Simulink applies the new parameters to the block.
Connect the signals Original Data, Recovered Data, Recovered Clock, and Data Validity to the block ports. The following display highlights the modified area of the model.

Save the model.
Select the following command line from the instructional text that appears in the demonstration model:
vsim('tclstart',manchestercmds,'socketsimulink',4442)
Paste the command in the MATLAB Command Window and execute the command line. This command starts ModelSim and configures it for a Simulink cosimulation session.
Start the simulation from the Simulink model window.
When the simulation is complete, locate, open, and browse through the generated VCD file, MyVCDfile.vcd.
Close the VCD file.
Change your input focus to ModelSim and end the simulation.
Change the current directory to the directory containing the VCD file and enter the following command at the ModelSim command prompt:
vcd2wlf MyVCDfile.vcd MyVCDfile.wlf
The vcd2wlf utility converts the VCD file to a WLF file that you display with the command vsim -view.
In ModelSim, open the wave file MyVCDfile.wlf as data set MyVCDwlf by entering the following command:
vsim -view MyVCDfile.wlf
Open the MyVCDwlf data set with the following command:
add wave MyVCDfile:/*
A wave window appears showing the signals logged in the VCD file.
Click the Zoom Full button
to view the signal data.
The wave window should appear as follows.

Exit the simulation. One way of exiting is to enter the following command:
dataset close MyVCDfile
ModelSim closes the data set, clears the wave window, and exits the simulation.
For more information on the vcd2wlf utility and working with data sets, see the ModelSim documentation.
![]() | Simulink and ModelSim Tutorial | EDA Simulator Link™ MQ MATLAB® Function Reference | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |