aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-values.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-06-23 11:39:36 +0200
committerTristan Gingold <tgingold@free.fr>2019-06-23 11:39:36 +0200
commit59e3f7f5f3bea335eaaa95cb855de32ad38b1a59 (patch)
treebddeb5eaf448290d54997bcbca2f5f8e161c7de8 /src/synth/synth-values.adb
parent766ca83af482b46a292ef50e4b96ccd34f2a58df (diff)
downloadghdl-59e3f7f5f3bea335eaaa95cb855de32ad38b1a59.tar.gz
ghdl-59e3f7f5f3bea335eaaa95cb855de32ad38b1a59.tar.bz2
ghdl-59e3f7f5f3bea335eaaa95cb855de32ad38b1a59.zip
synth: handle more predefined functions.
Diffstat (limited to 'src/synth/synth-values.adb')
-rw-r--r--src/synth/synth-values.adb27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/synth/synth-values.adb b/src/synth/synth-values.adb
index 902bc0b9b..c603bdf1c 100644
--- a/src/synth/synth-values.adb
+++ b/src/synth/synth-values.adb
@@ -92,10 +92,10 @@ package body Synth.Values is
(Kind => Value_Float, Fp => Val)));
end Create_Value_Float;
- function Create_Value_Array (Ndim : Iir_Index32) return Value_Array_Acc
+ function Create_Value_Array (Len : Iir_Index32) return Value_Array_Acc
is
use System;
- subtype Data_Type is Values.Value_Array_Type (Ndim);
+ subtype Data_Type is Values.Value_Array_Type (Len);
Res : Address;
begin
-- Manually allocate the array to handle large arrays without
@@ -119,6 +119,21 @@ package body Synth.Values is
return To_Value_Array_Acc (Res);
end Create_Value_Array;
+ function Create_Value_Array (Bounds : Value_Bound_Array_Acc;
+ Arr : Value_Array_Acc)
+ return Value_Acc
+ is
+ subtype Value_Type_Array is Value_Type (Value_Array);
+ function Alloc is new Areapools.Alloc_On_Pool_Addr (Value_Type_Array);
+
+ Res : Value_Acc;
+ begin
+ Res := To_Value_Acc (Alloc (Current_Pool,
+ (Kind => Value_Array,
+ Arr => Arr, Bounds => Bounds)));
+ return Res;
+ end Create_Value_Array;
+
procedure Create_Array_Data (Arr : Value_Acc)
is
Len : Width;
@@ -131,17 +146,13 @@ package body Synth.Values is
Arr.Arr := Create_Value_Array (Iir_Index32 (Len));
end Create_Array_Data;
+
function Create_Value_Array (Bounds : Value_Bound_Array_Acc)
return Value_Acc
is
- subtype Value_Type_Array is Value_Type (Value_Array);
- function Alloc is new Areapools.Alloc_On_Pool_Addr (Value_Type_Array);
-
Res : Value_Acc;
begin
- Res := To_Value_Acc (Alloc (Current_Pool,
- (Kind => Value_Array,
- Arr => null, Bounds => Bounds)));
+ Res := Create_Value_Array (Bounds, null);
Create_Array_Data (Res);
return Res;
end Create_Value_Array;