diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-05-03 19:30:22 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-05-04 19:04:09 +0200 |
commit | ff7dc8f280ace0c0c2e307e62fda21f75359f096 (patch) | |
tree | fe0c50aed3767fbf858c2b3ddd0fa37f141f752e /src | |
parent | 7792975e486d010c8a6f85fe3ff9c01afc65d015 (diff) | |
download | ghdl-ff7dc8f280ace0c0c2e307e62fda21f75359f096.tar.gz ghdl-ff7dc8f280ace0c0c2e307e62fda21f75359f096.tar.bz2 ghdl-ff7dc8f280ace0c0c2e307e62fda21f75359f096.zip |
synth: move copy_memory to synth-objtypes; add unshare.
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/synth-objtypes.adb | 17 | ||||
-rw-r--r-- | src/synth/synth-objtypes.ads | 4 | ||||
-rw-r--r-- | src/synth/synth-values.adb | 8 | ||||
-rw-r--r-- | src/synth/synth-values.ads | 1 |
4 files changed, 21 insertions, 9 deletions
diff --git a/src/synth/synth-objtypes.adb b/src/synth/synth-objtypes.adb index 10602256b..f7517c927 100644 --- a/src/synth/synth-objtypes.adb +++ b/src/synth/synth-objtypes.adb @@ -777,6 +777,23 @@ package body Synth.Objtypes is return True; end Is_Equal; + procedure Copy_Memory (Dest : Memory_Ptr; Src : Memory_Ptr; Sz : Size_Type) + is + begin + for I in 1 .. Sz loop + Dest (I - 1) := Src (I - 1); + end loop; + end Copy_Memory; + + function Unshare (Src : Memtyp) return Memtyp + is + Res : Memory_Ptr; + begin + Res := Alloc_Memory (Src.Typ); + Copy_Memory (Res, Src.Mem, Src.Typ.Sz); + return (Src.Typ, Res); + end Unshare; + Bit0_Mem : constant Memory_Element := 0; Bit1_Mem : constant Memory_Element := 1; diff --git a/src/synth/synth-objtypes.ads b/src/synth/synth-objtypes.ads index 91ffcc32e..339197489 100644 --- a/src/synth/synth-objtypes.ads +++ b/src/synth/synth-objtypes.ads @@ -283,6 +283,10 @@ package Synth.Objtypes is function Is_Equal (L, R : Memtyp) return Boolean; + procedure Copy_Memory (Dest : Memory_Ptr; Src : Memory_Ptr; Sz : Size_Type); + + function Unshare (Src : Memtyp) return Memtyp; + procedure Init; -- Set by Init. diff --git a/src/synth/synth-values.adb b/src/synth/synth-values.adb index ed042c849..40a394b4a 100644 --- a/src/synth/synth-values.adb +++ b/src/synth/synth-values.adb @@ -254,14 +254,6 @@ package body Synth.Values is end if; end Strip_Const; - procedure Copy_Memory (Dest : Memory_Ptr; Src : Memory_Ptr; Sz : Size_Type) - is - begin - for I in 1 .. Sz loop - Dest (I - 1) := Src (I - 1); - end loop; - end Copy_Memory; - procedure Write_Value (Dest : Memory_Ptr; Vt : Valtyp) is Mt : Memtyp; diff --git a/src/synth/synth-values.ads b/src/synth/synth-values.ads index 77798c9f0..0cef26b2b 100644 --- a/src/synth/synth-values.ads +++ b/src/synth/synth-values.ads @@ -172,6 +172,5 @@ package Synth.Values is function Read_Fp64 (Vt : Valtyp) return Fp64; - procedure Copy_Memory (Dest : Memory_Ptr; Src : Memory_Ptr; Sz : Size_Type); procedure Write_Value (Dest : Memory_Ptr; Vt : Valtyp); end Synth.Values; |