diff options
author | Ondrej Ille <ondrej.ille@gmail.com> | 2021-03-27 10:50:25 +0100 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2021-03-28 09:46:05 +0200 |
commit | 1a2217b162ce01bc17eefe4d7d79fb32d5cb1aa0 (patch) | |
tree | 604341ab78fedcc54736e1210056b849b7e8dc49 /src | |
parent | 14ca9272bdf9a6a33944e92d4eac0dfea79634ee (diff) | |
download | ghdl-1a2217b162ce01bc17eefe4d7d79fb32d5cb1aa0.tar.gz ghdl-1a2217b162ce01bc17eefe4d7d79fb32d5cb1aa0.tar.bz2 ghdl-1a2217b162ce01bc17eefe4d7d79fb32d5cb1aa0.zip |
src: Psl, check positive count range already during parsing.
Diffstat (limited to 'src')
-rw-r--r-- | src/vhdl/vhdl-parse_psl.adb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-parse_psl.adb b/src/vhdl/vhdl-parse_psl.adb index 18bdf9865..b453423f4 100644 --- a/src/vhdl/vhdl-parse_psl.adb +++ b/src/vhdl/vhdl-parse_psl.adb @@ -66,12 +66,27 @@ package body Vhdl.Parse_Psl is end if; end Parse_Number; + procedure Check_Positive_Count(N : Node) is + Low : Uns32; + High : Uns32; + begin + Low := Get_Value(Get_Low_Bound(N)); + High := Get_Value(Get_High_Bound(N)); + if Low >= High then + Error_Msg_Parse ( + "Low bound of range must be lower than High bound," & + " actual range is:" & + Uns32'Image(Low) & " to" & Uns32'Image(High)); + end if; + end Check_Positive_Count; + procedure Parse_Count (N : Node) is begin Set_Low_Bound (N, Parse_Number); if Current_Token = Tok_To then Scan; Set_High_Bound (N, Parse_Number); + Check_Positive_Count (N); end if; end Parse_Count; @@ -354,6 +369,7 @@ package body Vhdl.Parse_Psl is else Scan; end if; + Check_Positive_Count(N); end if; end Parse_Bracket_Range; |