diff options
Diffstat (limited to 'src/synth')
-rw-r--r-- | src/synth/synth-vhdl_expr.adb | 17 |
1 files 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)"); |