Configuring Conditional Multiline Indent Rules

There are rules which will check alignment of multiline conditional expressions and conditional waveforms.

There are several options to these rules:

Option Values Default Description
align_left yes, no no
  • yes = Lines will be aligned left.
  • no = Lines will be aligned to assignment operator.
align_paren yes, no yes
  • yes = Align to unbalanced open parenthesis.
  • no = Each unbalanced open parenthesis will add an indent.
align_when_keywords yes, no no
  • yes = Column align when keywords.
  • no = Ignore alignment of when keywords.
wrap_at_when yes, no yes
  • yes = Indent multiline condition at when keyword.
  • no = Disable wrapping at when keyword.
align_else_keywords yes, no no
  • yes = Column align else keywords.
  • no = Ignore alignment of else keywords.

The options can be combined to format the conditional expression or conditional waveform.

This is an example of how to configure these options.

rule :
  concurrent_009:
     align_left : 'no'
     align_paren : 'no'
     align_when_keywords : 'no'
     wrap_at_when : 'no'
     align_else_keywords : 'no'

The following code snippet is used for all examples and is formatted with the configuration above

output <= '1' when input = "0000" or (input = "1111" and
              input2 = "0101") else
          sig_a or sig_b when input = "0001" and
            input2 = "1001" else
          sig_c and sig_d when input = "0010" else
         '0';

Note

Formatting in the following exampes is performed by a separate rule.

Example: align_left set to yes

output <= '1' when input = "0000" or (input = "1111" and
      input2) = "0101" else
  sig_a or sig_b when input = "0001" and
    input = "1001" else
  sig_c and sig_d when input = "0010" else
  '0';

Example: align_paren set to yes

output <= '1' when input = "0000" or (input = "1111" and
                                       input2) = "0101" else
          sig_a or sig_b when input = "0001" and
            input = "1001" else
          sig_c and sig_d when input = "0010" else
          '0';

Example: align_when_keywords set to yes

output <= '1'             when input = "0000" or (input = "1111" and
              input2) = "0101" else
          sig_a or sig_b  when input = "0001" and
            input = "1001" else
          sig_c and sig_d when input = "0010" else
          '0';

Example: wrap_at_when set to yes

output <= '1' when input = "0000" or (input = "1111" and
                     input2) = "0101" else
          sig_a or sig_b when input = "0001" and
                              input = "1001" else
          sig_c and sig_d when input = "0010" else
          '0';

Example: align_else_keywords set to yes

output <= '1' when input = "0000" or (input = "1111" and
              input2) = "0101"                else
          sig_a or sig_b when input = "0001" and
            input = "1001"                    else
          sig_c and sig_d when input = "0010" else
          '0';

Example: Default configuration

Using the following configuration:

rule :
  concurrent_009:
     align_left : 'no'
     align_paren : 'yes'
     align_when_keywords : 'no'
     wrap_at_when : 'yes'
     align_else_keywords : 'no'

would result in the following formatting:

output <= '1' when input = "0000" or (input = "1111" and
                                       input2) = "0101" else
          sig_a or sig_b when input = "0001" and
                              input = "1001" else
          sig_c and sig_d when input = "0010" else
          '0';

Example: Setting all options to yes except align_left set to no

Using the following configuration:

rule :
  concurrent_009:
     align_left : 'no'
     align_paren : 'yes'
     align_when_keywords : 'yes'
     wrap_at_when : 'yes'
     align_else_keywords : 'yes'

would result in the following formatting:

output <= '1'             when input = "0000" or (input = "1111" and
                                                   input2) = "0101" else
          sig_a or sig_b  when input = "0001" and
                               input = "1001"                       else
          sig_c and sig_d when input = "0010"                       else
          '0';

Rules Enforcing Conditional Expression Alignment