Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 18 additions & 1 deletion docs/configuring_vhdl_reserved_words.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ These rules provide the following options:
.. |standard__2008| replace::
:code:`2008` = Use reserved keywords from 2008 standard

.. |standard__2019| replace::
:code:`2019` = Use reserved keywords from 2019 standard

.. |standard__all| replace::
:code:`all` = Use reserved keywords from all standards

.. |values| replace::
:code:`1987`, :code:`1993`, :code:`2000`, :code:`2002`, :code:`2008`
:code:`1987`, :code:`1993`, :code:`2000`, :code:`2002`, :code:`2008`, :code:`2019`

.. |default_value| replace::
:code:`all`
Expand All @@ -45,6 +48,7 @@ These rules provide the following options:
| | | | * |standard__2000| |
| | | | * |standard__2002| |
| | | | * |standard__2008| |
| | | | * |standard__2019| |
| | | | * |standard__all| |
+----------------------+----------+-----------------+----------------------------+

Expand Down Expand Up @@ -96,6 +100,19 @@ The :code:`context` keyword is a reserved word in the 2008 standard.
end entity;


Example: |standard_option| set to :code:`2019`
##############################################

The :code:`private` keyword is a reserved word in the 2019 standard.

**Violation**

.. code-block:: yaml

entity private is
end entity;


Rules Enforcing Optional Items
##############################

Expand Down
8 changes: 5 additions & 3 deletions tests/reserved/rule_001_test_input.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

-- Making identifiers out of reserved keywords to test the awesome vsg project

entity null is -- 'null' is a reserved keyword since 1987
entity null is -- 'null' is a reserved keyword since 1987
generic (
default : natural; -- 'default' is a reserved keyword since 2008
unaffected : natural -- 'unaffected' is a reserved keyword since 1993
vpkg : positive; -- 'vpkg' is a reserved keyword since 2019
default : natural; -- 'default' is a reserved keyword since 2008
unaffected : natural -- 'unaffected' is a reserved keyword since 1993
);
port (
private : out natural; -- 'private' since 2019
Expand All @@ -19,6 +20,7 @@ end entity null; -- 'null' since 1987

architecture rol of null is -- 'rol' since 1993, 'null' since 1987

signal view : boolean; -- 'view' since 2019
signal procedural : natural; -- 'procedural' reserved in 2002 and not in 2008
signal open : natural; -- 'open' reserved since 1987
signal wilbur : std_logic; -- legal
Expand Down
21 changes: 15 additions & 6 deletions tests/reserved/test_rule_001.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_all_standards(self):
self.assertEqual(oRule.identifier, "001")
self.assertFalse(oRule.fixable)

lExpected = [7, 9, 10, 14, 18, 20, 20, 22, 23, 28, 28, 30, 36, 42]
lExpected = [7, 9, 10, 11, 14, 15, 19, 21, 21, 23, 24, 25, 30, 30, 32, 38, 44]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Expand All @@ -34,7 +34,7 @@ def test_1987_standard(self):
oRule = reserved.rule_001()
oRule.standard = "1987"

lExpected = [7, 10, 18, 20, 20, 23, 28, 42]
lExpected = [7, 11, 19, 21, 21, 25, 30, 44]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Expand All @@ -43,7 +43,7 @@ def test_1993_standard(self):
oRule = reserved.rule_001()
oRule.standard = "1987"

lExpected = [7, 10, 18, 20, 20, 23, 28, 42]
lExpected = [7, 11, 19, 21, 21, 25, 30, 44]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Expand All @@ -52,7 +52,7 @@ def test_2000_standard(self):
oRule = reserved.rule_001()
oRule.standard = "2000"

lExpected = [7, 10, 18, 20, 20, 22, 23, 28, 30, 42]
lExpected = [7, 11, 19, 21, 21, 24, 25, 30, 32, 44]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Expand All @@ -61,7 +61,7 @@ def test_2002_standard(self):
oRule = reserved.rule_001()
oRule.standard = "2002"

lExpected = [7, 10, 18, 20, 20, 22, 23, 28, 30, 42]
lExpected = [7, 11, 19, 21, 21, 24, 25, 30, 32, 44]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
Expand All @@ -70,7 +70,16 @@ def test_2008_standard(self):
oRule = reserved.rule_001()
oRule.standard = "2008"

lExpected = [7, 9, 10, 14, 18, 20, 20, 23, 28, 28, 36, 42]
lExpected = [7, 10, 11, 15, 19, 21, 21, 25, 30, 30, 38, 44]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

def test_2019_standard(self):
oRule = reserved.rule_001()
oRule.standard = "2019"

lExpected = [7, 9, 10, 11, 14, 15, 19, 21, 21, 23, 25, 30, 30, 38, 44]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
119 changes: 119 additions & 0 deletions vsg/rules/reserved/rule_001.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,125 @@ def uniquify_standards(dMap):
"xnor",
"xor",
]
# https://www.0x04.net/~mwk/vstd/ieee-1076-2019.pdf, p. 266-267, 15.10: Resserved Words
dMap["2019"] = [
"abs",
"access",
"after",
"alias",
"all",
"and",
"architecture",
"array",
"assert",
"assume",
"attribute",
"begin",
"block",
"body",
"buffer",
"bus",
"case",
"component",
"configuration",
"constant",
"context",
"cover",
"default",
"disconnect",
"downto",
"else",
"elsif",
"end",
"entity",
"exit",
"fairness",
"file",
"for",
"force",
"function",
"generate",
"generic",
"group",
"guarded",
"if",
"impure",
"in",
"inertial",
"inout",
"is",
"label",
"library",
"linkage",
"literal",
"loop",
"map",
"mod",
"nand",
"new",
"next",
"nor",
"not",
"null",
"of",
"on",
"open",
"or",
"others",
"out",
"package",
"parameter",
"port",
"postponed",
"procedure",
"process",
"property",
"protected",
"private",
"pure",
"range",
"record",
"register",
"reject",
"release",
"rem",
"report",
"restrict",
"return",
"rol",
"ror",
"select",
"sequence",
"severity",
"signal",
"shared",
"sla",
"sll",
"sra",
"srl",
"strong",
"subtype",
"then",
"to",
"transport",
"type",
"unaffected",
"units",
"until",
"use",
"variable",
"view",
"vpkg",
"vmode",
"vprop",
"vunit",
"wait",
"when",
"while",
"with",
"xnor",
"xor",
]
dMap["all"] = uniquify_standards(dMap)


Expand Down
Loading