Merge branch 'jeremiah-c-leary:master' into issue-1300

This commit is contained in:
Jukka Hertzog 2024-12-12 19:49:41 +00:00 committed by GitHub
commit 5f89f9fe44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
101 changed files with 2589 additions and 164 deletions

View File

@ -148,3 +148,4 @@ Rules Enforcing Identifier Alignment
* `package_019 <package_rules.html#package-019>`_
* `package_body_400 <package_body_rules.html#package-body-400>`_
* `procedure_010 <procedure_rules.html#procedure-010>`_
* `protected_type_body_400 <protected_type_body_rules.html#protected-type-body-400>`_

View File

@ -986,6 +986,8 @@ Rules Enforcing Keyword Alignment
* `process_035 <process_rules.html#process-035>`_
* `process_400 <process_rules.html#process-400>`_
* `process_401 <process_rules.html#process-401>`_
* `protected_type_body_401 <protected_type_body_rules.html#protected-type-body-401>`_
* `protected_type_body_402 <protected_type_body_rules.html#protected-type-body-402>`_
* `sequential_400 <sequential_rules.html#sequential-400>`_
* `subprogram_body_400 <subprogram_body_rules.html#subprogram-body-400>`_
* `subprogram_body_401 <subprogram_body_rules.html#subprogram-body-401>`_

View File

@ -24,6 +24,87 @@ This rule checks the indent of the end protected type body declaration.
type flag_pt is protected body
end protected body;
protected_type_body_400
#######################
|phase_5| |error| |alignment|
This rule checks the identifiers for all declarations are aligned in the protected type body declarative region.
|configuring_identifier_alignment_rules_link|
**Violation**
.. code-block:: vhdl
variable var1 : natural;
constant c_period : time;
**Fix**
.. code-block:: vhdl
variable var1 : natural;
constant c_period : time;
protected_type_body_401
#######################
|phase_5| |error| |alignment|
This rule checks the colons are in the same column for all declarations in the protected type body declarative part.
|configuring_keyword_alignment_rules_link|
**Violation**
.. code-block:: vhdl
type my_type protected body is
signal wr_en : std_logic;
signal rd_en : std_logic;
constant c_period : time;
end protected body;
**Fix**
.. code-block:: vhdl
type my_type protected body is
signal wr_en : std_logic;
signal rd_en : std_logic;
constant c_period : time;
end protected body;
protected_type_body_402
#######################
|phase_5| |error| |alignment|
This rule checks the colons are in the same column for all attribute specifications.
|configuring_keyword_alignment_rules_link|
**Violation**
.. code-block:: vhdl
attribute mark_debug of wr_en : signal is "true";
attribute mark_debug of almost_empty : signal is "true";
attribute mark_debug of full : signal is "true";
**Fix**
.. code-block:: vhdl
attribute mark_debug of wr_en : signal is "true";
attribute mark_debug of almost_empty : signal is "true";
attribute mark_debug of full : signal is "true";
protected_type_body_500
#######################

View File

@ -64,6 +64,9 @@ Rules Enforcing Alignment Rule Group
* `process_035 <../process_rules.html#process-035>`_
* `process_400 <../process_rules.html#process-400>`_
* `process_401 <../process_rules.html#process-401>`_
* `protected_type_body_400 <../protected_type_body_rules.html#protected-type-body-400>`_
* `protected_type_body_401 <../protected_type_body_rules.html#protected-type-body-401>`_
* `protected_type_body_402 <../protected_type_body_rules.html#protected-type-body-402>`_
* `report_statement_400 <../report_statement_rules.html#report-statement-400>`_
* `selected_assignment_400 <../selected_assignment_rules.html#selected-assignment-400>`_
* `sequential_004 <../sequential_rules.html#sequential-004>`_

View File

@ -24,6 +24,17 @@ architecture RTL of FIFO is
shared variable var_1234 : integer;
file file1234 : integer;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end architecture RTL;

View File

@ -24,6 +24,17 @@ architecture RTL of FIFO is
shared variable var_1234 : integer;
file file1234 : integer;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end architecture RTL;

View File

@ -24,6 +24,17 @@ architecture RTL of FIFO is
shared variable var_1234 : integer;
file file1234 : integer;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end architecture RTL;

View File

@ -24,6 +24,17 @@ architecture RTL of FIFO is
shared variable var_1234 : integer;
file file1234 : integer;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end architecture RTL;

View File

@ -24,6 +24,17 @@ architecture RTL of FIFO is
shared variable var_1234 : integer;
file file1234 : integer;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end architecture RTL;

View File

@ -24,6 +24,17 @@ architecture RTL of FIFO is
shared variable var_1234 : integer;
file file1234 : integer;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end architecture RTL;

View File

@ -59,6 +59,17 @@ architecture RTL of ENTITY1 is
signal sig1 : std_logic;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end architecture RTL;

View File

@ -59,6 +59,17 @@ architecture RTL of ENTITY1 is
signal sig1 : std_logic;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end architecture RTL;

View File

@ -27,7 +27,7 @@ class test_rule(unittest.TestCase):
self.assertEqual(oRule.name, "architecture")
self.assertEqual(oRule.identifier, "026")
lExpected = [5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23, 25]
lExpected = [5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23, 25, 28, 33]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
@ -42,7 +42,7 @@ class test_rule(unittest.TestCase):
self.assertEqual(oRule.name, "architecture")
self.assertEqual(oRule.identifier, "026")
lExpected = [5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23, 25]
lExpected = [5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 22, 23, 25, 28, 33]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
@ -75,7 +75,7 @@ class test_rule(unittest.TestCase):
oRule.comment_line_ends_group = "no"
oRule.include_type_is_keyword = "no"
lExpected = [4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 19, 20, 22, 23, 24, 25]
lExpected = [4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 19, 20, 22, 23, 24, 25, 28, 33]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
@ -87,7 +87,7 @@ class test_rule(unittest.TestCase):
oRule.comment_line_ends_group = False
oRule.include_type_is_keyword = False
lExpected = [4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 19, 20, 22, 23, 24, 25]
lExpected = [4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 17, 19, 20, 22, 23, 24, 25, 28, 33]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
@ -210,7 +210,7 @@ class test_rule(unittest.TestCase):
oRule.comment_line_ends_group = "no"
oRule.include_type_is_keyword = "yes"
lExpected = [4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 22, 23, 25]
lExpected = [4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 22, 23, 25, 34]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
@ -222,7 +222,7 @@ class test_rule(unittest.TestCase):
oRule.comment_line_ends_group = False
oRule.include_type_is_keyword = True
lExpected = [4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 22, 23, 25]
lExpected = [4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 22, 23, 25, 34]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -24,7 +24,7 @@ class test_architecture_rule(unittest.TestCase):
def test_rule_029(self):
oRule = architecture.rule_029()
lExpected = [6, 8, 9, 10, 11, 23, 25, 26, 28, 29, 48]
lExpected = [6, 8, 9, 10, 11, 23, 25, 26, 28, 29, 48, 69]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -10,6 +10,17 @@ begin
file file1 : std_logic;
alias alias1 is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end block BLOCK_LABEL;

