aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-ieee-numeric.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-07-23 18:36:50 +0200
committerTristan Gingold <tgingold@free.fr>2019-07-24 05:23:31 +0200
commit8653cfdef98b6ccd591b2cdf903c4a8149a18e93 (patch)
tree980761da8bab228485a55bd3d2d0d3a96703f928 /src/vhdl/vhdl-ieee-numeric.adb
parente0281345a5437282f287568b6fafa8519512b9dd (diff)
downloadghdl-8653cfdef98b6ccd591b2cdf903c4a8149a18e93.tar.gz
ghdl-8653cfdef98b6ccd591b2cdf903c4a8149a18e93.tar.bz2
ghdl-8653cfdef98b6ccd591b2cdf903c4a8149a18e93.zip
vhdl: recognize resize function.
Diffstat (limited to 'src/vhdl/vhdl-ieee-numeric.adb')
-rw-r--r--src/vhdl/vhdl-ieee-numeric.adb33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-ieee-numeric.adb b/src/vhdl/vhdl-ieee-numeric.adb
index 9f57e7787..ad13f9274 100644
--- a/src/vhdl/vhdl-ieee-numeric.adb
+++ b/src/vhdl/vhdl-ieee-numeric.adb
@@ -319,6 +319,37 @@ package body Vhdl.Ieee.Numeric is
raise Error;
end if;
end Handle_To_Integer;
+
+ procedure Handle_Resize is
+ begin
+ if Arg2_Kind = Arg_Scal and Arg2_Sign = Type_Unsigned then
+ if Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Unsigned then
+ Set_Implicit_Definition
+ (Decl, Iir_Predefined_Ieee_Numeric_Std_Resize_Uns_Nat);
+ elsif Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Signed then
+ Set_Implicit_Definition
+ (Decl, Iir_Predefined_Ieee_Numeric_Std_Resize_Sgn_Nat);
+ else
+ raise Error;
+ end if;
+ elsif Arg2_Kind = Arg_Vect then
+ if Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Unsigned
+ and Arg2_Sign = Type_Unsigned
+ then
+ Set_Implicit_Definition
+ (Decl, Iir_Predefined_Ieee_Numeric_Std_Resize_Uns_Uns);
+ elsif Arg1_Kind = Arg_Vect and Arg1_Sign = Type_Signed
+ and Arg2_Sign = Type_Signed
+ then
+ Set_Implicit_Definition
+ (Decl, Iir_Predefined_Ieee_Numeric_Std_Resize_Sgn_Sgn);
+ else
+ raise Error;
+ end if;
+ else
+ raise Error;
+ end if;
+ end Handle_Resize;
begin
Decl := Get_Declaration_Chain (Pkg_Decl);
@@ -413,6 +444,8 @@ package body Vhdl.Ieee.Numeric is
Handle_To_Unsigned;
when Name_To_Signed =>
Handle_To_Signed;
+ when Name_Resize =>
+ Handle_Resize;
when others =>
null;
end case;