Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/configuring_keyword_alignment_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -992,3 +992,4 @@ Rules Enforcing Keyword Alignment
* `subprogram_body_400 <subprogram_body_rules.html#subprogram-body-400>`_
* `subprogram_body_401 <subprogram_body_rules.html#subprogram-body-401>`_
* `type_400 <type_rules.html#type-400>`_
* `variable_401 <variable_rules.html#variable-401>`_
1 change: 1 addition & 0 deletions docs/rule_groups/alignment_rule_group.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Rules Enforcing Alignment Rule Group
* `subprogram_body_401 <../subprogram_body_rules.html#subprogram-body-401>`_
* `type_400 <../type_rules.html#type-400>`_
* `variable_400 <../variable_rules.html#variable-400>`_
* `variable_401 <../variable_rules.html#variable-401>`_
* `variable_assignment_004 <../variable_assignment_rules.html#variable-assignment-004>`_
* `variable_assignment_400 <../variable_assignment_rules.html#variable-assignment-400>`_
* `variable_assignment_401 <../variable_assignment_rules.html#variable-assignment-401>`_
29 changes: 29 additions & 0 deletions docs/variable_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,35 @@ This rule checks alignment of multiline constraints in variable declarations.
element2(3 downto 0)
);

variable_401
############

|phase_5| |error| |alignment|

This rule checks the alignment of assignment keywords in variable declarations.

|configuring_keyword_alignment_rules_link|

**Violation**

.. code-block:: vhdl

variable v_default_values : t_address_en := (
c_address_control => false,
c_address_data => true,
others => false
);

**Fix**

.. code-block:: vhdl

variable v_default_values : t_address_en := (
c_address_control => false,
c_address_data => true,
others => false
);

variable_500
############

Expand Down
105 changes: 105 additions & 0 deletions tests/variable/rule_401_test_input.fixed_no_no_no_no_no.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
architecture rtl of fifo is

begin

process
variable v_my_rec : t_my_rec :=
(
signal_one => '0',
signal_onetwo => '0',

signal_onetwothree => '0',
signal_onetwothreefour => '0',
-- Comment
signal_onetwothreefourfive => '0',
signal_onetwothreefourfivesix => '0'
);

variable v_default_values : t_address_en := (
C_ADDRESS_CONTROL_A => false,
C_ADDRESS_DATA_A => true,
others => false

C_ADDRESS_CONTROL_B => false,
C_ADDRESS_DATA_B => true,
others => false
-- Comment
C_ADDRESS_CONTROL_C => false,
C_ADDRESS_DATA_C => true,
others => false
);

variable v_my_rec : t_my_rec :=
(
signal_one => '0',
signal_onetwo => '0',

signal_onetwothree => '0',
signal_onetwothreefour => '0',
-- Comment
signal_onetwothreefourfive => '0',
signal_onetwothreefourfivesix => '0'
);

variable v_default_values : t_address_en := (
C_ADDRESS_CONTROL_A => false,
C_ADDRESS_DATA_A => true,
others => false

C_ADDRESS_CONTROL_B => false,
C_ADDRESS_DATA_B => true,
others => false
-- Comment
C_ADDRESS_CONTROL_C => false,
C_ADDRESS_DATA_C => true,
others => false
);

-- Test hierarchical assignments
-- Desired alignment
variable v_my_var : my_type := (
ENUM_1 => (
A => 1,
B => 2,
C => 3
),
ENUM_224 => (
AA => 1,
BB => 2,
CC => 3
)
);

-- Invalid alignment
variable v_my_var : my_type := (
ENUM_1 => (
A => 1,
B => 2,
C => 3
),
ENUM_224 => (
AA => 1,
BB => 2,
CC => 3
)
);

-- Test single line aggregates
variable v_my_var : my_type := (
ENUM_1 => (
A => 1,
B => 2,
C => 3
),
ENUM_2 => (
AA => 1,
BBBBBBB => ((others => '0')),
CC => 3 -- Not aligned!
)
);

begin

end process;

end architecture rtl;
105 changes: 105 additions & 0 deletions tests/variable/rule_401_test_input.fixed_yes_no_no_no_no.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
architecture rtl of fifo is

begin

