From 24bc050b6b8025f4906735bf61c3d836fad2e48c Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 29 May 2022 08:43:24 +0200 Subject: elab-vhdl_objtypes: add unshare with areapool --- src/synth/elab-vhdl_objtypes.adb | 12 ++++++++++++ src/synth/elab-vhdl_objtypes.ads | 1 + 2 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/synth/elab-vhdl_objtypes.adb b/src/synth/elab-vhdl_objtypes.adb index d1d263948..0b876ffeb 100644 --- a/src/synth/elab-vhdl_objtypes.adb +++ b/src/synth/elab-vhdl_objtypes.adb @@ -796,6 +796,18 @@ package body Elab.Vhdl_Objtypes is end loop; end Copy_Memory; + function Unshare (Src : Memtyp; Pool : Areapool_Acc) return Memtyp + is + Prev_Pool : constant Areapool_Acc := Current_Pool; + Res : Memory_Ptr; + begin + Current_Pool := Pool; + Res := Alloc_Memory (Src.Typ); + Copy_Memory (Res, Src.Mem, Src.Typ.Sz); + Current_Pool := Prev_Pool; + return (Src.Typ, Res); + end Unshare; + function Unshare (Src : Memtyp) return Memtyp is Res : Memory_Ptr; diff --git a/src/synth/elab-vhdl_objtypes.ads b/src/synth/elab-vhdl_objtypes.ads index c8797e069..257065e5c 100644 --- a/src/synth/elab-vhdl_objtypes.ads +++ b/src/synth/elab-vhdl_objtypes.ads @@ -300,6 +300,7 @@ package Elab.Vhdl_Objtypes is procedure Copy_Memory (Dest : Memory_Ptr; Src : Memory_Ptr; Sz : Size_Type); function Unshare (Src : Memtyp) return Memtyp; + function Unshare (Src : Memtyp; Pool : Areapool_Acc) return Memtyp; procedure Initialize; procedure Finalize; -- cgit v1.2.3