aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/elab-vhdl_objtypes.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-05-27 09:54:02 +0200
committerTristan Gingold <tgingold@free.fr>2022-05-27 09:54:02 +0200
commit09c757c3bcd7538582fa80a96b093c5a74e7ddaa (patch)
treeddf601f6799ed964c6a1441cc0162e594fea46b1 /src/synth/elab-vhdl_objtypes.adb
parente8c9722ebc2b610d6bd6f70fc88e04ea6ec4041c (diff)
downloadghdl-09c757c3bcd7538582fa80a96b093c5a74e7ddaa.tar.gz
ghdl-09c757c3bcd7538582fa80a96b093c5a74e7ddaa.tar.bz2
ghdl-09c757c3bcd7538582fa80a96b093c5a74e7ddaa.zip
elab-vhdl_objtypes: add Create_Memory_U32 (for states)
Diffstat (limited to 'src/synth/elab-vhdl_objtypes.adb')
-rw-r--r--src/synth/elab-vhdl_objtypes.adb19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/synth/elab-vhdl_objtypes.adb b/src/synth/elab-vhdl_objtypes.adb
index 782f4dfa6..d1d263948 100644
--- a/src/synth/elab-vhdl_objtypes.adb
+++ b/src/synth/elab-vhdl_objtypes.adb
@@ -688,17 +688,21 @@ package body Elab.Vhdl_Objtypes is
end case;
end Write_Discrete;
- function Alloc_Memory (Vtype : Type_Acc) return Memory_Ptr
+ function Alloc_Memory (Sz : Size_Type; Align2 : Natural) return Memory_Ptr
is
function To_Memory_Ptr is new Ada.Unchecked_Conversion
(System.Address, Memory_Ptr);
M : System.Address;
begin
- Areapools.Allocate (Current_Pool.all, M,
- Vtype.Sz, Size_Type (2 ** Natural (Vtype.Al)));
+ Areapools.Allocate (Current_Pool.all, M, Sz, Size_Type (2 ** Align2));
return To_Memory_Ptr (M);
end Alloc_Memory;
+ function Alloc_Memory (Vtype : Type_Acc) return Memory_Ptr is
+ begin
+ return Alloc_Memory (Vtype.Sz, Natural (Vtype.Al));
+ end Alloc_Memory;
+
function Create_Memory (Vtype : Type_Acc) return Memtyp is
begin
return (Vtype, Alloc_Memory (Vtype));
@@ -756,6 +760,15 @@ package body Elab.Vhdl_Objtypes is
return (Vtype, Res);
end Create_Memory_Discrete;
+ function Create_Memory_U32 (Val : Uns32) return Memtyp
+ is
+ Res : Memory_Ptr;
+ begin
+ Res := Alloc_Memory (4, 2);
+ Write_U32 (Res, Ghdl_U32 (Val));
+ return (null, Res);
+ end Create_Memory_U32;
+
function Is_Equal (L, R : Memtyp) return Boolean is
begin
if L = R then