aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-oper.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-01-10 19:19:38 +0100
committerTristan Gingold <tgingold@free.fr>2020-01-10 19:19:38 +0100
commite17215ff6b3ca865aa09111a15c551e5f0cf1fac (patch)
tree63d3cdac91540f36737f8757343c2e0d25fe10fa /src/synth/synth-oper.adb
parentadaacc8794fbbdb62ba90abe1ba6a53021c84c48 (diff)
downloadghdl-e17215ff6b3ca865aa09111a15c551e5f0cf1fac.tar.gz
ghdl-e17215ff6b3ca865aa09111a15c551e5f0cf1fac.tar.bz2
ghdl-e17215ff6b3ca865aa09111a15c551e5f0cf1fac.zip
synth: handle ieee.math_real.round Fix #1075
Diffstat (limited to 'src/synth/synth-oper.adb')
-rw-r--r--src/synth/synth-oper.adb14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/synth/synth-oper.adb b/src/synth/synth-oper.adb
index fcd11201e..471d82979 100644
--- a/src/synth/synth-oper.adb
+++ b/src/synth/synth-oper.adb
@@ -1186,6 +1186,20 @@ package body Synth.Oper is
return Create_Value_Float
(Ceil (V.Fp), Get_Value_Type (Syn_Inst, Get_Type (Imp)));
end;
+ when Iir_Predefined_Ieee_Math_Real_Round =>
+ declare
+ V : constant Value_Acc := Get_Value (Subprg_Inst, Param1);
+
+ function Round (Arg : Fp64) return Fp64;
+ pragma Import (C, Round);
+ begin
+ if V.Typ.Kind /= Type_Float then
+ Error_Msg_Synth(+Expr, "argument must be a float value");
+ return null;
+ end if;
+ return Create_Value_Float
+ (Round (V.Fp), Get_Value_Type (Syn_Inst, Get_Type (Imp)));
+ end;
when Iir_Predefined_Ieee_Math_Real_Sin =>
declare
V : constant Value_Acc := Get_Value (Subprg_Inst, Param1);