DVT SystemVerilog IDE User Guide
Rev. 21.1.9, 8 March 2021

13.2 Indentation

  • Optional "begin" - Some language constructs, for example the conditional statement if or the loop statement for, require a begin - end block to control the execution of several statements. Such blocks are called optional "begin" in order to distinguish them from other cases like fork begin ... end endfork' or plain begin ... end blocks used just for grouping several statements together for readability. This option affects the optional "begin" blocks:

    • On a new line - begin is moved on a new line

    • On the same line - begin is moved on the same line with it's construct

    • Leave as is

  • "else" - This option affects else placement:

    • On a new line - else is moved on a new line

    • On the same line - if end precedes it else is moved on the same line with end

    • Leave as is

  • Parameters - This option affects module ports and parameters, function and task arguments, class parameters:

    • One per line - each is placed on it's own line

    • More per line - more are placed on the same line, as fit when line wrapping is enabled

    • Leave as is

  • Preprocessing - This option affects `ifdef blocks:

    • Indent and increase indentation level - indent like any other scope language construct that increases indentation of it's enclosed statements

    • Indent - indent, but don't increase the enclosed statements indentation

    • Move at first column - move at line start, but don't increase the enclosed statements indentation

    • Leave as is

  • Don't indent single line comments at first column - This option affects single line comments that start at column zero. It is useful to disable the indentation for whole regions of code that are block commented, for example by using Ctrl + /. When enabled, single line comments that start at column zero are not indented.

  • Indent multi-line comments - This option affects multi-line comments ( /* ... */). When enabled, multi-line comments are indented.

  • Do not indent multi-line content of assigns - When enabled, the assign lines are not indented such as to preserve an alignment like:

 assign ccc = (bbb == 1'b7) ? a
                            : data_in;

  • Ignore lines starting with- Space separated list of line prefixes. A line starting with one of the prefixes is completely ignored, that is it is not indented, nor it contributes to indentation.

  • Don't increase the indent Level On - By default all scope language constructs increase indentation. This option allows you to control which language constructs should increase indentation.

  • Implicit semi macros - The code formatting engine depends on detecting some delimiters for properly identifying the proper indentation scope, for example indentation should not increase after if(a) foo1();, but it should after if(a) begin foo();. Semicolon or end is such a delimiter and sometimes it may be encapsulated inside a macro. This option allows you to explicitly list such macros for proper code formatting.

  • Open/Close scope macros - An open scope macro increases the indentation level of subsequent code to visualize scoping. A close scope macro decreases back the indentation level. Open/close scope macros are paired, for example: `TEST and `ENDTEST, similar with language keywords like function and endfunction.