diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-04-18 06:05:30 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-04-19 20:48:24 +0200 |
commit | 1c4ce754b16f53442da151cb47d3b5a5ecdc5fe0 (patch) | |
tree | fa9a687793b418f6be7c8483c2576d12419fd45b /src | |
parent | 464259ae4be27dcf43f3273e2217cb226bebdc71 (diff) | |
download | ghdl-1c4ce754b16f53442da151cb47d3b5a5ecdc5fe0.tar.gz ghdl-1c4ce754b16f53442da151cb47d3b5a5ecdc5fe0.tar.bz2 ghdl-1c4ce754b16f53442da151cb47d3b5a5ecdc5fe0.zip |
textio: use grt.fcvt to read real numbers.
Diffstat (limited to 'src')
-rw-r--r-- | src/ghdldrv/ghdlrun.adb | 2 | ||||
-rw-r--r-- | src/grt/grt-lib.adb | 9 | ||||
-rw-r--r-- | src/grt/grt-lib.ads | 5 | ||||
-rw-r--r-- | src/std_names.adb | 1 | ||||
-rw-r--r-- | src/std_names.ads | 5 |
5 files changed, 20 insertions, 2 deletions
diff --git a/src/ghdldrv/ghdlrun.adb b/src/ghdldrv/ghdlrun.adb index c9183433f..6e2351343 100644 --- a/src/ghdldrv/ghdlrun.adb +++ b/src/ghdldrv/ghdlrun.adb @@ -187,6 +187,8 @@ package body Ghdlrun is begin if Name = "untruncated_text_read" then Def (Ortho, Grt.Files.Ghdl_Untruncated_Text_Read'Address); + elsif Name = "textio_read_real" then + Def (Ortho, Grt.Lib.Textio_Read_Real'Address); elsif Name = "control_simulation" then Def (Ortho, Grt.Lib.Ghdl_Control_Simulation'Address); elsif Name = "get_resolution_limit" then diff --git a/src/grt/grt-lib.adb b/src/grt/grt-lib.adb index 95a4a0948..3c16392be 100644 --- a/src/grt/grt-lib.adb +++ b/src/grt/grt-lib.adb @@ -24,6 +24,7 @@ -- covered by the GNU Public License. with Grt.Errors; use Grt.Errors; with Grt.Options; +with Grt.Fcvt; package body Grt.Lib is --procedure Memcpy (Dst : Address; Src : Address; Size : Size_T); @@ -271,6 +272,14 @@ package body Grt.Lib is end if; end Ghdl_Real_Exp; + function Textio_Read_Real (Str : Std_String_Ptr) return Ghdl_F64 + is + subtype Str1 is String (1 .. Natural (Str.Bounds.Dim_1.Length)); + begin + return Ghdl_F64 (Grt.Fcvt.From_String + (Str1 (Str.Base (0 .. Str.Bounds.Dim_1.Length)))); + end Textio_Read_Real; + function Ghdl_Get_Resolution_Limit return Std_Time is begin return 1; diff --git a/src/grt/grt-lib.ads b/src/grt/grt-lib.ads index 2ee918ba2..97ee669a8 100644 --- a/src/grt/grt-lib.ads +++ b/src/grt/grt-lib.ads @@ -92,6 +92,8 @@ package Grt.Lib is False -- - ); + function Textio_Read_Real (Str : Std_String_Ptr) return Ghdl_F64; + function Ghdl_Get_Resolution_Limit return Std_Time; procedure Ghdl_Control_Simulation @@ -120,6 +122,9 @@ private pragma Export (C, Ghdl_Std_Ulogic_To_Boolean_Array, "__ghdl_std_ulogic_to_boolean_array"); + pragma Export (C, Textio_Read_Real, + "std__textio__textio_read_real"); + pragma Export (C, Ghdl_Get_Resolution_Limit, "std__env__get_resolution_limit"); pragma Export (Ada, Ghdl_Control_Simulation, diff --git a/src/std_names.adb b/src/std_names.adb index 96bbc543e..60d96d4f4 100644 --- a/src/std_names.adb +++ b/src/std_names.adb @@ -398,6 +398,7 @@ package body Std_Names is Def ("minimum", Name_Minimum); Def ("maximum", Name_Maximum); Def ("untruncated_text_read", Name_Untruncated_Text_Read); + Def ("textio_read_real", Name_Textio_Read_Real); Def ("get_resolution_limit", Name_Get_Resolution_Limit); Def ("control_simulation", Name_Control_Simulation); diff --git a/src/std_names.ads b/src/std_names.ads index b54dcb693..0dc3143f3 100644 --- a/src/std_names.ads +++ b/src/std_names.ads @@ -472,8 +472,9 @@ package Std_Names is Name_Minimum : constant Name_Id := Name_First_Misc + 022; Name_Maximum : constant Name_Id := Name_First_Misc + 023; Name_Untruncated_Text_Read : constant Name_Id := Name_First_Misc + 024; - Name_Get_Resolution_Limit : constant Name_Id := Name_First_Misc + 025; - Name_Control_Simulation : constant Name_Id := Name_First_Misc + 026; + Name_Textio_Read_Real : constant Name_Id := Name_First_Misc + 025; + Name_Get_Resolution_Limit : constant Name_Id := Name_First_Misc + 026; + Name_Control_Simulation : constant Name_Id := Name_First_Misc + 027; Name_Last_Misc : constant Name_Id := Name_Control_Simulation; Name_First_Ieee : constant Name_Id := Name_Last_Misc + 1; |