# SIMPLIS VH - Verilog HDL Co-simulation with SIMPLIS - Introduction

## 1.0 - Overview

Rapid digital prototyping at the concept stage, thorough verification of the synthesizable digital design in the full analog application circuit before committing to silicon.

The new SIMPLIS Verilog-HDL Co-simulation module enables the fast, industry-verified SIMPLIS analog simulation engine to run in parallel with a Verilog-HDL simulation engine to permit users to analyze a behavioral or gate-level digital IC design operating in an actual analog application circuit instead of merely pairing it with an artificial input stimulus test bench. Designers interested in exploring new digital control algorithms can use behavioral Verilog-HDL syntax to get their ideas to the testing stage without having to delve into gate-level design. At verification time, the designer can test the performance of the synthesizable Verilog-HDL design against the original application circuit specifications before submitting it to silicon layout.

## 1.1 - Licensing

SIMPLIS VH is an add-on available to users of SIMetrix/SIMPLIS Pro and SIMetrix/SIMPLIS Elite. SIMPLIS VH cannot run properly without the SIMetrix Verilog-HDL capabilities present in those versions of the program.

## 1.2 - Components of the SIMPLIS VH Package

At its core, SIMPLIS VH consists of the following elements:

• a series of SIMetrix scripts that enable the creation and editing of schematic components that represent the Verilog-HDL content
• routines within the SIMPLIS simulation engine that enable the launching of, and communication with, the Verilog-HDL simulator
• a .vpi module that is loaded by the Verilog-HDL simulator that enables SIMPLIS to control the simulation and retrieve results from the Verilog-HDL environment
• a configuration file, loaded by SIMPLIS whenever Verilog-HDL components are present in a SIMPLIS model, that provides the SIMPLIS simulator the location of the Verilog-HDL simulator and any necessary arguments it requires

## 2.0 - Supported Verilog-HDL Simulators

SIMetrix/SIMPLIS Pro VH and SIMetrix/SIMPLIS Elite VH ship with the following versions of the open-source Icarus Verilog simulator:

• v0.9.1 (stable)
• v0.9.7 (stable)
• 20150105 (snapshot)

SIMetrix/SIMPLIS Pro VH and SIMetrix/SIMPLIS Elite VH also support Mentor Graphics' ModelSim versions 10.4 and later.

## 2.1 - Configuration Files

SIMPLIS VH expects its configuration file to be named "simplis_verilog.cfg" and to be located in the same directory as the SIMPLIS binary. The default Verilog-HDL simulator for SIMPLIS VH is the older stable version of Icarus, v0.9.1, and the configuration file that ships in the bin directory reflects that. Additional configuration files are available in the support/veriloghdl/config directory:

• simplis_verilog.cfg.icarus (a copy of the default, uses Icarus v0.9.1)
• simplis_verilog.cfg.icarus-0.9.7
• simplis_verilog.cfg.icarus-snapshot (uses the 20150105 snapshot)
• simplis_verilog.cfg.modelsim

The Icarus configuration files should be all set and ready to use, just copy the appropriate one into the SIMPLIS bin directory and rename it to overwrite the default simplis_verilog.cfg file. The ModelSim configuration file will probably need customization depending on the installed version and the choice of installation directory. More information on setting up SIMPLIS VH to use ModelSim can be found in the section titled Configuring SIMPLIS VH to work with ModelSim.

The default simplis_verilog.cfg file is heavily commented, with information on each of the supported flags and fields, and this is the entirety of the configuration file syntax documentation. It should be noted here that changes to the .cfg file that improperly configure SIMPLIS VH and/or the selected Verilog-HDL simulator can lead to warnings, errors, crashes and hangs.

## 3.0 - Using SIMPLIS VH

Once configured, a user interacts with SIMPLIS VH principally in the following ways:

• Creating new Symbols from Verilog-HDL Modules
• Passing Parameters to Verilog-HDL Modules
• Probing Inside of Verilog-HDL Modules

## 3.1 - Creating new Symbols from Verilog-HDL Modules

So long as the Verilog-HDL code is supported by the SIMetrix Verilog-HDL symbol creation process, it should work for the SIMPLIS Verilog interface as well. First, make sure that you have saved your schematic.

