From a595084ffa2bac6a33ba5859f86808fa6fc8ea02 Mon Sep 17 00:00:00 2001 From: Jeremiah Leary Date: Thu, 10 Jul 2025 07:47:38 -0500 Subject: [PATCH] Issue#1403: VSG crashes in constaint due to not checking for "is" or ">>". (#1405) --- .../classification_results.txt | 191 ++++++++++-------- .../classification_test_input.vhd | 6 +- vsg/vhdlFile/classify/range_constraint.py | 2 +- 3 files changed, 109 insertions(+), 90 deletions(-) diff --git a/tests/vhdlFile/alias_declaration/classification_results.txt b/tests/vhdlFile/alias_declaration/classification_results.txt index 22a6aa56..b96789f4 100644 --- a/tests/vhdlFile/alias_declaration/classification_results.txt +++ b/tests/vhdlFile/alias_declaration/classification_results.txt @@ -14,19 +14,7 @@ 3 | -------------------------------------------------------------------------------- -4 | - --------------------------------------------------------------------------------- -5 | - --------------------------------------------------------------------------------- -6 | - --------------------------------------------------------------------------------- -7 | - --------------------------------------------------------------------------------- -8 | alias ident : std_logic_vector(3 downto 0) is write_enable [name1, name2 return integer]; +4 | alias ident : std_logic_vector(3 downto 0) is write_enable [name1, name2 return integer]; @@ -47,53 +35,53 @@ -------------------------------------------------------------------------------- +5 | + +-------------------------------------------------------------------------------- +6 | alias ident : std_logic_vector(3 downto 0) is write_enable [name1, name2]; + + + + + + + + + + + + + + + + + +-------------------------------------------------------------------------------- +7 | + +-------------------------------------------------------------------------------- +8 | alias ident : std_logic_vector(3 downto 0) is write_enable [return integer]; + + + + + + + + + + + + + + + + +-------------------------------------------------------------------------------- 9 | -------------------------------------------------------------------------------- -10 | alias ident : std_logic_vector(3 downto 0) is write_enable [name1, name2]; - - - - - - - - - - - - - - - - - --------------------------------------------------------------------------------- -11 | - --------------------------------------------------------------------------------- -12 | alias ident : std_logic_vector(3 downto 0) is write_enable [return integer]; - - - - - - - - - - - - - - - - --------------------------------------------------------------------------------- -13 | - --------------------------------------------------------------------------------- -14 | alias ident : std_logic_vector(3 downto 0) is write_enable(15 downto 0); +10 | alias ident : std_logic_vector(3 downto 0) is write_enable(15 downto 0); @@ -112,13 +100,13 @@ -------------------------------------------------------------------------------- -15 | +11 | -------------------------------------------------------------------------------- -16 | +12 | -------------------------------------------------------------------------------- -17 | alias ident is write_enable [name1, name2 return integer]; +13 | alias ident is write_enable [name1, name2 return integer]; @@ -132,55 +120,88 @@ -------------------------------------------------------------------------------- +14 | + +-------------------------------------------------------------------------------- +15 | alias ident is write_enable [name1, name2]; + + + + + + + + + + +-------------------------------------------------------------------------------- +16 | + +-------------------------------------------------------------------------------- +17 | alias ident is write_enable [return integer]; + + + + + + + + + +-------------------------------------------------------------------------------- 18 | -------------------------------------------------------------------------------- -19 | alias ident is write_enable [name1, name2]; +19 | alias ident is write_enable; - - - - - -------------------------------------------------------------------------------- 20 | -------------------------------------------------------------------------------- -21 | alias ident is write_enable [return integer]; +21 | alias s_event_count : natural range 0 to 2**16 - 1 is << signal some.reference.some_signal : natural range 0 to 2**16 - 1 >>; - - - - + - + + + + + + + + + + + + + + + + + + + + + + + -------------------------------------------------------------------------------- 22 | -------------------------------------------------------------------------------- -23 | alias ident is write_enable; - - - - - +23 | begin + -------------------------------------------------------------------------------- 24 | -------------------------------------------------------------------------------- -25 | begin - --------------------------------------------------------------------------------- -26 | - --------------------------------------------------------------------------------- -27 | end architecture RTL; +25 | end architecture RTL; diff --git a/tests/vhdlFile/alias_declaration/classification_test_input.vhd b/tests/vhdlFile/alias_declaration/classification_test_input.vhd index 5025b8fd..a79f7224 100644 --- a/tests/vhdlFile/alias_declaration/classification_test_input.vhd +++ b/tests/vhdlFile/alias_declaration/classification_test_input.vhd @@ -1,10 +1,6 @@ architecture RTL of FIFO is - - - - alias ident : std_logic_vector(3 downto 0) is write_enable [name1, name2 return integer]; alias ident : std_logic_vector(3 downto 0) is write_enable [name1, name2]; @@ -22,6 +18,8 @@ architecture RTL of FIFO is alias ident is write_enable; + alias s_event_count : natural range 0 to 2**16 - 1 is << signal some.reference.some_signal : natural range 0 to 2**16 - 1 >>; + begin end architecture RTL; diff --git a/vsg/vhdlFile/classify/range_constraint.py b/vsg/vhdlFile/classify/range_constraint.py index c47a6866..9750fdbd 100644 --- a/vsg/vhdlFile/classify/range_constraint.py +++ b/vsg/vhdlFile/classify/range_constraint.py @@ -20,7 +20,7 @@ def classify(iToken, lObjects): iCurrent = utils.assign_next_token_required("range", token.range_keyword, iToken, lObjects) iParenCnt = 0 - while not utils.is_next_token_one_of([";", "units", ":="], iCurrent, lObjects): + while not utils.is_next_token_one_of([";", "units", ":=", "is", ">>"], iCurrent, lObjects): iCurrent = utils.find_next_token(iCurrent, lObjects) iParenCnt = utils.update_paren_counter(iCurrent, lObjects, iParenCnt) if iParenCnt == -1: