diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-27 18:53:27 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-27 20:30:08 +0100 |
commit | 06e94bd1ac1331b82a371cc0e91097aa7d9d8bbe (patch) | |
tree | fcdc3c4fee261eac26a97eceac8711c5b90b65a9 | |
parent | 33a923a2be7c78d4e95e31c69c7c125acb2619bc (diff) | |
download | ghdl-06e94bd1ac1331b82a371cc0e91097aa7d9d8bbe.tar.gz ghdl-06e94bd1ac1331b82a371cc0e91097aa7d9d8bbe.tar.bz2 ghdl-06e94bd1ac1331b82a371cc0e91097aa7d9d8bbe.zip |
elab-memtype: add Read_Ptr, Write_Ptr
-rw-r--r-- | src/synth/elab-memtype.adb | 17 | ||||
-rw-r--r-- | src/synth/elab-memtype.ads | 5 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/synth/elab-memtype.adb b/src/synth/elab-memtype.adb index 8a9babd3d..91e38a900 100644 --- a/src/synth/elab-memtype.adb +++ b/src/synth/elab-memtype.adb @@ -122,4 +122,21 @@ package body Elab.Memtype is return V; end Read_Fp64; + procedure Write_Ptr (Mem : Memory_Ptr; Val : Memory_Ptr) + is + V : Memory_Ptr; + for V'Address use To_Address (Mem); + pragma Import (Ada, V); + begin + V := Val; + end Write_Ptr; + + function Read_Ptr (Mem : Memory_Ptr) return Memory_Ptr + is + V : Memory_Ptr; + for V'Address use To_Address (Mem); + pragma Import (Ada, V); + begin + return V; + end Read_Ptr; end Elab.Memtype; diff --git a/src/synth/elab-memtype.ads b/src/synth/elab-memtype.ads index ee562779a..2b4cb14e7 100644 --- a/src/synth/elab-memtype.ads +++ b/src/synth/elab-memtype.ads @@ -37,6 +37,8 @@ package Elab.Memtype is function To_Memory_Ptr is new Ada.Unchecked_Conversion (System.Address, Memory_Ptr); + Ptr_Size : constant Size_Type := Standard'Address_Size / 8; + -- Low-level functions. function "+" (Base : Memory_Ptr; Off : Size_Type) return Memory_Ptr; @@ -57,4 +59,7 @@ package Elab.Memtype is procedure Write_Fp64 (Mem : Memory_Ptr; Val : Fp64); function Read_Fp64 (Mem : Memory_Ptr) return Fp64; + + procedure Write_Ptr (Mem : Memory_Ptr; Val : Memory_Ptr); + function Read_Ptr (Mem : Memory_Ptr) return Memory_Ptr; end Elab.Memtype; |