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/synth/synth-objtypes.adb | |
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/synth/synth-objtypes.adb')
-rw-r--r-- | src/synth/synth-objtypes.adb | 17 |
1 files changed, 17 insertions, 0 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; |