diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/std_names.adb | 2 | ||||
-rw-r--r-- | src/std_names.ads | 4 | ||||
-rw-r--r-- | src/vhdl/vhdl-ieee-numeric.adb | 30 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 6 |
4 files changed, 41 insertions, 1 deletions
diff --git a/src/std_names.adb b/src/std_names.adb index 8855b3b75..0545fdbaa 100644 --- a/src/std_names.adb +++ b/src/std_names.adb @@ -676,6 +676,8 @@ package body Std_Names is Def ("shr", Name_Shr); Def ("ext", Name_Ext); Def ("sxt", Name_Sxt); + Def ("find_leftmost", Name_Find_Leftmost); + Def ("find_rightmost", Name_Find_Rightmost); Def ("allconst", Name_Allconst); Def ("allseq", Name_Allseq); diff --git a/src/std_names.ads b/src/std_names.ads index 1bcc6943d..0d8950171 100644 --- a/src/std_names.ads +++ b/src/std_names.ads @@ -759,7 +759,9 @@ package Std_Names is Name_Shr : constant Name_Id := Name_First_Ieee_Name + 046; Name_Ext : constant Name_Id := Name_First_Ieee_Name + 047; Name_Sxt : constant Name_Id := Name_First_Ieee_Name + 048; - Name_Last_Ieee_Name : constant Name_Id := Name_Sxt; + Name_Find_Leftmost : constant Name_Id := Name_First_Ieee_Name + 049; + Name_Find_Rightmost : constant Name_Id := Name_First_Ieee_Name + 050; + Name_Last_Ieee_Name : constant Name_Id := Name_Find_Rightmost; Name_First_Synthesis : constant Name_Id := Name_Last_Ieee_Name + 1; Name_Allconst : constant Name_Id := Name_First_Synthesis + 000; diff --git a/src/vhdl/vhdl-ieee-numeric.adb b/src/vhdl/vhdl-ieee-numeric.adb index fae624d78..b7fb3975d 100644 --- a/src/vhdl/vhdl-ieee-numeric.adb +++ b/src/vhdl/vhdl-ieee-numeric.adb @@ -568,6 +568,14 @@ package body Vhdl.Ieee.Numeric is (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Sra_Sgn_Int, Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Sra_Uns_Int); + Leftmost_Patterns : constant Shift_Pattern_Type := + (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Find_Leftmost_Sgn, + Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Find_Leftmost_Uns); + + Rightmost_Patterns : constant Shift_Pattern_Type := + (Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Find_Rightmost_Sgn, + Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Find_Rightmost_Uns); + Error : exception; procedure Extract_Declarations (Pkg_Decl : Iir_Package_Declaration; @@ -801,6 +809,24 @@ package body Vhdl.Ieee.Numeric is Set_Implicit_Definition (Decl, Res); end if; end Handle_Shift; + + procedure Handle_Find (Pats : Shift_Pattern_Type) + is + Res : Iir_Predefined_Functions; + begin + if Arg1_Kind = Arg_Vect + and then Arg2_Kind = Arg_Scal + and then Arg2_Sign = Type_Log + then + case Arg1_Sign is + when Type_Signed | Type_Unsigned => + Res := Pats (Arg1_Sign); + when others => + Res := Iir_Predefined_None; + end case; + Set_Implicit_Definition (Decl, Res); + end if; + end Handle_Find; begin Decl := Get_Declaration_Chain (Pkg_Decl); @@ -951,6 +977,10 @@ package body Vhdl.Ieee.Numeric is Handle_Shift (Rol_Patterns, Type_Unsigned); when Name_Rotate_Right => Handle_Shift (Ror_Patterns, Type_Unsigned); + when Name_Find_Leftmost => + Handle_Find (Leftmost_Patterns); + when Name_Find_Rightmost => + Handle_Find (Rightmost_Patterns); when Name_To_01 => Handle_To_01; when others => diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 82a45c3ed..f98ff93a0 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -5807,6 +5807,12 @@ package Vhdl.Nodes is Iir_Predefined_Ieee_Numeric_Std_Xor_Uns, Iir_Predefined_Ieee_Numeric_Std_Xnor_Uns, + -- Find. + Iir_Predefined_Ieee_Numeric_Std_Find_Leftmost_Uns, + Iir_Predefined_Ieee_Numeric_Std_Find_Rightmost_Uns, + Iir_Predefined_Ieee_Numeric_Std_Find_Leftmost_Sgn, + Iir_Predefined_Ieee_Numeric_Std_Find_Rightmost_Sgn, + -- Std_Match functions. Iir_Predefined_Ieee_Numeric_Std_Match_Log, Iir_Predefined_Ieee_Numeric_Std_Match_Uns, |