View File

@ -10,6 +10,17 @@ begin
file file1 : std_logic;
alias alias1 is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end block BLOCK_LABEL;

View File

@ -11,6 +11,17 @@ begin
alias alias1 : subtype_indicator is name;
alias alias1 is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end block BLOCK_LABEL;

View File

@ -11,6 +11,17 @@ begin
alias alias1 : subtype_indicator is name;
alias alias1 is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end block BLOCK_LABEL;

View File

@ -27,7 +27,7 @@ class test_block_rule(unittest.TestCase):
self.assertEqual(oRule.name, "block")
self.assertEqual(oRule.identifier, "400")
lExpected = [8, 10, 11]
lExpected = [8, 10, 11, 20]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -16,6 +16,18 @@ architecture RTL of FIFO is
file f : something;
alias a : subtype_indicator is name;
alias a is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end function func1;

View File

@ -16,6 +16,18 @@ architecture RTL of FIFO is
file f : something;
alias a: subtype_indicator is name;
alias a is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end function func1;

View File

@ -14,6 +14,18 @@ architecture RTL of FIFO is
variable v : integer;
file f : something;
alias a is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end function func1;

View File

@ -14,6 +14,18 @@ architecture RTL of FIFO is
variable v : integer;
file f : something;
alias a is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end function func1;

View File

