DVM Testplan Post-Processing
with Experimental Python® Feature

Starting in SIMetrix/SIMPLIS 9.2 with Design Verification Module (DVM), there is the option to perform testplan post-processing using Python instead of the SIMetrix Script Language. This enables engineers to use standard Python functionality and external Python libraries to assist in the creation of testplan specific scalar and specification measurement values. Additionally, pre- and final-processing can also be performed using Python.

Table of Contents:

Enabling Experimental Features

Python integration within the DVM Testplan is currently an experimental feature that must be opted into. To enable the integration, in the SIMetrix Command Shell, submit the following:

enable_experimental_feature 'dvmPython'

The above will populate menu options within the application and the Testplan Editor to facilitate the use of the Python integration. When enabled, the integration will remain enabled as an application setting and does not need to be enabled on each application start. The first time the integration is enabled, the Python Options dialog will appear to allow setting up Python integration.

The integration can later be disabled if desired by submitting the following to the SIMetrix Command Shell:

enable_experimental_feature 'dvmPython' false

Python Options

The Python Options dialog allows for the Python version to be specified, along with optional features for the integrated Python editor. With the DVM Testplan experimental Python feature enabled, the dialog can be accessed from the menu:

File > Options > Python Options…

Python Version

SIMetrix/SIMPLIS provides a bridge to existing Python installations on the end-user system. The Python options dialog populates a drop-down box containing a list of supported Python versions that are installed. It is expected that the three most recent versions of Python at the time of the SIMetrix/SIMPLIS version release will be supported. Only the 64-bit versions will be supported.

If the Python Version drop-down box is empty, check that one of the supported Python versions is installed. Python installed from the Microsoft® Store may not appear in the drop-down box and is not supported.

If changing the Python version after a different version has been applied in this dialog, an application restart may be required for the change to take effect.

For basic Python integration, only the Python version needs to be set. Pressing Save in the dialog will set the Python version and close the dialog. Optionally, further settings can be applied to improve the internal editor experience. It is also recommended to install the simetrix package to enable Python IDEs knowledge of the functionality provided.

Integrated Python Editor Options

The integrated Python Editor provides basic syntax highlighting by default. Its functionality can be significantly increased by installing a Python language server, which will provide features such as completions; pop-up documentation; error checking and highlighting; and tooltips.

The Python Editor has been designed for use with Pyright, an open-source development from Microsoft. Pyright is used in several Python IDEs, including within the default language support for Python in Visual Studio Code by Microsoft. Installation instructions can be found at:

https://microsoft.github.io/pyright/#/installation?id=command-line

We make no warranty about the software provided at the above link.

With a default Pyright installation to a Python version that is on the system path, the following can be entered into the Language Server field: pyright-langserver. If Pyright is not on the system path, then the full path to the install location will be required in this field.

A Pyright installation can work across multiple different Python version installations, so only a single Pyright installation is required.

If the pyright-langserver executable cannot be found, or the increased functionality does not appear to operate, then the language server location may need to be specified as an absolute path.

simetrix Package

The simetrix package hosted on PyPI provides the API descriptions for the Python integration that can be used by either the internal Python Editor or external 3rd party Python IDEs. Whilst not a mandatory requirement to use the Python integration, it will provide easier development in whichever Python editor is used.

The simetrix package is hosted at:

https://pypi.org/project/simetrix/

The package can be installed using the pip Python package installer using:

pip install simetrix

DVM Testplan Integration

The following expects knowledge of creating DVM Testplans using the built-in Testplan Editor.

Python scripts can be called from pre-/post-/final-process DVM Testplan statements. To create a new script, open the testplan to apply the script to in the DVM Testplan Editor, ensure the appropriate pre-/post-/final- column is present, then right-click on an empty cell in that column and choose the Create Python script… context menu item.

A dialog will appear to select a location to save the Python script being created. Following that, the internal Python editor will open with the new script. The script will be populated with a boilerplate implementation, that is specific to whether a pre-process, post-process or final-process script is being created. Editing the Python script can be performed using either the internal Python Editor or any 3rd party Python IDE.

The script can only be run as part of a DVM Testplan run. Use the normal procedure for running a DVM Testplan.

Existing Python scripts can be opened in the internal editor either by navigating to them in the File Viewer or, if referenced in a DVM Testplan, by right-clicking the cell containing the script name in the DVM Testplan Editor and selecting the Open Python context menu item.

Post-Process Scripts

The post-process boilerplate provides an empty function postProcess that can be used to provide the required implementation. Internally, the Python script is called with a set of local variables that provide access to Python objects that can be used to access the test being run and the DVM control symbol from the associated schematic.

The context object provides access to the test being currently run. This object can be used to:

  • Create scalar values in the test output.
  • Create specifications in the test output.
  • Create statistics in the test output.
  • Create statistical specifications in the test output.
  • Promote graphs and scalars.
  • Access the testplan label.
  • Access the testplan log data.

The controlSymbol object provides access to the control symbol on the schematic. This object can be used to:

  • Read property information from the control symbol.
  • Set property information within the control symbol.
  • Access information about the schematic the control symbol is contained within, including reading and writing schematic properties.
  • Access information about other instances within the schematic, including reading and writing their properties.

Final-Process Scripts

The final-process boilerplate does not currently differ significantly from the post-process boilerplate, and the functionality matches that described in the Post-Process Scripts section.

Pre-Process Scripts

The pre-process boilerplate script differs from the post-process and final-process scripts, in that the context object has less functionality and that a return value must be returned containing a log message to add.

';