User Guide: DSim Running A Verilog (System Verilog) Simulation
The DSim tools allow control through the three stages of a simulation.
Single Invocation
To run a DSim simulation from a single command line can be done as follows
DSim Cloud CLI
mdc dsim -a '<design files> ...'
DSim
dsim <design files> ...
When executed as above, DSim will proceed through all three stages: processing all design files (Compliation), produce an image (Elaborate), and executing it until completion (Run).
The advantage here is the simplicity of the command.
Compile Once, Run Many
For larger designs the creation of the image may take some time, and if the design is intended to be run several times (ie. with different inputs or seed value) then the image can be created separately. See also Compile Once, Run Multiple Times.
The following command will parse all the design files (Analyze) and produce the image (Elaborate), but not run it.
DSim Cloud CLI
mdc dsim -a '-genimage image <design files> ...'
DSim
dsim -genimage image <design files> ...
The following command will run the image (Run).
DSim Cloud CLI
mdc dsim -a '-image image ...'
DSim
dsim -image image ...
The advantage of this flow is the time and effort saved in creating an image only once for multiple tests.
Building A Library
For some projects a single collection of files can be used in different top-level designs, depending how they are incorporated together.
For such a case it is possible to use the DVlcom tool to parse all the files and add the resulting design components to a library that can later used to create different types of images.
The following command will parse the given design files and populate the library (Analyze).
Note: The design components are only saved to a library on disk when using DVlcom, if processed by DSim it is kept in memory only for the existing process.
DSim Cloud CLI
mdc dvlcom -a '<design file> ...'
DSim
dvlcom <design file> ...
DVlcom can be run on all files together or each file independently - depending on what command line options are necessary for each file. Design components can be added to the same library or distributed accross multiple libraries. All libraries needed for a given simulation must be located/linked into a single DSim workspace. For linking a library refer to Managing Libraries.
When a file which is being analyzed contains an external reference, the reference must be found within one of the local libraries. If that reference is to a pre-compiled library, it must already be linked (see Managing Libraries). Lowest level design components must be analyzed first. The higher level components follow. This ordering is important so that the all references are properly resolved.
The default library is work
, but can be replaced with any preferable name.
The following command will elaborate a design based on the given top-level name (Elaborate) and run the simulation (Run).
DSim Cloud CLI
mdc dsim -a '-top <library>.<module name> ...'
DSim
dsim -top <library>.<module name> ...
If desired the building of the image and the running of the simulation can also be separated. Compile Once, Run Multiple Times.
DSim Cloud CLI
mdc dsim -a '-genimage image -top <library>.<module name> ...'
DSim
dsim -genimage image -top <library>.<module name> ...
And
DSim Cloud CLI
mdc dsim -a '-image image ...'
DSim
dsim -image image ...
The advantage to this flow is that ability to parse each design file only once in order to build a variety of designs for simulation.
For management and inspection of the design component library you can use the DLib tool as follows.
To list all libraries
DSim Cloud CLI
mdc dlib -a 'ls'
DSim
dlib ls
To list design components within a library
DSim Cloud CLI
mdc dlib -a 'ls -lib <library name>'
DSim
dlib ls -lib <library name>
For more information please refer to Managing Libraries.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article