@ -28,7 +28,7 @@ class test_function_rule(unittest.TestCase):
self.assertEqual(oRule.identifier, "012")
self.assertEqual(oRule.groups, ["alignment"])
lExpected = [14, 16, 17, 18]
lExpected = [14, 16, 17, 18, 21, 26]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -28,7 +28,7 @@ class test_function_rule(unittest.TestCase):
self.assertEqual(oRule.identifier, "015")
self.assertEqual(oRule.groups, ["alignment"])
lExpected = [13, 14, 15, 16]
lExpected = [13, 14, 15, 16, 19, 24, 25]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -1,6 +1,26 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
function my_func is new my_func
generic map (
g_test => c_test
);
function my_func is new my_func
generic map (
g_test => c_test
);
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,8 +35,6 @@ begin
PORT_3 => w_port_3
);
-- Violations below
U_INST1 : INST1
generic map (
G_GEN_1 => 1,
@ -38,4 +56,64 @@ begin
G_GEN_3 => 3
);
my_block : block is
GENERIC (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
my_block : block is
GENERIC (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
my_block : block is
GENERIC (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
my_block : block is
GENERIC (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,26 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
GENERIC MAP (
g_test => c_test
);
function my_func is new my_func
GENERIC MAP (
g_test => c_test
);
function my_func is new my_func
GENERIC MAP (
g_test => c_test
);
function my_func is new my_func
GENERIC MAP (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,8 +35,6 @@ begin
PORT_3 => w_port_3
);
-- Violations below
U_INST1 : INST1
GENERIC MAP (
G_GEN_1 => 1,
@ -38,4 +56,64 @@ begin
G_GEN_3 => 3
);
my_block : block is
GENERIC (
g_test : BOOLEAN
);
GENERIC MAP (
g_test => C_TEST
);
begin
end block;
my_block : block is
GENERIC (
g_test : BOOLEAN
);
GENERIC MAP (
g_test => C_TEST
);
begin
end block;
my_block : block is
GENERIC (
g_test : BOOLEAN
);
GENERIC MAP (
g_test => C_TEST
);
begin
end block;
my_block : block is
GENERIC (
g_test : BOOLEAN
);
GENERIC MAP (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
GENERIC MAP (
g_test => c_test
);
package my_pkg_g is new my_pkg
GENERIC MAP (
g_test => c_test
);
package my_pkg_g is new my_pkg
GENERIC MAP (
g_test => c_test
);
package my_pkg_g is new my_pkg
GENERIC MAP (
g_test => c_test
);

View File

@ -1,6 +1,26 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
function my_func is new my_func
GENERIC MAP (
g_test => c_test
);
function my_func is new my_func
GENERIC map (
g_test => c_test
);
function my_func is new my_func
generic MAP (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,8 +35,6 @@ begin
PORT_3 => w_port_3
);
-- Violations below
U_INST1 : INST1
GENERIC MAP (
G_GEN_1 => 1,
@ -38,4 +56,64 @@ begin
G_GEN_3 => 3
);
my_block : block is
GENERIC (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
my_block : block is
GENERIC (
g_test : BOOLEAN
);
GENERIC MAP (
g_test => C_TEST
);
begin
end block;
my_block : block is
GENERIC (
g_test : BOOLEAN
);
generic MAP (
g_test => C_TEST
);
begin
end block;
my_block : block is
GENERIC (
g_test : BOOLEAN
);
generic MAP (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
package my_pkg_g is new my_pkg
GENERIC MAP (
g_test => c_test
);
package my_pkg_g is new my_pkg
GENERIC map (
g_test => c_test
);
package my_pkg_g is new my_pkg
generic MAP (
g_test => c_test
);

View File

@ -1,22 +1,23 @@
architecture ARCH of ENTITY1 is
package my_pkg_g is new my_pkg
generic map (
g_gen_1(3 downto 0) => 3,
g_gen_2(2 downto 1) => 4,
g_gen_3 => 5
);
architecture rtl of test is
function my_func is new my_func
generic map (
g_gen_1(3 downto 0) => 3,
g_gen_2(2 downto 1) => 4,
g_gen_3 => 5
);
begin
U_INST1 : INST1
generic map (
g_gen_1(3 downto 0) => 3,
g_gen_2(2 downto 1) => 4,
g_gen_3 => 5
)
port map (
PORT_1(3 downto 0) => w_port_1,
PORT_2 => w_port_2,
PORT_3(2 downto 1) => w_port_3
);
-- Violations below
U_INST1 : INST1
u_inst1 : inst1
generic map (
g_gen_1(3 downto 0) => 3,
g_gen_2(2 downto 1) => 4,
@ -28,4 +29,68 @@ begin
port_3(2 downto 1) => w_port_3
);
end architecture ARCH;
my_block : block is
generic (
g_test : boolean
);
generic map (
g_gen_1(3 downto 0) => 3,
g_gen_2(2 downto 1) => 4,
g_gen_3 => 5
);
begin
end block my_block;
end architecture rtl;
-- Violations below
PACKAGE MY_PKG_G IS NEW MY_PKG
GENERIC MAP (
g_gen_1(3 DOWNTO 0) => 3,
g_gen_2(2 DOWNTO 1) => 4,
g_gen_3 => 5
);
ARCHITECTURE RTL OF TEST IS
FUNCTION MY_FUNC IS NEW MY_FUNC
GENERIC MAP (
g_gen_1(3 DOWNTO 0) => 3,
g_gen_2(2 DOWNTO 1) => 4,
g_gen_3 => 5
);
BEGIN
U_INST1 : INST1
GENERIC MAP (
g_gen_1(3 DOWNTO 0) => 3,
g_gen_2(2 DOWNTO 1) => 4,
g_gen_3 => 5
)
PORT MAP (
PORT_1(3 DOWNTO 0) => W_PORT_1,
PORT_2 => W_PORT_2,
PORT_3(2 DOWNTO 1) => W_PORT_3
);
MY_BLOCK : BLOCK IS
GENERIC (
G_TEST : BOOLEAN
);
GENERIC MAP (
g_gen_1(3 DOWNTO 0) => 3,
g_gen_2(2 DOWNTO 1) => 4,
g_gen_3 => 5
);
BEGIN
END BLOCK MY_BLOCK;
END ARCHITECTURE RTL;

View File

@ -1,22 +1,23 @@
architecture ARCH of ENTITY1 is
package my_pkg_g is new my_pkg
generic map (
G_GEN_1(3 downto 0) => 3,
G_GEN_2(2 downto 1) => 4,
G_GEN_3 => 5
);
architecture rtl of test is
function my_func is new my_func
generic map (
G_GEN_1(3 downto 0) => 3,
G_GEN_2(2 downto 1) => 4,
G_GEN_3 => 5
);
begin
U_INST1 : INST1
generic map (
G_GEN_1(3 downto 0) => 3,
G_GEN_2(2 downto 1) => 4,
G_GEN_3 => 5
)
port map (
PORT_1(3 downto 0) => w_port_1,
PORT_2 => w_port_2,
PORT_3(2 downto 1) => w_port_3
);
-- Violations below
U_INST1 : INST1
u_inst1 : inst1
generic map (
G_GEN_1(3 downto 0) => 3,
G_GEN_2(2 downto 1) => 4,
@ -28,4 +29,68 @@ begin
port_3(2 downto 1) => w_port_3
);
end architecture ARCH;
my_block : block is
generic (
g_test : boolean
);
generic map (
G_GEN_1(3 downto 0) => 3,
G_GEN_2(2 downto 1) => 4,
G_GEN_3 => 5
);
begin
end block my_block;
end architecture rtl;
-- Violations below
PACKAGE MY_PKG_G IS NEW MY_PKG
GENERIC MAP (
G_GEN_1(3 DOWNTO 0) => 3,
G_GEN_2(2 DOWNTO 1) => 4,
G_GEN_3 => 5
);
ARCHITECTURE RTL OF TEST IS
FUNCTION MY_FUNC IS NEW MY_FUNC
GENERIC MAP (
G_GEN_1(3 DOWNTO 0) => 3,
G_GEN_2(2 DOWNTO 1) => 4,
G_GEN_3 => 5
);
BEGIN
U_INST1 : INST1
GENERIC MAP (
G_GEN_1(3 DOWNTO 0) => 3,
G_GEN_2(2 DOWNTO 1) => 4,
G_GEN_3 => 5
)
PORT MAP (
PORT_1(3 DOWNTO 0) => W_PORT_1,
PORT_2 => W_PORT_2,
PORT_3(2 DOWNTO 1) => W_PORT_3
);
MY_BLOCK : BLOCK IS
GENERIC (
G_TEST : BOOLEAN
);
GENERIC MAP (
G_GEN_1(3 DOWNTO 0) => 3,
G_GEN_2(2 DOWNTO 1) => 4,
G_GEN_3 => 5
);
BEGIN
END BLOCK MY_BLOCK;
END ARCHITECTURE RTL;

View File

@ -1,22 +1,23 @@
architecture ARCH of ENTITY1 is
package my_pkg_g is new my_pkg
generic map (
g_gen_1(3 downto 0) => 3,
g_gen_2(2 downto 1) => 4,
g_gen_3 => 5
);
architecture rtl of test is
function my_func is new my_func
generic map (
g_gen_1(3 downto 0) => 3,
g_gen_2(2 downto 1) => 4,
g_gen_3 => 5
);
begin
U_INST1 : INST1
generic map (
G_GEN_1(3 downto 0) => 3,
G_GEN_2(2 downto 1) => 4,
G_GEN_3 => 5
)
port map (
PORT_1(3 downto 0) => w_port_1,
PORT_2 => w_port_2,
PORT_3(2 downto 1) => w_port_3
);
-- Violations below
U_INST1 : INST1
u_inst1 : inst1
generic map (
g_gen_1(3 downto 0) => 3,
g_gen_2(2 downto 1) => 4,
@ -28,4 +29,68 @@ begin
port_3(2 downto 1) => w_port_3
);
end architecture ARCH;
my_block : block is
generic (
g_test : boolean
);
generic map (
g_gen_1(3 downto 0) => 3,
g_gen_2(2 downto 1) => 4,
g_gen_3 => 5
);
begin
end block my_block;
end architecture rtl;
-- Violations below
PACKAGE MY_PKG_G IS NEW MY_PKG
GENERIC MAP (
G_GEN_1(3 DOWNTO 0) => 3,
G_GEN_2(2 DOWNTO 1) => 4,
G_GEN_3 => 5
);
ARCHITECTURE RTL OF TEST IS
FUNCTION MY_FUNC IS NEW MY_FUNC
GENERIC MAP (
G_GEN_1(3 DOWNTO 0) => 3,
G_GEN_2(2 DOWNTO 1) => 4,
G_GEN_3 => 5
);
BEGIN
U_INST1 : INST1
GENERIC MAP (
G_GEN_1(3 DOWNTO 0) => 3,
G_GEN_2(2 DOWNTO 1) => 4,
G_GEN_3 => 5
)
PORT MAP (
PORT_1(3 DOWNTO 0) => W_PORT_1,
PORT_2 => W_PORT_2,
PORT_3(2 DOWNTO 1) => W_PORT_3
);
MY_BLOCK : BLOCK IS
GENERIC (
G_TEST : BOOLEAN
);
GENERIC MAP (
G_GEN_1(3 DOWNTO 0) => 3,
G_GEN_2(2 DOWNTO 1) => 4,
G_GEN_3 => 5
);
BEGIN
END BLOCK MY_BLOCK;
END ARCHITECTURE RTL;

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,6 +20,32 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map(
g_test => c_test
);
begin
U_INST1 : INST1
generic map(
G_GEN_1 => 3,
@ -27,8 +58,35 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map(
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map(
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
@ -36,10 +94,28 @@ begin
G_GEN_2 => 4,
G_GEN_3 => 5
)
port map (
port map
(
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,6 +20,32 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map(
g_test => c_test
);
begin
U_INST1 : INST1
generic map(
G_GEN_1 => 3,
@ -27,8 +58,35 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map(
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map(
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map
(
g_test => c_test
);
begin
U_INST1 : INST1
generic map
(
@ -36,10 +94,28 @@ begin
G_GEN_2 => 4,
G_GEN_3 => 5
)
port map (
port map
(
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map
(
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map
(
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,8 +20,34 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
G_GEN_1 => 3,
@ -27,13 +58,58 @@ begin
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
G_GEN_1 => 1,
G_GEN_2 => 2,
G_GEN_3 => 3
G_GEN_1 => 3,
G_GEN_2 => 4,
G_GEN_3 => 5
)
port map
(
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3);
my_block : block is
generic (
g_test : BOOLEAN);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,23 +20,92 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
G_GEN_1 => 3,
G_GEN_2 => 4,
G_GEN_3 => 5
)
port map (
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test);
begin
U_INST1 : INST1
generic map (
G_GEN_1 => 3,
G_GEN_2 => 4,
G_GEN_3 => 5)
port map (
port map
(
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
PORT_3 => w_port_3);
U_INST1 : INST1
my_block : block is
generic (
g_test : BOOLEAN);
generic map (
G_GEN_1 => 1,
G_GEN_2 => 2,
G_GEN_3 => 3);
g_test => C_TEST);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,8 +20,34 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
G_GEN_1 => 3,
@ -29,11 +60,57 @@ G_GEN_1 => 3,
PORT_3 => w_port_3
);
U_INST1 : INST1
generic map (
G_GEN_1 => 1,
G_GEN_2 => 2,
G_GEN_3 => 3
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
G_GEN_1 => 3,
G_GEN_2 => 4,
G_GEN_3 => 5
)
port map (
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,8 +20,33 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (g_test => c_test
);
begin
U_INST1 : INST1
generic map (G_GEN_1 => 3,
G_GEN_2 => 4,
@ -28,10 +58,51 @@ begin
PORT_3 => w_port_3
);
U_INST1 : INST1
generic map ( G_GEN_1 => 1,
G_GEN_2 => 2,
G_GEN_3 => 3
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (g_test => c_test
);
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map ( g_test => c_test
);
begin
U_INST1 : INST1
generic map ( G_GEN_1 => 3,
G_GEN_2 => 4,
G_GEN_3 => 5
)
port map (
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map ( g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map ( g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,8 +20,34 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
G_GEN_1 => 3,
@ -27,7 +58,33 @@ begin
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
@ -35,10 +92,25 @@ begin
G_GEN_2 => 4,
G_GEN_3 => 5
)
port map (
port map (
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,8 +20,34 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map(
g_test => c_test
);
begin
U_INST1 : INST1
generic map(
G_GEN_1 => 3,
@ -27,18 +58,59 @@ begin
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map(
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map(
g_test => c_test
);
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
generic map (
G_GEN_1 => 3,
G_GEN_2 => 4,
G_GEN_3 => 5
)
port map (
port map (
PORT_1 => w_port_1,
PORT_2 => w_port_2,
PORT_3 => w_port_3
);
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,8 +20,34 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
G_GEN_1 => 3,
@ -24,9 +55,24 @@ begin
G_GEN_3 => 5
)
port map (
PORT_1 => w_port_1,
PORT_1 => w_port_1,
PORT_2 =>w_port_2,
PORT_3 => w_port_3
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,18 +20,59 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
G_GEN_1 => 3,
G_GEN_2 =>4,
G_GEN_3 => 5
G_GEN_3 => 5
)
port map (
PORT_1 => w_port_1,
PORT_1 => w_port_1,
PORT_2 =>w_port_2,
PORT_3 => w_port_3
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test =>C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,18 +20,33 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
U_INST1 : INST1
generic map(
G_GEN_1 => 3,
4,
G_GEN_3 => 5
)
port map (w_port_1,
PORT_2 => w_port_2,
w_port_3
);
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
c_test
);
begin
U_INST1 : INST1
generic map (
@ -34,9 +54,25 @@ begin
G_GEN_2 => 4,
5
)
port map (PORT_1 => w_port_1,
w_port_2,
port map (
w_port_1,
PORT_2 => w_port_2,
w_port_3
);
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,10 +20,36 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map(
generic map (
G_GEN_1 => 3,
G_GEN_2 => 4,
G_GEN_3 => 5
@ -27,6 +58,21 @@ begin
PORT_1=> w_port_1,
PORT_2=> w_port_2,
PORT_3=> w_port_3
);
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,10 +20,36 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test=> c_test
);
begin
U_INST1 : INST1
generic map(
generic map (
G_GEN_1=> 3,
G_GEN_2=> 4,
G_GEN_3=> 5
@ -27,6 +58,21 @@ begin
PORT_1=> w_port_1,
PORT_2=> w_port_2,
PORT_3=> w_port_3
);
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test=> C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test=> c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
test_g => c_test
);
begin
U_INST1 : INST1
@ -15,13 +20,39 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
test_g : BOOLEAN
);
generic map (
test_g => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
test_g => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
generic map (
GEN_1_W => 3,
GEN_2 => 4,
GEN_3_WR => 5
G_GEN_1 => 3,
G_GEN_2 => 4,
G_GEN_3 => 5
)
port map (
PORT_1 => w_port_1,
@ -29,5 +60,25 @@ begin
PORT_3 => w_port_3
);
U_INST2 : INST2
generic map (
GEN_1_W(W_GEN_1) => 3,
GEN_2_G(W_GEN_1) => 10
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);

View File

@ -1,6 +1,11 @@
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
g_test => c_test
);
begin
U_INST1 : INST1
@ -15,13 +20,39 @@ begin
PORT_3 => w_port_3
);
my_block : block is
generic (
g_test : BOOLEAN
);
generic map (
g_test => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
g_test => c_test
);
-- Violations below
architecture ARCH of ENTITY1 is
function my_func is new my_func
generic map (
test_g => c_test
);
begin
U_INST1 : INST1
generic map (
W_GEN_1 => 3,
GEN_2 => 4,
WR_GEN_3 => 5
GEN_1_G => 3,
GEN_2_G => 4,
GEN_3_G => 5
)
port map (
PORT_1 => w_port_1,
@ -30,9 +61,24 @@ begin
);
U_INST2 : INST2
generic map (
W_GEN_1(W_GEN_1) => 3,
G_GEN_2(W_GEN_1) => 10
generic map (
W_GEN_1(W_GEN_1) => 3,
G_GEN_2(W_GEN_1) => 10
);
my_block : block is
generic (
test_g : BOOLEAN
);
generic map (
test_g => C_TEST
);
begin
end block;
end architecture ARCH;
package my_pkg_g is new my_pkg
generic map (
test_g => c_test
);

View File

@ -31,7 +31,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "001")
lExpected = [21, 21, 28, 35]
lExpected = [10, 10, 15, 20, 39, 39, 46, 53, 73, 73, 83, 93, 107, 107, 112, 117]
oRule.analyze(self.oFile)
self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
@ -43,7 +43,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "001")
lExpected = [7, 7, 28, 35]
lExpected = [5, 5, 15, 20, 27, 27, 46, 53, 63, 63, 83, 93, 102, 102, 112, 117]
oRule.analyze(self.oFile)
self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)

View File

@ -31,7 +31,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "002")
lExpected = [8, 9, 10]
lExpected = [53, 54, 55, 62, 63, 64, 71, 72, 73, 87, 88, 89]
oRule.analyze(self.oFile)
self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
@ -43,7 +43,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "002")
lExpected = [21, 22, 23]
lExpected = [4, 5, 6, 13, 14, 15, 22, 23, 24, 38, 39, 40]
oRule.analyze(self.oFile)
self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)

View File

@ -20,6 +20,7 @@ class test_generic_map_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
self.maxDiff = None
def test_rule_003(self):
oRule = generic_map.rule_003()
@ -27,7 +28,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "003")
lExpected = [33]
lExpected = [83, 91, 108, 118]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -20,6 +20,7 @@ class test_generic_map_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
self.maxDiff = None
def test_rule_004(self):
oRule = generic_map.rule_004()
@ -27,7 +28,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "004")
lExpected = [24, 35]
lExpected = [84, 92, 103, 111]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -27,7 +27,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "005")
lExpected = [21, 32]
lExpected = [45, 51, 65, 73, 79, 85, 99, 107]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -27,7 +27,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "006")
lExpected = [21, 33]
lExpected = [45, 52, 67, 76, 83, 90, 105, 114]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -27,7 +27,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "007")
lExpected = [22, 23, 24]
lExpected = [46, 53, 54, 55, 68, 77]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -23,7 +23,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "008")
lExpected = [23, 33, 35]
lExpected = [46, 53, 55, 68, 77]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -23,7 +23,7 @@ class test_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "100")
lExpected = [22, 23, 24]
lExpected = [46, 53, 54, 55, 68, 77]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -23,7 +23,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "600")
lExpected = [22, 23, 24]
lExpected = [46, 53, 54, 55, 65, 74, 83]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
@ -35,7 +35,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "600")
lExpected = [22, 23, 24]
lExpected = [46, 53, 54, 55, 65, 74, 83]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -23,7 +23,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "601")
lExpected = [22, 23, 24, 34]
lExpected = [46, 53, 54, 55, 65, 74, 83]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
@ -35,7 +35,7 @@ class test_generic_map_rule(unittest.TestCase):
self.assertEqual(oRule.name, "generic_map")
self.assertEqual(oRule.identifier, "601")
lExpected = [22, 23, 24, 34]
lExpected = [46, 53, 54, 55, 65, 74, 83]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -55,6 +55,17 @@ package body RTL is
constant sig1 : std_logic;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
end package body RTL;
-- Test functions and procedures defined in architectures

View File

@ -55,6 +55,17 @@ package body RTL is
constant sig1 : std_logic;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
end package body RTL;
-- Test functions and procedures defined in architectures

View File

@ -19,4 +19,15 @@ package body RTL is
alias a_alias1 is name;
alias a_alias2 : subtype_indictor is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
end package body RTL;

View File

@ -19,4 +19,15 @@ package body RTL is
alias a_alias1 is name;
alias a_alias2 : subtype_indictor is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
end package body RTL;

View File

@ -32,7 +32,8 @@ class test_package_body_rule(unittest.TestCase):
lExpected.extend([21, 22, 23, 25, 26])
lExpected.extend([30, 31])
lExpected.append(44)
lExpected.extend([83, 84, 85])
lExpected.append(65)
lExpected.extend([94, 95, 96])
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -102,6 +102,43 @@ architecture RTL of ENT is
begin
end procedure AVERAGE_SAMPLES;
procedure AVERAGE_SAMPLES (constant x : in integer;
constant a : in integer;
signal b : in std_logic;
variable c : in std_logic_vector(3 downto 0);
signal d : out std_logic) is
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end procedure AVERAGE_SAMPLES;
procedure AVERAGE_SAMPLES (constant x : in integer;
constant a : in integer;
signal b : in std_logic;
variable c : in std_logic_vector(3 downto 0);
signal d : out std_logic) is
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end procedure AVERAGE_SAMPLES;
procedure AVERAGE_SAMPLES (constant x : in integer;
constant a : in integer;
signal b : in std_logic;

View File

@ -102,6 +102,43 @@ architecture RTL of ENT is
begin
end procedure AVERAGE_SAMPLES;
procedure AVERAGE_SAMPLES (constant x : in integer;
constant a : in integer;
signal b : in std_logic;
variable c : in std_logic_vector(3 downto 0);
signal d : out std_logic) is
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end procedure AVERAGE_SAMPLES;
procedure AVERAGE_SAMPLES (constant x : in integer;
constant a : in integer;
signal b : in std_logic;
variable c : in std_logic_vector(3 downto 0);
signal d : out std_logic) is
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end procedure AVERAGE_SAMPLES;
procedure AVERAGE_SAMPLES (constant x : in integer;
constant a : in integer;
signal b : in std_logic;

View File

@ -19,6 +19,20 @@ architecture RTL of FIFO is
begin
end procedure proc1;
procedure proc1 is
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end procedure proc1;
function func1 return integer is
constant c : integer;
variable v : integer;

View File

@ -19,6 +19,20 @@ architecture RTL of FIFO is
begin
end procedure proc1;
procedure proc1 is
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end procedure proc1;
function func1 return integer is
constant c : integer;
variable v : integer;

View File

@ -27,7 +27,7 @@ class test_procedure_rule(unittest.TestCase):
self.assertEqual(oRule.name, "procedure")
self.assertEqual(oRule.identifier, "010")
lExpected = [31, 32, 34, 99, 100, 132, 133, 149]
lExpected = [31, 32, 34, 99, 100, 117, 169, 170, 186]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -119,4 +119,13 @@ begin
begin
end process PROC;
-- Test protected type body in the process declarative region
PROC : process (a) is
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end process PROC;
end architecture RTL;

View File

@ -119,4 +119,13 @@ begin
begin
end process PROC;
-- Test protected type body in the process declarative region
PROC : process (a) is
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
begin
end process PROC;
end architecture RTL;

View File

@ -46,4 +46,19 @@ begin
begin end process;
process
variable var1 : integer := 0;
file file1 : load_file_file open read_mode is load_file_name;
constant con1 : std_logic := '1';
alias alias1 is name;
alias alias1 : subtype_indicator is name;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
constant constant_1 : integer;
begin end process;
end architecture RTL;

View File

@ -46,4 +46,19 @@ begin
begin end process;
process
variable var1 : integer := 0;
file file1 : load_file_file open read_mode is load_file_name;
constant con1 : std_logic := '1';
alias alias1 is name;
alias alias1 : subtype_indicator is name;
constant c_abc : integer;
type flag_pt is protected body
variable flag : boolean;
end protected body;
constant constant_1 : integer;
begin end process;
end architecture RTL;

View File

@ -27,7 +27,7 @@ class test_process_rule(unittest.TestCase):
self.assertEqual(oRule.name, "process")
self.assertEqual(oRule.identifier, "031")
lExpected = [11, 12, 13, 14, 32, 34, 35, 37, 38, 65, 88, 103, 104, 118]
lExpected = [11, 12, 13, 14, 32, 34, 35, 37, 38, 65, 88, 103, 104, 118, 125]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -27,7 +27,7 @@ class test_process_rule(unittest.TestCase):
self.assertEqual(oRule.name, "process")
self.assertEqual(oRule.identifier, "033")
lExpected = [22, 23, 24, 25, 26, 41, 42, 43, 44, 45]
lExpected = [22, 23, 24, 25, 26, 41, 42, 43, 44, 45, 57]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

View File

@ -0,0 +1,101 @@
package body RTL is
type t_my_type is protected body
-- These should fail
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
-- These should pass
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
-- Test with different spacing
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
-- Test with shorter combinations
constant c_sig1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
-- Test with comments
variable v_var1 : std_logic;
constant c_sig1 : std_logic;
-- some comment
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
-- some comment
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
-- Test multiline declarations
type state_type is (
state1, state2,
state3, state4
);
constant sig1 : std_logic;
-- This should not error
type state_type2 is (
state1, state2,
state3, state4
);
constant sig1 : std_logic;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
end protected body;
constant c_cons1 : std_logic;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
end package body RTL;
-- Test functions and procedures defined in protected body
package body RTL is
type t_my_type is protected body
procedure AVERAGE_SAMPLES;
procedure AVERAGE_SAMPLES (
constant a : in integer;
signal b : in std_logic;
variable c : in std_logic_vector(3 downto 0);
signal d : out std_logic);
function func_1 (
constant a : integer;
signal b : integer;
signal c : unsigned(3 downto 0);
signal d : std_logic_vector(7 downto 0);
constant e : std_logic) return integer;
-- These should fail
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
end protected body;
end package body RTL;

View File

@ -0,0 +1,101 @@
package body RTL is
type t_my_type is protected body
-- These should fail
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
-- These should pass
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
-- Test with different spacing
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
-- Test with shorter combinations
constant c_sig1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
-- Test with comments
variable v_var1 : std_logic;
constant c_sig1 : std_logic;
-- some comment
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
-- some comment
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
-- Test multiline declarations
type state_type is (
state1, state2,
state3, state4
);
constant sig1 : std_logic;
-- This should not error
type state_type2 is (
state1, state2,
state3, state4
);
constant sig1 : std_logic;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
end protected body;
constant c_cons1 : std_logic;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
end package body RTL;
-- Test functions and procedures defined in protected body
package body RTL is
type t_my_type is protected body
procedure AVERAGE_SAMPLES;
procedure AVERAGE_SAMPLES (
constant a : in integer;
signal b : in std_logic;
variable c : in std_logic_vector(3 downto 0);
signal d : out std_logic);
function func_1 (
constant a : integer;
signal b : integer;
signal c : unsigned(3 downto 0);
signal d : std_logic_vector(7 downto 0);
constant e : std_logic) return integer;
-- These should fail
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
end protected body;
end package body RTL;

View File

@ -0,0 +1,33 @@
package body RTL is
type t_my_type is protected body
-- These should pass
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
alias a_alias2 : subtype_indictor is name;
-- These should fail
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
alias a_alias2 : subtype_indictor is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
end protected body;
constant c_cons1 : std_logic;
constant c_cons_longer : std_logic;
end package body RTL;

View File

@ -0,0 +1,33 @@
package body RTL is
type t_my_type is protected body
-- These should pass
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
alias a_alias2 : subtype_indictor is name;
-- These should fail
variable v_var1 : std_logic;
constant c_cons1 : std_logic;
file f_fil1 : load_file_type open read_mode is load_file_name;
type t_typ1 is (idle, write, read);
subtype s_sub1 is integer range 0 to 9;
alias a_alias1 is name;
alias a_alias2 : subtype_indictor is name;
-- Checking exclusions
constant c_abc : integer;
function my_func return integer is
constant c_abc : integer;
begin
end function;
end protected body;
constant c_cons1 : std_logic;
constant c_cons_longer : std_logic;
end package body RTL;

View File

@ -0,0 +1,22 @@
package body RTL is
type t_my_type is protected body
attribute mark_debug of wr_en : signal is "true";
attribute mark_debug of almost_empty : signal is "true";
attribute mark_debug of full : signal is "true";
procedure rst_procedure is
attribute mark_debug of wr_en : signal is "true";
attribute mark_debug of almost_empty : signal is "true";
attribute mark_debug of full : signal is "true";
begin
end procedure;
end protected body;
attribute mark_debug of wr_en : signal is "true";
attribute mark_debug of almost_empty : signal is "true";
attribute mark_debug of full : signal is "true";
end package body RTL;

View File

@ -0,0 +1,22 @@
package body RTL is
type t_my_type is protected body
attribute mark_debug of wr_en : signal is "true";
attribute mark_debug of almost_empty : signal is "true";
attribute mark_debug of full : signal is "true";
procedure rst_procedure is
attribute mark_debug of wr_en : signal is "true";
attribute mark_debug of almost_empty : signal is "true";
attribute mark_debug of full : signal is "true";
begin
end procedure;
end protected body;
attribute mark_debug of wr_en : signal is "true";
attribute mark_debug of almost_empty : signal is "true";
attribute mark_debug of full : signal is "true";
end package body RTL;

View File

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
import os
import unittest
from tests import utils
from vsg import vhdlFile
from vsg.rules import protected_type_body
sTestDir = os.path.dirname(__file__)
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_400_test_input.vhd"))
lExpected = []
lExpected.append("")
utils.read_file(os.path.join(sTestDir, "rule_400_test_input.fixed.vhd"), lExpected)
class test_protected_type_body_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
def test_rule_400(self):
oRule = protected_type_body.rule_400()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "protected_type_body")
self.assertEqual(oRule.identifier, "400")
lExpected = []
lExpected.extend([7, 8, 9, 10, 21, 22, 23, 25, 26, 30, 31, 44, 95, 96, 97])
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
def test_fix_rule_400(self):
oRule = protected_type_body.rule_400()
oRule.fix(self.oFile)
lActual = self.oFile.get_lines()
self.assertEqual(lExpected, lActual)
oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])

View File

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
import os
import unittest
from tests import utils
from vsg import vhdlFile
from vsg.rules import protected_type_body
sTestDir = os.path.dirname(__file__)
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_401_test_input.vhd"))
lExpected = []
lExpected.append("")
utils.read_file(os.path.join(sTestDir, "rule_401_test_input.fixed.vhd"), lExpected)
class test_protected_type_body_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
def test_rule_401(self):
oRule = protected_type_body.rule_401()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "protected_type_body")
self.assertEqual(oRule.identifier, "401")
lExpected = []
lExpected.extend([14, 15, 16, 19, 20])
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
def test_fix_rule_401(self):
oRule = protected_type_body.rule_401()
oRule.fix(self.oFile)
lActual = self.oFile.get_lines()
self.assertEqual(lExpected, lActual)
oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])

View File

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
import os
import unittest
from tests import utils
from vsg import vhdlFile
from vsg.rules import protected_type_body
sTestDir = os.path.dirname(__file__)
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_402_test_input.vhd"))
lExpected = []
lExpected.append("")
utils.read_file(os.path.join(sTestDir, "rule_402_test_input.fixed.vhd"), lExpected)
class test_protected_type_body_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
def test_rule_402(self):
oRule = protected_type_body.rule_402()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "protected_type_body")
self.assertEqual(oRule.identifier, "402")
lExpected = [4, 6]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
def test_fix_rule_402(self):
oRule = protected_type_body.rule_402()
oRule.fix(self.oFile)
lActual = self.oFile.get_lines()
self.assertEqual(lExpected, lActual)
oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])