• Then, from the menu of your SIMPLIS schematic, choose Verilog ▶ Construct Verilog-HDL Symbol.
• Select the .v source file for your Verilog-HDL module and choose "Open".
• The symbol creation process will load the Verilog source (using the SIMetrix Verilog-HDL configuration), check the syntax and then create a symbol for the first module definition found in your source file.
• Place the symbol on your schematic. To configure either the D/A standard conversion parameters or any module-specific parameters defined as part of the Verilog-HDL source, just double-click the instance on the schematic.

## 3.2 - Passing Parameters to Verilog-HDL Modules

The Verilog-HDL specification allows for a certain amount of parameterization of modules. Both the SIMetrix and SIMPLIS Verilog-HDL interfaces support the passing of parameters to a Verilog-HDL source module. Parameter names and default values are configured inside of the Verilog-HDL source file using the standard syntax. A simple example that would pass an initial condition value to a module might look something like the following:

parameter IC = 0;

During the symbol creation process, the parameter names and default values are extracted from the Verilog-HDL module definition and added to the list of parameters configurable through the standard Edit dialog (available by double-clicking the device or selecting it and hitting F7). Adding or removing parameters from the Verilog-HDL source file will require re-creating the symbol in order to be reflected in the Edit dialog.

## 3.3 - Probing Inside of Verilog-HDL Modules

To facilitate debugging during schematic and Verilog HDL development, we have added a custom VPI task ($simplis_vpi_probe) that will pass any changes in a wire (vpiNet) or register (vpiReg) through SIMPLIS to the SIMetrix/SIMPLIS waveform viewer. The task can also monitor changes in a vpiPartSelect that implements vpiConstantSelect; however not all simulators support that properly, so that support should not be counted on unless independently verified. Because the changes do not have to be written to a text log (as a$monitor or $display would require), there is often a performance advantage to using the built-in task as well. The syntax is fairly simple: initial$simplis_vpi_probe( wire_or_register_name );

To see it in action, check out the PID Compensator used in the Digital PWM example. Run the following schematic:

TODO\VH_SyncBuck_Digital_PWM.sxsch

Notice that the PID_out signal does not have an associated probe on the schematic. If you look at the text of the Verilog source file:

 TODO\PID_compensator.v

You will see the call to $simplis_vpi_probe in one of the initial blocks. It is recommended that calls to$simplis_vpi_probe not be placed inside always blocks as that could lead to a performance hit under certain circumstances with certain simulators. For the provided Icarus simulators, it will probably not be noticeable, however, in the future that may change.

Note that you will be responsible for handling any naming collisions. As with a normal SIMetrix/SIMPLIS probe, having two signals with the same name will lead to unpredictable results.

Also, data from calls to $simplis_vpi_probe will most often not be available until the simulation completes (as if "Plot on Completion" had been selected in the Edit Probe dialog for a regular voltage probe). Finally, there is no conditional probing. Wrapping a call to$simplis_vpi_probe in an if statement will have no effect. If a call to \$simplis_vpi_probe exists in the Verilog source, then that signal will be probed regardless of any programmatic logic that may or may not surround it in the .v file.

## 4.0 - Configuring SIMPLIS VH to work with ModelSim

First off, ModelSim must be installed on the same PC as SIMPLIS VH. If you have not got a copy of ModelSim, there is an evaluation license generator available on their website.

Once you have downloaded and installed ModelSim, and gotten it to run an example circuit (thus ensuring that the license is working as intended), the following changes should be made to the Windows environment in order to support simulations from the command line. Adjust the path to the ModelSim installation directory accordingly.

• Add the ModelSim win32pe directory to the system PATH
set PATH=%PATH%;C:\modeltech_pe_10.4\win32pe
• Add an environment variable for the license file (forward slashes seem to work most predictably here)
set LM_LICENSE_FILE=C:/modeltech_pe_10.4/win32pe/license.txt
• Add an environment variable for the modelsim.ini file
set MODELSIM=C:\modeltech_pe_10.4\modelsim.ini

When the environment variables are set, you should be able to invoke vsim from the command line and it will check for a license (and launch the GUI if no arguments are provided).

Next, use the information in your simplis_verilog.cfg.modelsim file for simulation. Either edit simplis_verilog.cfg or copy the modelsim version over top of the existing one in the bin directory. Again, adjust the path to the ModelSim installation directory accordingly.