Refactoring in the DVT Eclipse IDE - How to Perform Rename Refactoring

Overview

Sometimes you need to change the name of a class, module, function or signal. This operation, known as Rename Refactoring, requires changing both the declaration and all of the usages of the renamed element.

Unlike plain text search and replace, Rename Refactoring in DVT is accurate. This is because in the DVT Eclipse IDE the code is compiled, each identifier is resolved, and only the relevant occurrences are updated by Rename Refactoring.

Explore the design and verification tools: https://www.dvteclipse.com
Or request a license: https://www.dvteclipse.com/request-license

Details

Introduction

Sometimes you need to change the name of a class, module, function or signal. This operation, known as Rename Refactoring, requires changing both the declaration and all of the usages of the renamed element.

Renaming a Function

Let's start with a function.

  1. Place the editor cursor on the function name and right-click, Refactor > Rename, or just press the Alt+Shift+R keyboard shortcut.
  2. A dialog prompting for the new function name appears.
  3. Edit the name and press Preview to see what changes are about to be performed.
  4. A list of the files about to be changed is shown in the upper panel, while the lower panel shows a compare view per file before and after the refactoring operation.
  5. You can see that the function name will be changed in the external function declaration, the function definition and its end tag, as well as the function usage in a different file.

Renaming a Virtual Interface Signal

Now let's do the same for a virtual interface signal.

  1. Press Ctrl+Shift+T to bring up the Quick Types View and type a_i to open up the apb interface.
  2. Place the editor cursor on the paddr port and press Alt+Shift+R, enter new name, press Preview and OK.

The Advantages of Rename Refactoring

Unlike plain text search and replace, Rename Refactoring is accurate. Note that the paddr port of the apb master interface is untouched. This is because in the DVT Eclipse IDE the code is compiled, each identifier is resolved, and only the relevant occurrences are updated by Rename Refactoring. Rename Refactoring works for any identifier, for example macros, modules, parameters, classes, and so on.