Tutorial: DSim Desktop for Xilinx

Modified on Tue, 9 Jul at 6:08 PM

Tutorial: DSim Desktop for Xilinx

Contents

  1. Introduction
  2. Prerequisites
  3. Example design
  4. Open a project
  5. Create a project
  6. Add files to your project
  7. Add a Simulation Configuration
  8. Compile your design
  9. Run your design
  10. View the waveform
  11. Debug your design
  12. Run your design in the cloud
  13. Next Steps

Introduction

DSim Desktop is a versatile Visual Studio Code (VSC) extension, offering unparalleled flexibility in HDL simulation, supporting both cloud-based and local (on-prem) workflows. This article describes how to use DSim Desktop to simulate the Xilinx Vivado Reference Design "wavegen".


NOTE: The screenshots in this article may not exactly match what you see on your computer. The functionality and performance of DSim Desktop remain the same.



Prerequisites


Vivado

  1. Have a working installation of Vivado ML 2022.1 on your local machine.
  2. Set the Windows System environment variable VIVADO_HOME = <path to Vivado installation>/<version>.

DSim Desktop

  1. Install DSim Desktop.
  2. Tour of DSim Desktop.

Example design

For this tutorial, use the wavegen example design. If you haven't already done so,


1. Generate the Xilinx Vivado Reference Design "wavegen". You do not have to Simulate the "wavegen" design with DSim Cloud.


2. Download and extract the contents of metrics-sim-wavegen-main.zip.


3. Copy the file mdc_config.yml into the project folder /wavegen/ and the folder /metrics into /wavegen/wavegen.sim/sim_1/behav/.


4. Click the VSC Explorer and navigate to the folder /wavegen. If the folder is not visible in the VSC Explorer, open it by clicking Open Folder from the File menu.



If you want to simply compile and simulate this example design, proceed to Open a project.


If you want to create the project from scratch, proceed to Create a project.



Open a project

To open an existing project, simply right-click the project's .dpf file from the VSC Explorer and select DSim Desktop: Open Project.


For this tutorial, navigate to the folder /wavegen.sim/sim_1/behav/metrics, right-click wavegen_tutorial.dpf and select DSim Desktop: Open Project.



Then skip to the step Compile your design.



Create a project

Simulating designs in DSim Desktop is project-based, so the first thing you need to do is create a project.


1. Navigate to the folder /wavegen.sim/sim_1/behav, right-click the folder /metrics and select DSim Desktop: New Project.



2. Enter wavegen for the Project File Name, ..\..\..\.. for the Design Root Directory, work for the Working Directory, and click Save.




Add files to your project

As with any simulator, you need to know all the source files and their dependent files that need to be compiled, as well as what libraries they are compiled into. It is highly recommended that you use file lists to compile files of the same language and options.



Example steps

1. Navigate to /wavegen.sim/sim_1/behav/metrics/common, right-click xpm_filelist.txt and select DSim Desktop: Configure File.



2. This is a file list of VHDL files to be compiled into the library xpm, so enter xpm into the box Library Name (Optional), select VHDL from Choose a Language, and tick the box Configure as file list. Click Save.



3. Navigate to /wavegen.ip_user_files/ipstatic/simulation/, right-click fifo_generator_vlog_beh.v and select DSim Desktop: Configure File.



4. This is a Verilog file to be compiled into the library fifo_generator_v13_2_7 with options to include certain directories, and must be compiled in order. Enter fifo_generator_v13_2_7 into the box Library Name (Optional), select Verilog / SystemVerilog from Choose a Language, enter +incdir+../../../../../wavegen.srcs/sources_1/imports/Sources +incdir+../../../../../wavegen.gen/sources_1/ip/clk_core into Options (Optional), and enter 4 into Compilation Order (Optional). Click Save.



5. Add the rest of the files to your project using one of the following methods (a or b):


a) Load the pre-populated project file wavegen_no_sim.dpf by right-clicking the file and selecting DSim Desktop: Open Project.



b) Similar to the previous steps, add the following files or file lists (*.txt) to your project to the proper libraries in the following order.


File Path Language Library Options Order
\wavegen.sim\sim_1\behav\metrics\common\unisim_filelist.txt VHDL unisim 1
\wavegen.sim\sim_1\behav\metrics\common\xpm_ver_filelist.txt Verilog xpm 2
\wavegen.sim\sim_1\behav\metrics\common\unisims_ver_filelist.txt Verilog unisims_ver 3
\wavegen.ip_user_files\ipstatic\hdl\fifo_generator_v13_2_rfs.vhd VHDL fifo_generator_v13_2_7 5
\wavegen.ip_user_files\ipstatic\hdl\fifo_generator_v13_2_rfs.v Verilog fifo_generator_v13_2_7 +incdir+../../../../../wavegen.srcs/sources_1/imports/Sources +incdir+../../../../../wavegen.gen/sources_1/ip/clk_core 6
\wavegen.sim\sim_1\behav\metrics\common\xil_defaultlib_filelist.txt Verilog xil_defaultlib +incdir+../../../../../wavegen.srcs/sources_1/imports/Sources +incdir+../../../../../wavegen.gen/sources_1/ip/clk_core 7
\xsim\glbl.v Verilog xil_defaultlib 8

