How to Work with Preprocessed Files in the DVT Eclipse IDE

Description

This video covers how to use DVT Eclipse IDE with SystemVerilog source files which contain preprocessing code written in a different language, like python and jinja, perl or any other language. The support allows users to benefit from DVT features like hyperlinks, content assist and errors as you type even in files which are not pure SystemVerilog.

This video was shot using DVT 24.1.4.

Run Configurations details: https://dvteclipse.com/demo-movies?search=%2BRun+%2BConfiguration

Transcript

Introduction

This video covers how to use DVT IDE with SystemVerilog source files, which contain preprocessing code written in a different language, like Python and Jinja, Perl, or any other language.

In a typical flow, the source files get preprocessed and pure SystemVerilog code is generated. Subsequently, all tools in the toolchain, like the compiler, simulator, or linter, actually use the generated files.

Sections of code that will be preprocessed will have distinct background highlight, helping you quickly identify and differentiate them from standard SystemVerilog code.

IDE Capabilities in SystemVerilog Sections

Full IDE capabilities are available when editing inside a pure SystemVerilog section. The IDE immediately flags errors, offers quick fixes, and provides content assist. Of course, the typical navigation capabilities are also in place, for example, various hyperlinks or searching for usages.

Speaking of navigation, by placing the cursor on a preprocessed section, the IDE reveals the generated code in the Inspect View. With a simple click on the file name link, you can jump to the generated file, ensuring a smooth workflow.

To go from anywhere inside the file to the corresponding generated code section, right-click in the editor, navigate to Show, and select Generated File.

Errors in generated sections are back-annotated to the corresponding preprocessed section, allowing for a seamless debugging experience.

To prevent accidental overwrites by the preprocessing tool, generated files are treated as read-only by default. This safeguard ensures your changes are made in the right place.

Configuring Your Project for Preprocessing

Configuring your project for preprocessing is straightforward. In the project's build configuration file, you need to specify the mapping from preprocessed to generated files.

Several mapping types are available:

  • Direct mapping
  • Extension mapping
  • Pattern tag mapping
  • Path prefix mapping
  • Comment mapping, which instructs the tool to figure the corresponding preprocessing file from a header comment in the generated file

Running the Preprocessor on Save

Finally, you can achieve a completely streamlined flow by running the preprocessing tool or script every time you save the file. You just need to define a DVT generic run configuration, which calls the preprocessor.

Use the +dvt_pverilog_run_on_save build configuration directive to specify the run configuration name in the project's build file.

Now, every time you edit and save the file, the preprocessing gets executed and any changes are immediately reflected. For example, any new errors.