aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/libghdl/thin/std_names.py366
-rw-r--r--src/std_names.adb2
-rw-r--r--src/std_names.ads4
-rw-r--r--src/vhdl/vhdl-ieee-numeric.adb30
-rw-r--r--src/vhdl/vhdl-nodes.ads6
5 files changed, 225 insertions, 183 deletions
diff --git a/python/libghdl/thin/std_names.py b/python/libghdl/thin/std_names.py
index 45c87a93e..540d37c33 100644
--- a/python/libghdl/thin/std_names.py
+++ b/python/libghdl/thin/std_names.py
@@ -625,185 +625,187 @@ class Name:
Shr = 837
Ext = 838
Sxt = 839
- Last_Ieee_Name = 839
- First_Synthesis = 840
- Allconst = 840
- Allseq = 841
- Anyconst = 842
- Anyseq = 843
- Last_Synthesis = 843
- First_Directive = 844
- Define = 844
- Endif = 845
- Ifdef = 846
- Ifndef = 847
- Include = 848
- Timescale = 849
- Undef = 850
- Protect = 851
- Begin_Protected = 852
- End_Protected = 853
- Key_Block = 854
- Data_Block = 855
- Line = 856
- Celldefine = 857
- Endcelldefine = 858
- Default_Nettype = 859
- Resetall = 860
- Last_Directive = 860
- First_Systask = 861
- Bits = 861
- D_Root = 862
- D_Unit = 863
- Last_Systask = 863
- First_SV_Method = 864
- Size = 864
- Insert = 865
- Delete = 866
- Pop_Front = 867
- Pop_Back = 868
- Push_Front = 869
- Push_Back = 870
- Name = 871
- Len = 872
- Substr = 873
- Exists = 874
- Atoi = 875
- Itoa = 876
- Find = 877
- Find_Index = 878
- Find_First = 879
- Find_First_Index = 880
- Find_Last = 881
- Find_Last_Index = 882
- Num = 883
- Randomize = 884
- Pre_Randomize = 885
- Post_Randomize = 886
- Srandom = 887
- Get_Randstate = 888
- Set_Randstate = 889
- Seed = 890
- State = 891
- Last_SV_Method = 891
- First_BSV = 892
- uAction = 892
- uActionValue = 893
- BVI = 894
- uC = 895
- uCF = 896
- uE = 897
- uSB = 898
- uSBR = 899
- Action = 900
- Endaction = 901
- Actionvalue = 902
- Endactionvalue = 903
- Ancestor = 904
- Clocked_By = 905
- Default_Clock = 906
- Default_Reset = 907
- Dependencies = 908
- Deriving = 909
- Determines = 910
- Enable = 911
- Ifc_Inout = 912
- Input_Clock = 913
- Input_Reset = 914
- Instance = 915
- Endinstance = 916
- Let = 917
- Match = 918
- Method = 919
- Endmethod = 920
- Numeric = 921
- Output_Clock = 922
- Output_Reset = 923
- Par = 924
- Endpar = 925
- Path = 926
- Provisos = 927
- Ready = 928
- Reset_By = 929
- Rule = 930
- Endrule = 931
- Rules = 932
- Endrules = 933
- Same_Family = 934
- Schedule = 935
- Seq = 936
- Endseq = 937
- Typeclass = 938
- Endtypeclass = 939
- Valueof = 940
- uValueof = 941
- Last_BSV = 941
- First_Comment = 942
- Psl = 942
- Pragma = 943
- Synthesis = 944
- Synopsys = 945
- Translate_Off = 946
- Translate_On = 947
- Translate = 948
- Synthesis_Off = 949
- Synthesis_On = 950
- Off = 951
- Last_Comment = 951
- First_PSL = 952
- A = 952
- Af = 953
- Ag = 954
- Ax = 955
- Abort = 956
- Assume_Guarantee = 957
- Before = 958
- Clock = 959
- E = 960
- Ef = 961
- Eg = 962
- Ex = 963
- Endpoint = 964
- Eventually = 965
- Fairness = 966
- Fell = 967
- Forall = 968
- G = 969
- Inf = 970
- Inherit = 971
- Never = 972
- Next_A = 973
- Next_E = 974
- Next_Event = 975
- Next_Event_A = 976
- Next_Event_E = 977
- Prev = 978
- Rose = 979
- Strong = 980
- W = 981
- Whilenot = 982
- Within = 983
- X = 984
- Last_PSL = 984
- First_Edif = 985
- Celltype = 995
- View = 996
- Viewtype = 997
- Direction = 998
- Contents = 999
- Net = 1000
- Viewref = 1001
- Cellref = 1002
- Libraryref = 1003
- Portinstance = 1004
- Joined = 1005
- Portref = 1006
- Instanceref = 1007
- Design = 1008
- Designator = 1009
- Owner = 1010
- Member = 1011
- Number = 1012
- Rename = 1013
- Userdata = 1014
- Last_Edif = 1014
+ Find_Leftmost = 840
+ Find_Rightmost = 841
+ Last_Ieee_Name = 841
+ First_Synthesis = 842
+ Allconst = 842
+ Allseq = 843
+ Anyconst = 844
+ Anyseq = 845
+ Last_Synthesis = 845
+ First_Directive = 846
+ Define = 846
+ Endif = 847
+ Ifdef = 848
+ Ifndef = 849
+ Include = 850
+ Timescale = 851
+ Undef = 852
+ Protect = 853
+ Begin_Protected = 854
+ End_Protected = 855
+ Key_Block = 856
+ Data_Block = 857
+ Line = 858
+ Celldefine = 859
+ Endcelldefine = 860
+ Default_Nettype = 861
+ Resetall = 862
+ Last_Directive = 862
+ First_Systask = 863
+ Bits = 863
+ D_Root = 864
+ D_Unit = 865
+ Last_Systask = 865
+ First_SV_Method = 866
+ Size = 866
+ Insert = 867
+ Delete = 868
+ Pop_Front = 869
+ Pop_Back = 870
+ Push_Front = 871
+ Push_Back = 872
+ Name = 873
+ Len = 874
+ Substr = 875
+ Exists = 876
+ Atoi = 877
+ Itoa = 878
+ Find = 879
+ Find_Index = 880
+ Find_First = 881
+ Find_First_Index = 882
+ Find_Last = 883
+ Find_Last_Index = 884
+ Num = 885
+ Randomize = 886
+ Pre_Randomize = 887
+ Post_Randomize = 888
+ Srandom = 889
+ Get_Randstate = 890
+ Set_Randstate = 891
+ Seed = 892
+ State = 893
+ Last_SV_Method = 893
+ First_BSV = 894
+ uAction = 894
+ uActionValue = 895
+ BVI = 896
+ uC = 897
+ uCF = 898
+ uE = 899
+ uSB = 900
+ uSBR = 901
+ Action = 902
+ Endaction = 903
+ Actionvalue = 904
+ Endactionvalue = 905
+ Ancestor = 906
+ Clocked_By = 907
+ Default_Clock = 908
+ Default_Reset = 909
+ Dependencies = 910
+ Deriving = 911
+ Determines = 912
+ Enable = 913
+ Ifc_Inout = 914
+ Input_Clock = 915
+ Input_Reset = 916
+ Instance = 917
+ Endinstance = 918
+ Let = 919
+ Match = 920
+ Method = 921
+ Endmethod = 922
+ Numeric = 923
+ Output_Clock = 924
+ Output_Reset = 925
+ Par = 926
+ Endpar = 927
+ Path = 928
+ Provisos = 929
+ Ready = 930
+ Reset_By = 931
+ Rule = 932
+ Endrule = 933
+ Rules = 934
+ Endrules = 935
+ Same_Family = 936
+ Schedule = 937
+ Seq = 938
+ Endseq = 939
+ Typeclass = 940
+ Endtypeclass = 941
+ Valueof = 942
+ uValueof = 943
+ Last_BSV = 943
+ First_Comment = 944
+ Psl = 944
+ Pragma = 945
+ Synthesis = 946
+ Synopsys = 947
+ Translate_Off = 948
+ Translate_On = 949
+ Translate = 950
+ Synthesis_Off = 951
+ Synthesis_On = 952
+ Off = 953
+ Last_Comment = 953
+ First_PSL = 954
+ A = 954
+ Af = 955
+ Ag = 956
+ Ax = 957
+ Abort = 958
+ Assume_Guarantee = 959
+ Before = 960
+ Clock = 961
+ E = 962
+ Ef = 963
+ Eg = 964
+ Ex = 965
+ Endpoint = 966
+ Eventually = 967
+ Fairness = 968
+ Fell = 969
+ Forall = 970
+ G = 971
+ Inf = 972
+ Inherit = 973
+ Never = 974
+ Next_A = 975
+ Next_E = 976
+ Next_Event = 977
+ Next_Event_A = 978
+ Next_Event_E = 979
+ Prev = 980
+ Rose = 981
+ Strong = 982
+ W = 983
+ Whilenot = 984
+ Within = 985
+ X = 986
+ Last_PSL = 986
+ First_Edif = 987
+ Celltype = 997
+ View = 998
+ Viewtype = 999
+ Direction = 1000
+ Contents = 1001
+ Net = 1002
+ Viewref = 1003
+ Cellref = 1004
+ Libraryref = 1005
+ Portinstance = 1006
+ Joined = 1007
+ Portref = 1008
+ Instanceref = 1009
+ Design = 1010
+ Designator = 1011
+ Owner = 1012
+ Member = 1013
+ Number = 1014
+ Rename = 1015
+ Userdata = 1016
+ Last_Edif = 1016
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,