Configuring Array Multiline Structure Rules

There are rules which will check indent and formatting of multiline expressions and conditions.

The alignment of multiline rules is handled by a corresponding rule. Both rules are required to ensure proper formatting of multiline expressions and conditions. The corresponding rule will be noted in the rule documentation.

There are several options to these rules:

Option Values Default Description
first_paren_new_line yes, no, ignore yes
  • yes = Add new line before first parenthesis.
  • no = Remove new line before first parenthesis.
  • ignore = Ignore formatting.
last_paren_new_line yes, no, ignore yes
  • yes = Add new line before last parenthesis.
  • no = Remove new line before last parenthesis.
  • ignore = Ignore formatting.
open_paren_new_line yes, no, ignore yes
  • yes = Add new line after open parenthesis.
  • no = Remove new line after open parenthesis.
  • ignore = Ignore formatting.
close_paren_new_line yes, no, ignore yes
  • yes = Add new line before close parenthesis.
  • no = Remove new line before close parenthesis.
  • ignore = Ignore formatting.
new_line_after_comma yes, no, ignore, ignore_positional yes
  • yes = Add new line after comma.
  • no = Remove new line after comma.
  • ignore_positional = Add new line after comma unless elements are positional.
  • ignore = Ignore formatting.
assign_on_single_line yes, ignore yes
  • yes = Force assignments to single line.
  • ignore = Allow assignments to span multiple lines.
ignore_single_line yes, no yes
  • yes = Ignore single line expressions.
  • no = Apply rules to single line expressions.

The options can be combined to format arrays.

This is an example of how to configure these options.

rule :
  constant_016:
     first_paren_new_line : 'yes'
     last_paren_new_line : 'yes'
     open_paren_new_line : 'yes'
     close_paren_new_line : 'yes'
     new_line_after_comma : 'ignore'
     assign_on_single_line : 'yes'
     ignore_single_line : 'no'

The following code snippet is used in the following examples:

constant c_stimulus : t_stimulus_array := ((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array :=
(
  (
    name =>
            "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name =>
            "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

Note

The indenting in the following examples are performed by a different rule.

Example: first_paren_new_line set to yes

constant c_stimulus : t_stimulus_array :=
((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array :=
(
  (
    name =>
            "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name =>
            "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

Example: first_paren_new_line set to no

constant c_stimulus : t_stimulus_array := ((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array := (
  (
    name =>
            "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name =>
            "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

Example: last_paren_new_line set to yes

constant c_stimulus : t_stimulus_array := ((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")
); -- Define test vectors

constant c_stimulus : t_stimulus_array :=
(
  (
    name =>
            "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name =>
            "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

Example: last_paren_new_line set to no

constant c_stimulus : t_stimulus_array := ((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array := (
  (
    name =>
            "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name =>
            "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )); -- Define test vectors

Example: open_paren_new_line set to yes

constant c_stimulus : t_stimulus_array := (
  (
   name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (
   name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array :=
(
  (
    name =>
            "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name =>
            "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

Example: open_paren_new_line set to no

constant c_stimulus : t_stimulus_array := ((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array := ((name =>
    "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (name =>
           "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )); -- Define test vectors

Example: close_paren_new_line set to yes

constant c_stimulus : t_stimulus_array := ((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"
  ), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00"
  )
); -- Define test vectors

constant c_stimulus : t_stimulus_array :=
(
  (
    name =>
            "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name =>
            "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

Example: close_paren_new_line set to no

constant c_stimulus : t_stimulus_array := ((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array := ((name =>
           "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"),
  (name =>
           "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00")); -- Define test vectors

Example: new_line_after_comma set to yes

constant c_stimulus : t_stimulus_array := ((name => "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"),
  (name => "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array :=
(
  (
    name =>
            "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name =>
            "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

Example: new_line_after_comma set to no

constant c_stimulus : t_stimulus_array := ((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array := ((name =>
           "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name =>
           "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

Example: assign_on_single_line set to yes

constant c_stimulus : t_stimulus_array :=
((name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"), (name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00")); -- Define test vectors

constant c_stimulus : t_stimulus_array :=
(
  (
    name => "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name => "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

Example: Keep all assignments on single line

Using the following configuration:

rule :
  constant_016:
     first_paren_new_line : 'no'
     last_paren_new_line : 'yes'
     open_paren_new_line : 'yes'
     close_paren_new_line : 'yes'
     new_line_after_comma : 'no'
     assign_on_single_line : 'yes'
     ignore_single_line : 'no'

would result in the following formatting:

constant c_stimulus : t_stimulus_array := (
  (
    name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"
  ), (
    name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00"
  )
); -- Define test vectors

constant c_stimulus : t_stimulus_array := (
  (
    name => "Hold in reset", clk_in => "01", rst_in => "11", cnt_en_in => "00", cnt_out => "00"
  ), (
    name => "Not enabled", clk_in => "01", rst_in => "00", cnt_en_in => "00", cnt_out => "00"
  )
); -- Define test vectors

Example: Fully expand expression

Using the following configuration:

rule :
  constant_016:
     first_paren_new_line : 'yes'
     last_paren_new_line : 'yes'
     open_paren_new_line : 'yes'
     close_paren_new_line : 'yes'
     new_line_after_comma : 'yes'
     assign_on_single_line : 'yes'
     ignore_single_line : 'no'

would result in the following formatting:

constant c_stimulus : t_stimulus_array :=
(
  (
    name => "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name => "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

constant c_stimulus : t_stimulus_array :=
(
  (
    name => "Hold in reset",
    clk_in => "01",
    rst_in => "11",
    cnt_en_in => "00",
    cnt_out => "00"
  ),
  (
    name => "Not enabled",
    clk_in => "01",
    rst_in => "00",
    cnt_en_in => "00",
    cnt_out => "00"
  )
); -- Define test vectors

Rules Enforcing Array Multiline Structure Rules