diff options
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; |