Editing SystemVerilog Files

EclipseWorkbench with Open SVEditor and Outline View

SVEditor provides several features to make editing SystemVerilog files easier and more productive.

Outline View

The Outline View is a built-in Eclipse view that provides a structural view of the actively-edited file. SVEditor populates the Outline View with structural SystemVerilog information, such as classes, modules, functions, and fields.

Navigation via the Outline View

Selecting an element in the Outline View causes the active editor to navigate to the selected element and highlight the bounds of the item.

Cross-Linking

When editing a SystemVerilog class or module, it is often helpful to reference a class or module used within the current module. SVEditor provides a context-menu entry and a shortcut (F3) to access cross-linking. Cross-linking works when the cursor is positioned:

  • On the file path of an `include directive. Invoking Open Declaration opens the referenced file
  • On a class or structure type name (eg class-field declaration). Opens the file that contains the class or structure declaration.
  • On a field or task/function reference. Figure 14 shows invoking Open Declaration on the expression slaves[i].assign_vi(xi). The cursor was placed on ‘assign_vi’. In this case SVEditor will navigate to the task or function named ‘assign_vi’ within the class of which ‘slaves’ is an instance.

Open Declaration for a Class Field

Content Assist

Content assist is common in many editors for code files (Java, C++, etc). SVEditor provides content assist that is very similar to the content assist provided by the Eclipse Java or C++ editor.

Content assist is invoked either explicitly by typing <CTRL>-<SPACE>, or implicitly when a ‘.’ is typed. In both cases, SVEditor provides a list of possible matches for the specified prefix.

Override Tasks/Functions

SVEditor provides a wizard that creates task or function templates for methods that are overridden by the active class. Open the Override Methods dialog from the context menu within SVEditor, as shown in the figure below.

Opening the Override Methods Dialog

When the Override Methods dialog opens, find the class and method to override and select it as shown in the figure below.

Override Methods Dialog

Selecting OK causes SVEditor to create a new method template at the cursor location, as shown in the figure below. If Auto-Indent is enabled, the newly-inserted content will be indented.

New Task Template

Indenting Content

There are two primary methods for indenting content – auto-indent and explicit indenting. Auto-indent is enabled by default, and can be disabled via the SVEditor Preferences page.