diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-09-30 07:47:14 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-09-30 07:47:14 +0200 |
commit | a35c1cc1b249a16be478ce87747426315ee02817 (patch) | |
tree | bc0b3186cc79116bcb22338674e9aa00defe2363 /src/synth | |
parent | bd3f2d04cf0cb7d43bb7a823fcbdf2f5b7fdebcc (diff) | |
download | ghdl-a35c1cc1b249a16be478ce87747426315ee02817.tar.gz ghdl-a35c1cc1b249a16be478ce87747426315ee02817.tar.bz2 ghdl-a35c1cc1b249a16be478ce87747426315ee02817.zip |
synth: handle float-float conversions
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)"); |