process
variable v_my_rec : t_my_rec :=
(
signal_one => '0',
signal_onetwo => '0',

signal_onetwothree => '0',
signal_onetwothreefour => '0',
-- Comment
signal_onetwothreefourfive => '0',
signal_onetwothreefourfivesix => '0'
);

variable v_default_values : t_address_en := (
C_ADDRESS_CONTROL_A => false,
C_ADDRESS_DATA_A => true,
others => false

C_ADDRESS_CONTROL_B => false,
C_ADDRESS_DATA_B => true,
others => false
-- Comment
C_ADDRESS_CONTROL_C => false,
C_ADDRESS_DATA_C => true,
others => false
);

variable v_my_rec : t_my_rec :=
(
signal_one => '0',
signal_onetwo => '0',

signal_onetwothree => '0',
signal_onetwothreefour => '0',
-- Comment
signal_onetwothreefourfive => '0',
signal_onetwothreefourfivesix => '0'
);

variable v_default_values : t_address_en := (
C_ADDRESS_CONTROL_A => false,
C_ADDRESS_DATA_A => true,
others => false

C_ADDRESS_CONTROL_B => false,
C_ADDRESS_DATA_B => true,
others => false
-- Comment
C_ADDRESS_CONTROL_C => false,
C_ADDRESS_DATA_C => true,
others => false
);

-- Test hierarchical assignments
-- Desired alignment
variable v_my_var : my_type := (
ENUM_1 => (
A => 1,
B => 2,
C => 3
),
ENUM_224 => (
AA => 1,
BB => 2,
CC => 3
)
);

-- Invalid alignment
variable v_my_var : my_type := (
ENUM_1 => (
A => 1,
B => 2,
C => 3
),
ENUM_224 => (
AA => 1,
BB => 2,
CC => 3
)
);

-- Test single line aggregates
variable v_my_var : my_type := (
ENUM_1 => (
A => 1,
B => 2,
C => 3
),
ENUM_2 => (
AA => 1,
BBBBBBB => ((others => '0')),
CC => 3 -- Not aligned!
)
);

begin

end process;

end architecture rtl;
105 changes: 105 additions & 0 deletions tests/variable/rule_401_test_input.fixed_yes_no_yes_no_no.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
architecture rtl of fifo is

begin

process
variable v_my_rec : t_my_rec :=
(
signal_one => '0',
signal_onetwo => '0',

signal_onetwothree => '0',
signal_onetwothreefour => '0',
-- Comment
signal_onetwothreefourfive => '0',
signal_onetwothreefourfivesix => '0'
);

variable v_default_values : t_address_en := (
C_ADDRESS_CONTROL_A => false,
C_ADDRESS_DATA_A => true,
others => false

C_ADDRESS_CONTROL_B => false,
C_ADDRESS_DATA_B => true,
others => false
-- Comment
C_ADDRESS_CONTROL_C => false,
C_ADDRESS_DATA_C => true,
others => false
);

variable v_my_rec : t_my_rec :=
(
signal_one => '0',
signal_onetwo => '0',

signal_onetwothree => '0',
signal_onetwothreefour => '0',
-- Comment
signal_onetwothreefourfive => '0',
signal_onetwothreefourfivesix => '0'
);

variable v_default_values : t_address_en := (
C_ADDRESS_CONTROL_A => false,
C_ADDRESS_DATA_A => true,
others => false

C_ADDRESS_CONTROL_B => false,
C_ADDRESS_DATA_B => true,
others => false
-- Comment
C_ADDRESS_CONTROL_C => false,
C_ADDRESS_DATA_C => true,
others => false
);

-- Test hierarchical assignments
-- Desired alignment
variable v_my_var : my_type := (
ENUM_1 => (
A => 1,
B => 2,
C => 3
),
ENUM_224 => (
AA => 1,
BB => 2,
CC => 3
)
);

-- Invalid alignment
variable v_my_var : my_type := (
ENUM_1 => (
A => 1,
B => 2,
C => 3
),
ENUM_224 => (
AA => 1,
BB => 2,
CC => 3
)
);

-- Test single line aggregates
variable v_my_var : my_type := (
ENUM_1 => (
A => 1,
B => 2,
C => 3
),
ENUM_2 => (
AA => 1,
BBBBBBB => ((others => '0')),
CC => 3 -- Not aligned!
)
);

begin

end process;

end architecture rtl;
Loading
Loading