View File

@ -47,14 +47,14 @@ package body pkg_bdy is
end package body pkg_bdy;
entity ENT is
signal sig1 : std_logic := '0'; -- Signal Comment
constant default_value : integer := 32; -- Constant Comment
shared variable var1 : std_logic_vector(3 downto 0) := "0101"; -- Variable Comment
signal sig1 : std_logic := '0'; -- Signal Comment
constant default_value : integer := 32; -- Constant Comment
shared variable var1 : std_logic_vector(3 downto 0) := "0101"; -- Variable Comment
procedure proc1 is
constant c : std_logic := '0'; -- Constant Comment
variable v : integer := 32; -- Variable Comment
constant c : std_logic := '0'; -- Constant Comment
variable v : integer := 32; -- Variable Comment
begin
@ -62,17 +62,17 @@ entity ENT is
function func1 return integer is
constant c : integer := 32; -- Constant Comment
variable v : std_logic := '1'; -- Variable Comment
constant c : integer := 32; -- Constant Comment
variable v : std_logic := '1'; -- Variable Comment
begin
end function func1;
type t_flag_type is protected body -- protected type declaration
type t_flag_type is protected body -- protected type declaration
constant default_value : integer := 32; -- Constant Comment
shared variable var1 : std_logic_vector(3 downto 0) := "0101"; -- Variable Comment
constant default_value : integer := 32; -- Constant Comment
shared variable var1 : std_logic_vector(3 downto 0) := "0101"; -- Variable Comment
end protected body T_FLAG_TYPE;
@ -80,9 +80,9 @@ end entity ENT;
architecture RTL of FIFO is
signal sig1 : std_logic := '0'; -- Signal Comment
constant default_value : integer := 32; -- Constant Comment
shared variable var1 : std_logic_vector(3 downto 0) := "0101"; -- Variable Comment
signal sig1 : std_logic := '0'; -- Signal Comment
constant default_value : integer := 32; -- Constant Comment
shared variable var1 : std_logic_vector(3 downto 0) := "0101"; -- Variable Comment
procedure proc1 is

