aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-ieee-numeric.adb
diff options
context:
space:
mode:
authorChristos Gentsos <christos.gentsos@cern.ch>2019-06-05 15:16:03 +0200
committerTristan Gingold <tgingold@free.fr>2019-06-06 19:05:37 +0200
commit235316900770c52304ce572974a1a717d736a09d (patch)
tree02deb1adcccdf9048cda311a80f2293366848648 /src/vhdl/vhdl-ieee-numeric.adb
parent2c72cffb32c5bfc081c4a182654f2c46bb288db6 (diff)
downloadghdl-235316900770c52304ce572974a1a717d736a09d.tar.gz
ghdl-235316900770c52304ce572974a1a717d736a09d.tar.bz2
ghdl-235316900770c52304ce572974a1a717d736a09d.zip
synth: added support for numeric_std unary negation
Diffstat (limited to 'src/vhdl/vhdl-ieee-numeric.adb')
-rw-r--r--src/vhdl/vhdl-ieee-numeric.adb24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-ieee-numeric.adb b/src/vhdl/vhdl-ieee-numeric.adb
index 0c76ff533..773a41770 100644
--- a/src/vhdl/vhdl-ieee-numeric.adb
+++ b/src/vhdl/vhdl-ieee-numeric.adb
@@ -34,6 +34,9 @@ package body Vhdl.Ieee.Numeric is
type Binary_Pattern_Type is array (Pkg_Kind, Sign_Num_Kind, Args_Kind)
of Iir_Predefined_Functions;
+ type Unary_Pattern_Type is array (Pkg_Kind, Sign_Num_Kind)
+ of Iir_Predefined_Functions;
+
Add_Patterns : constant Binary_Pattern_Type :=
(Pkg_Std =>
(Type_Unsigned =>
@@ -88,6 +91,13 @@ package body Vhdl.Ieee.Numeric is
(others =>
(others => Iir_Predefined_None)));
+ Neg_Patterns : constant Unary_Pattern_Type :=
+ (Pkg_Std =>
+ (Type_Unsigned => Iir_Predefined_Ieee_Numeric_Std_Neg_Uns,
+ Type_Signed => Iir_Predefined_Ieee_Numeric_Std_Neg_Sgn),
+ Pkg_Bit =>
+ (others => Iir_Predefined_None));
+
Error : exception;
procedure Extract_Declarations (Pkg_Decl : Iir_Package_Declaration;
@@ -168,6 +178,11 @@ package body Vhdl.Ieee.Numeric is
Set_Implicit_Definition (Decl, Pats (Pkg, Sign, Kind));
end Handle_Binary;
+ procedure Handle_Unary (Pats : Unary_Pattern_Type) is
+ begin
+ Set_Implicit_Definition (Decl, Pats (Pkg, Arg1_Sign));
+ end Handle_Unary;
+
begin
Decl := Get_Declaration_Chain (Pkg_Decl);
@@ -234,6 +249,7 @@ package body Vhdl.Ieee.Numeric is
Classify_Arg (Arg1, Arg1_Sign, Arg1_Kind);
Arg2 := Get_Chain (Arg1);
if Is_Valid (Arg2) then
+ -- Dyadic function.
Classify_Arg (Arg2, Arg2_Sign, Arg2_Kind);
case Get_Identifier (Decl) is
@@ -250,6 +266,14 @@ package body Vhdl.Ieee.Numeric is
when others =>
null;
end case;
+ else
+ -- Monadic function.
+ case Get_Identifier (Decl) is
+ when Name_Op_Minus =>
+ Handle_Unary (Neg_Patterns);
+ when others =>
+ null;
+ end case;
end if;
when Iir_Kind_Non_Object_Alias_Declaration