DVT SystemVerilog IDE User Guide
Rev. 24.2.25, 31 October 2024

27.9 Extract to Variable

An expression inside a function or task can be extracted to a local variable.

Select the expression and press Ctrl+1, select Extract to local variable from the list of quick assist proposals and press Enter.

The variable is declared and initialized with the extracted expression in the correct scope.

Tip: You may change the variable name and type. Press tab to switch between the edit boxes.

Tip: If the expression occurs multiple times throughout the function, you may chose to replace all the occurrences with the newly created variable, or only the selected one.

Tip: You can also right-click in the editor and go to Refactor > Extract....