View File

@ -15,6 +15,7 @@ lAlign.append(token.alias_declaration.is_keyword)
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_026(Rule):

View File

@ -15,6 +15,7 @@ lAlign.append(token.alias_declaration.alias_designator)
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_029(align_tokens_in_region_between_tokens_unless_between_tokens):

View File

@ -15,6 +15,7 @@ lAlign.append(token.alias_declaration.alias_designator)
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_400(align_tokens_in_region_between_tokens_unless_between_tokens):

View File

@ -13,6 +13,7 @@ lAlign.append(token.alias_declaration.is_keyword)
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_401(align_tokens_in_region_between_tokens_unless_between_tokens):

View File

@ -17,6 +17,7 @@ oEndToken = token.subprogram_body.begin_keyword
lUnless = []
lUnless.append([token.procedure_specification.procedure_keyword, token.subprogram_body.semicolon])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_012(Rule):

View File

@ -15,6 +15,7 @@ lAlign.append(token.alias_declaration.alias_designator)
lUnless = []
lUnless.append([token.procedure_specification.procedure_keyword, token.subprogram_body.semicolon])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_015(align_tokens_in_region_between_tokens_unless_between_tokens):

View File

@ -1,17 +1,14 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import token_case_in_range_bounded_by_tokens
from vsg.rules import token_case
lTokens = []
lTokens.append(token.generic_map_aspect.generic_keyword)
lTokens.append(token.generic_map_aspect.map_keyword)
oStart = token.component_instantiation_statement.label_colon
oEnd = token.component_instantiation_statement.semicolon
class rule_001(token_case_in_range_bounded_by_tokens):
class rule_001(token_case):
"""
This rule checks the **generic map** keywords have proper case.
@ -31,5 +28,5 @@ class rule_001(token_case_in_range_bounded_by_tokens):
"""
def __init__(self):
super().__init__(lTokens, oStart, oEnd)
super().__init__(lTokens)
self.groups.append("case::keyword")

