DVT IDE for VS Code SystemVerilog User Guide
Rev. 24.1.12, 12 June 2024

29.2 Macro Expansion

You can inspect the code generated by the expansion of a macro in two ways:

  • inline: DVT replaces the macro call with the generated code in place; the expanded code is guarded by pragmas that allow DVT to collapse the code back to the original

  • in a separate editor: DVT opens a new editor window that shows the generated code

To expand

Place the cursor on a macro call in the editor and use one of the following expansion commands:

  • "DVT: Expand Macro One Level"

  • "DVT: Expand Macro One Level Inline"

  • "DVT: Expand Macro All Levels"

  • "DVT: Expand Macro All Levels Inline"

Expansion also works for an entire region of code, and all macros in the selection will be expanded.

To collapse

Place the cursor on the expansion start pragma, and use the "DVT: Collapse Inline Macro Expansion"".

You can also expand or collapse a macro by using Code Lens, which can be enabled using the DVT.codeLens.expandCollapseMacros setting accessible using "Preferences: Open Settings (UI)" command.

Note: Do not modify the pragmas generated by DVT because this might break the collapse functionality!

The pragmas are: