aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/vhdl-ieee-numeric.adb30
-rw-r--r--src/vhdl/vhdl-nodes.ads6
2 files changed, 36 insertions, 0 deletions
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,