6. Click the DSim Desktop extension and expand all the libraries in the LIBRARY CONFIGURATION.



7. Confirm that all your libraries match the ones above. If a file or file list is out of order, right-click it and select Change Order. Note that there are different icons for file lists and files. The ? beside the libraries and files indicate that their Compilation Status is Unknown, ie. they have not been compiled yet.




Add a Simulation Configuration

Once you've finished adding all of your files to your project, you can add a Simulation Configuration. This enables you to elaborate and run different simulations on the same set of compiled libraries. Add a new Simulation Configuration:


1. Hover over the SIMULATION CONFIGURATION drop-down menu and click the + button.



2. Enter the following in the Configure Simulation tab:


  • Sim 1 for the Simulation Name.
  • -top xil_defaultlib.tb_wave_gen -top xil_defaultlib.glbl -run-until 1000us -L xil_defaultlib -L xpm -L unisims_ver -L fifo_generator_v13_2_7 -lib xil_defaultlib +acc+b -waves waves.mxd for the Options. These are the DSim options executed when you hit the 'Run' button. In our example, this elaborates and runs the testbench as the top-level module and generates a waveform file during runtime as specified by the Options:

-top xil_defaultlib.tb_wave_gen: top-level module is tb_wave_gen found in the compiled library xil_defaultlib


-top xil_defaultlib.glbl: additional top-level module glbl found in the compiled library xil_defaultlib


-run-until 1000us: run the simulation for 1000us


-L xil_defaultlib -L xpm -L unisims_ver -L fifo_generator_v13_2_7: search these compiled libraries


-lib xil_defaultlib: set the default design library to xil_defaultlib


+acc+b: generate support for waveform dump


-waves waves.mxd: enable wave dump to waves.mxd



Click Save.


For common DSim options, see the DSim column under the Standard Options section of DSim Common Options.



Compile your design

1. Click the 'Compile Project' play button under the LIBRARY CONFIGURATION to compile your project.



All of the executed DSim simulator commands and their resulting output are displayed in the OUTPUT window. A notification pops up indicating the overall result of the compile. The ? beside the libraries in the LIBRARY CONFIGURATION turn into check marks after the successful compilation of the library.


Optionally, click the 'Turn Auto Scrolling On' button (lock icon) in the OUTPUT window to have the output scroll automatically.




Run your design

After the successful compilation of your design, you can run it locally (on-prem) by simply clicking the 'Run' button beside Sim 1 in the SIMULATION CONFIGURATION.



All of the executed DSim simulator commands and their resulting output are displayed in the OUTPUT window. A notification pops up indicating the overall result of the run. A check mark appears beside Sim 1 in the SIMULATION CONFIGURATION after a completed simulation run.




View the waveform

1. Click the VSC Explorer and double-click on /wavegen.sim/sim_1/behav/metrics/work/waves.mxd.



2. Use the integrated waveform viewer like you would any other waveform viewer. See User Guide: Metrics Waveform Viewer for details.


3. Close the waves.mxd tab when you're done. Subsequent simulations will overwrite this waveform file unless you change its name in the Simulation Configuration Options dialog box.



Debug your design

1. Using a combination of the waveform waves.mxd, the compilation logs dvhcom.log and dvlcom.log, and the simulation log dsim.log, debug your design.


2. Make any necessary changes to your HDL and testbench files in the VSC Explorer and save them.


3. Close all the tabs in the Editor pane.


4. You only need to re-compile the files or libraries that have changed. For example, if you only changed the testbench file, click the 'Compile File' play button next to xil_defaultlib_filelist.txt (since tb_wave_gen.v is part of this file list) in the LIBRARY CONFIGURATION of the DSim Desktop view.



5. After the successful re-compilation of your design, you can re-run it by simply clicking the 'Run' button beside Sim 1 in the SIMULATION CONFIGURATION.




Run your design in the cloud

1. When you're ready to run your simulation in the cloud, click the 'Run in DSim Cloud' button next to the desired Simulation Configuration.



2. DSim Desktop automatically converts your local simulation to a job file and submits it to the cloud. You must be signed into your DSim Cloud account to submit a job to the cloud. A notification pops up indicating the status of your job submission. When it is complete, click the 'Show Jobs' button or in your DSim Desktop view, expand the JOBS section to see your job.



3. Expand your job to see the status of each task. Sometimes it may take a while (several minutes) for remote cloud resources to become available to run your job.



4. Once your job is complete, click the 'Download All Artifacts' button to retrieve your simulation artifacts.



5. A notification pops up indicating the status of your artifact download. When it is complete, click the 'Reveal in Explorer' button or in your VSC Explorer view, navigate to /wavegen.sim/sim_1/behav/metrics/_downloaded_artifacts/wavegen-xxxxx/work.