aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-09-30 20:45:57 +0200
committerTristan Gingold <tgingold@free.fr>2022-09-30 20:45:57 +0200
commitd4dc28659c657f14aecd2e6b04d747f36e540bb2 (patch)
treef8ba3ee13c4ded76ad7bfcd9dba06cd47b76896b /src/synth
parenta35c1cc1b249a16be478ce87747426315ee02817 (diff)
downloadghdl-d4dc28659c657f14aecd2e6b04d747f36e540bb2.tar.gz
ghdl-d4dc28659c657f14aecd2e6b04d747f36e540bb2.tar.bz2
ghdl-d4dc28659c657f14aecd2e6b04d747f36e540bb2.zip
synth: handle read for floats
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/synth-vhdl_eval.adb12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/synth/synth-vhdl_eval.adb b/src/synth/synth-vhdl_eval.adb
index f64be7158..46387c906 100644
--- a/src/synth/synth-vhdl_eval.adb
+++ b/src/synth/synth-vhdl_eval.adb
@@ -25,6 +25,7 @@ with Grt.Types; use Grt.Types;
with Grt.Vhdl_Types; use Grt.Vhdl_Types;
with Grt.To_Strings;
with Grt.Arith;
+with Grt.Fcvt;
with Vhdl.Utils;
with Vhdl.Evaluation;
@@ -2988,6 +2989,17 @@ package body Synth.Vhdl_Eval is
begin
return Create_Memory_Fp64 (Atan (Read_Fp64 (Param1)), Res_Typ);
end;
+
+ when Iir_Predefined_Foreign_Textio_Read_Real =>
+ declare
+ Len : constant Natural := Natural (Param1.Typ.Abound.Len);
+ Res : Fp64;
+ Cs : Ghdl_C_String;
+ begin
+ Cs := To_Ghdl_C_String (To_Address (Param1.Val.Mem));
+ Res := Fp64 (Grt.Fcvt.From_String (Cs (1 .. Len)));
+ return Create_Memory_Fp64 (Res, Res_Typ);
+ end;
when others =>
null;
end case;