View File

@ -5,8 +5,8 @@ from vsg.rules import (
token_case_formal_part_of_association_element_in_map_between_tokens,
)
oStart = token.component_instantiation_statement.instantiation_label
oEnd = token.component_instantiation_statement.semicolon
oStart = token.generic_map_aspect.generic_keyword
oEnd = token.generic_map_aspect.close_parenthesis
sMapType = "generic"

View File

@ -14,6 +14,7 @@ lAlign.append(token.alias_declaration.alias_designator)
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_400(align_tokens_in_region_between_tokens_unless_between_tokens):

View File

@ -18,6 +18,7 @@ oEnd = token.package_body.end_keyword
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_401(Rule):

View File

@ -15,6 +15,7 @@ lAlign.append(token.alias_declaration.alias_designator)
lUnless = []
lUnless.append([token.function_specification.function_keyword, token.subprogram_body.semicolon])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_010(align_tokens_in_region_between_tokens_unless_between_tokens):

View File

@ -17,6 +17,7 @@ oEndToken = token.subprogram_body.begin_keyword
lUnless = []
lUnless.append([token.function_specification.function_keyword, token.subprogram_body.semicolon])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_401(Rule):

View File

@ -18,6 +18,7 @@ oEnd = token.process_statement.begin_keyword
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_031(align_tokens_in_region_between_tokens_unless_between_tokens):

