From a35c1cc1b249a16be478ce87747426315ee02817 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 30 Sep 2022 07:47:14 +0200 Subject: synth: handle float-float conversions --- src/synth/synth-vhdl_expr.adb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb index 8677fe609..392bd1535 100644 --- a/src/synth/synth-vhdl_expr.adb +++ b/src/synth/synth-vhdl_expr.adb @@ -1426,9 +1426,20 @@ package body Synth.Vhdl_Expr is end if; when Type_Float => if Is_Static (Val.Val) then - Res := Create_Value_Float - (Fp64 (Read_Discrete (Val)), Conv_Typ); - return Res; + declare + R : Fp64; + begin + case Val.Typ.Kind is + when Type_Discrete => + R := Fp64 (Read_Discrete (Val)); + when Type_Float => + R := Read_Fp64 (Val); + when others => + raise Internal_Error; + end case; + Res := Create_Value_Float (R, Conv_Typ); + return Res; + end; else Error_Msg_Synth (Syn_Inst, Loc, "unhandled type conversion (to float)"); -- cgit v1.2.3