diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-04-26 10:29:42 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-04-26 10:29:42 +0200 |
commit | 966e54b26cafee87071539c81503918ed893cb5d (patch) | |
tree | 5a071035a14012ee6e677a352a0992f8e2886e17 /src/vhdl/vhdl-sem_expr.adb | |
parent | c0edef4e9bd10b54932f972d9496679dd8a60614 (diff) | |
download | ghdl-966e54b26cafee87071539c81503918ed893cb5d.tar.gz ghdl-966e54b26cafee87071539c81503918ed893cb5d.tar.bz2 ghdl-966e54b26cafee87071539c81503918ed893cb5d.zip |
vhdl: handle static expressions with ieee operations
Diffstat (limited to 'src/vhdl/vhdl-sem_expr.adb')
-rw-r--r-- | src/vhdl/vhdl-sem_expr.adb | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb index 2719f86cf..9bc64b959 100644 --- a/src/vhdl/vhdl-sem_expr.adb +++ b/src/vhdl/vhdl-sem_expr.adb @@ -17,6 +17,7 @@ with Grt.Algos; with Errorout; use Errorout; with Name_Table; +with Std_Names; with Str_Table; with Flags; use Flags; @@ -35,6 +36,7 @@ with Vhdl.Sem_Decls; with Vhdl.Sem_Psl; with Vhdl.Xrefs; use Vhdl.Xrefs; with Vhdl.Ieee.Std_Logic_1164; +with Vhdl.Ieee.Numeric; package body Vhdl.Sem_Expr is @@ -886,6 +888,28 @@ package body Vhdl.Sem_Expr is return Res; end Sem_Discrete_Range_Integer; + function Is_Ieee_Operator (Imp : Iir) return Boolean + is + use Std_Names; + Parent : Iir; + begin + pragma Assert (Get_Kind (Imp) = Iir_Kind_Function_Declaration); + case Get_Identifier (Imp) is + when Name_Id_Operators + | Name_Word_Operators + | Name_Logical_Operators => + null; + when others => + -- Not an operator. + return False; + end case; + + -- TODO: numeric_bit, numeric_bit_unsigned, numeric_std_unsigned. + Parent := Get_Parent (Imp); + return Parent = Vhdl.Ieee.Numeric.Numeric_Std_Pkg + or Parent = Vhdl.Ieee.Std_Logic_1164.Std_Logic_1164_Pkg; + end Is_Ieee_Operator; + procedure Set_Function_Call_Staticness (Expr : Iir; Imp : Iir) is Staticness : Iir_Staticness; @@ -940,7 +964,11 @@ package body Vhdl.Sem_Expr is -- Predefined functions such as Now, Endfile are not static. Staticness := None; when Iir_Predefined_Explicit => - if Get_Pure_Flag (Imp) then + if Vhdl_Std >= Vhdl_08 + and then Is_Ieee_Operator (Imp) + then + null; + elsif Get_Pure_Flag (Imp) then Staticness := Min (Staticness, Globally); else Staticness := None; |