View File

@ -15,6 +15,7 @@ lAlign.append(token.alias_declaration.is_keyword)
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
lUnless.append([token.protected_type_body.body_keyword, token.protected_type_body.end_body_keyword])
class rule_033(Rule):

View File

@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
from .rule_300 import rule_300
from .rule_400 import rule_400
from .rule_401 import rule_401
from .rule_402 import rule_402
from .rule_500 import rule_500
from .rule_501 import rule_501
from .rule_502 import rule_502

View File

@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import (
align_tokens_in_region_between_tokens_unless_between_tokens as Rule,
)
lAlign = []
lAlign.append(token.full_type_declaration.identifier)
lAlign.append(token.incomplete_type_declaration.identifier)
lAlign.append(token.file_declaration.identifier)
lAlign.append(token.constant_declaration.identifier)
lAlign.append(token.subtype_declaration.identifier)
lAlign.append(token.variable_declaration.identifier)
lAlign.append(token.alias_declaration.alias_designator)
oStart = token.protected_type_body.body_keyword
oEnd = token.protected_type_body.end_body_keyword
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
class rule_400(Rule):
"""
This rule checks the identifiers for all declarations are aligned in the protected type body declarative region.
|configuring_identifier_alignment_rules_link|
**Violation**
.. code-block:: vhdl
variable var1 : natural;
constant c_period : time;
**Fix**
.. code-block:: vhdl
variable var1 : natural;
constant c_period : time;
"""
def __init__(self):
super().__init__(lAlign, oStart, oEnd, lUnless)
self.solution = "Align identifier."
self.configuration_documentation_link = "configuring_identifier_alignment_rules_link"
self.configuration.remove("separate_generic_port_alignment")
self.configuration.remove("if_control_statements_ends_group")
self.configuration.remove("case_control_statements_ends_group")
self.configuration.remove("loop_control_statements_ends_group")

