Skip to content

Commit d9d74f9

Browse files
authored
Merge pull request #1517 from JHertz5/issue-1510
Issue#1510: New rules for multiline variable initialisations.
2 parents b4861c5 + a3c97a8 commit d9d74f9

20 files changed

+420
-21
lines changed

docs/configuring_array_multiline_structure_rules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,4 +566,5 @@ Rules Enforcing Array Multiline Structure Rules
566566
* `concurrent_012 <concurrent_rules.html#concurrent-012>`_
567567
* `constant_016 <constant_rules.html#constant-016>`_
568568
* `sequential_009 <sequential_rules.html#sequential-009>`_
569+
* `variable_403 <variable_rules.html#variable-403>`_
569570
* `variable_assignment_008 <variable_assignment_rules.html#variable-assignment-008>`_

docs/configuring_multiline_indent_rules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,6 @@ Rules Enforcing Multiline Indent Rules
128128
* `sequential_402 <sequential_rules.html#sequential-402>`_
129129
* `signal_400 <signal_rules.html#signal-400>`_
130130
* `variable_400 <signal_rules.html#variable-400>`_
131+
* `variable_402 <variable_rules.html#variable-402>`_
131132
* `variable_assignment_004 <variable_assignment_rules.html#variable-assignment-004>`_
132133
* `variable_assignment_401 <variable_assignment_rules.html#variable-assignment-401>`_

docs/rule_groups/alignment_rule_group.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Rules Enforcing Alignment Rule Group
8080
* `type_400 <../type_rules.html#type-400>`_
8181
* `variable_400 <../variable_rules.html#variable-400>`_
8282
* `variable_401 <../variable_rules.html#variable-401>`_
83+
* `variable_402 <../variable_rules.html#variable-402>`_
8384
* `variable_assignment_004 <../variable_assignment_rules.html#variable-assignment-004>`_
8485
* `variable_assignment_400 <../variable_assignment_rules.html#variable-assignment-400>`_
8586
* `variable_assignment_401 <../variable_assignment_rules.html#variable-assignment-401>`_

docs/rule_groups/structure_rule_group.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ Rules Enforcing Structure Rule Group
189189
* `variable_015 <../variable_rules.html#variable-015>`_
190190
* `variable_017 <../variable_rules.html#variable-017>`_
191191
* `variable_018 <../variable_rules.html#variable-018>`_
192+
* `variable_403 <../variable_rules.html#variable-403>`_
192193
* `variable_assignment_006 <../variable_assignment_rules.html#variable-assignment-006>`_
193194
* `variable_assignment_007 <../variable_assignment_rules.html#variable-assignment-007>`_
194195
* `variable_assignment_008 <../variable_assignment_rules.html#variable-assignment-008>`_

docs/variable_rules.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,67 @@ This rule checks the alignment of assignment keywords in variable declarations.
472472
others => false
473473
);
474474
475+
variable_402
476+
############
477+
478+
|phase_5| |error| |alignment|
479+
480+
This rule checks the alignment of multiline variable initializations that contain arrays.
481+
482+
|configuring_multiline_indent_rules_link|
483+
484+
.. NOTE:: The structure of multiline array variables is handled by the rule `variable_403 <variable_rules.html#variable-403>`_.
485+
486+
**Violation**
487+
488+
.. code-block:: vhdl
489+
490+
variable rom : romq_type :=
491+
(
492+
0,
493+
65535,
494+
32768
495+
);
496+
497+
**Fix**
498+
499+
.. code-block:: vhdl
500+
501+
variable rom : romq_type :=
502+
(
503+
0,
504+
65535,
505+
32768
506+
);
507+
508+
variable_403
509+
############
510+
511+
|phase_5| |error| |structure|
512+
513+
This rule checks the structure of multiline variable initializations that contain arrays.
514+
515+
|configuring_array_multiline_structure_rules_link|
516+
517+
.. NOTE:: The indenting of multiline array variables is handled by the rule `variable_402 <variable_rules.html#variable-402>`_.
518+
519+
**Violation**
520+
521+
.. code-block:: vhdl
522+
523+
variable rom : romq_type := (0, 65535, 32768);
524+
525+
**Fix**
526+
527+
.. code-block:: vhdl
528+
529+
variable rom : romq_type :=
530+
(
531+
0,
532+
65535,
533+
32768
534+
);
535+
475536
variable_500
476537
############
477538

tests/variable/rule_400_test_input.fixed__align_left_no__align_paren_no.vhd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ architecture rtl of fifo is
1919
);
2020

2121
variable v : MY_TYPE := (
22-
a => '0',
23-
ddddd => (others => '0'),
24-
ffff => (others => '0')
25-
);
22+
a => '0',
23+
ddddd => (others => '0'),
24+
ffff => (others => '0')
25+
);
2626

2727
variable AxiMs : axi_ms_t (ar_id(IdRange_c), aw_id(IdRange_c),
2828
ar_addr(AddrRange_c), aw_addr(AddrRange_c),

tests/variable/rule_400_test_input.fixed__align_left_no__align_paren_yes.vhd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ architecture rtl of fifo is
1919
);
2020

2121
variable v : MY_TYPE := (
22-
a => '0',
23-
ddddd => (others => '0'),
24-
ffff => (others => '0')
25-
);
22+
a => '0',
23+
ddddd => (others => '0'),
24+
ffff => (others => '0')
25+
);
2626

2727
variable AxiMs : axi_ms_t (ar_id(IdRange_c), aw_id(IdRange_c),
2828
ar_addr(AddrRange_c), aw_addr(AddrRange_c),

tests/variable/rule_400_test_input.fixed__align_left_yes__align_paren_no.vhd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ architecture rtl of fifo is
1919
);
2020

2121
variable v : MY_TYPE := (
22-
a => '0',
23-
ddddd => (others => '0'),
24-
ffff => (others => '0')
25-
);
22+
a => '0',
23+
ddddd => (others => '0'),
24+
ffff => (others => '0')
25+
);
2626

2727
variable AxiMs : axi_ms_t (ar_id(IdRange_c), aw_id(IdRange_c),
2828
ar_addr(AddrRange_c), aw_addr(AddrRange_c),

tests/variable/rule_400_test_input.fixed__align_left_yes__align_paren_yes.vhd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ architecture rtl of fifo is
1919
);
2020

2121
variable v : MY_TYPE := (
22-
a => '0',
23-
ddddd => (others => '0'),
24-
ffff => (others => '0')
25-
);
22+
a => '0',
23+
ddddd => (others => '0'),
24+
ffff => (others => '0')
25+
);
2626

2727
variable AxiMs : axi_ms_t (ar_id(IdRange_c), aw_id(IdRange_c),
2828
ar_addr(AddrRange_c), aw_addr(AddrRange_c),
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
architecture rtl of fifo is
3+
4+
begin
5+
6+
my_proc : process
7+
8+
variable wr_data : my_type :=
9+
(
10+
(name => "Hold in reset",
11+
clk_in => "01",
12+
rst_in => "11",
13+
cnt_en_in => "00",
14+
cnt_out => "00"),
15+
(name => "Not enabled",
16+
clk_in => "01",
17+
rst_in => "00",
18+
cnt_en_in => "00",
19+
cnt_out => "00")
20+
);
21+
22+
variable d : my_type :=
23+
(d2 xor to_stdulogic(gen2)) &
24+
(d1 xor to_stdulogic(gen1));
25+
26+
begin
27+
28+
end process;
29+
30+
end architecture rtl;

0 commit comments

Comments
 (0)