View File

@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import (
align_tokens_in_region_between_tokens_unless_between_tokens as Rule,
)
lAlign = []
lAlign.append(token.file_declaration.colon)
lAlign.append(token.signal_declaration.colon)
lAlign.append(token.constant_declaration.colon)
lAlign.append(token.variable_declaration.colon)
lAlign.append(token.alias_declaration.colon)
lAlign.append(token.alias_declaration.is_keyword)
oStart = token.protected_type_body.body_keyword
oEnd = token.protected_type_body.end_body_keyword
lUnless = []
lUnless.append([token.subprogram_body.is_keyword, token.subprogram_body.begin_keyword])
class rule_401(Rule):
"""
This rule checks the colons are in the same column for all declarations in the protected type body declarative part.
|configuring_keyword_alignment_rules_link|
**Violation**
.. code-block:: vhdl
type my_type protected body is
signal wr_en : std_logic;
signal rd_en : std_logic;
constant c_period : time;
end protected body;
**Fix**
.. code-block:: vhdl
type my_type protected body is
signal wr_en : std_logic;
signal rd_en : std_logic;
constant c_period : time;
end protected body;
"""
def __init__(self):
super().__init__(lAlign, oStart, oEnd, lUnless)
self.solution = "Align colon."
self.subphase = 3
self.configuration.remove("separate_generic_port_alignment")
self.configuration.remove("if_control_statements_ends_group")
self.configuration.remove("case_control_statements_ends_group")
self.configuration.remove("loop_control_statements_ends_group")

Some files were not shown because too many files have changed in this diff Show More