aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/grt-avhpi.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-10-17 06:18:36 +0200
committerTristan Gingold <tgingold@free.fr>2018-10-21 08:03:37 +0200
commited7ad157dbecc784bb2df44684442e88431db561 (patch)
tree491533354ca2add405e08869f66c1c74622f97d7 /src/grt/grt-avhpi.adb
parent13000af67c96c2a3417fa321daa3fbf50165f54f (diff)
downloadghdl-ed7ad157dbecc784bb2df44684442e88431db561.tar.gz
ghdl-ed7ad157dbecc784bb2df44684442e88431db561.tar.bz2
ghdl-ed7ad157dbecc784bb2df44684442e88431db561.zip
Rework translation of unbounded and complex types.
Diffstat (limited to 'src/grt/grt-avhpi.adb')
-rw-r--r--src/grt/grt-avhpi.adb35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/grt/grt-avhpi.adb b/src/grt/grt-avhpi.adb
index 065d64ef1..1a6239f1a 100644
--- a/src/grt/grt-avhpi.adb
+++ b/src/grt/grt-avhpi.adb
@@ -151,10 +151,12 @@ package body Grt.Avhpi is
Bt : constant Ghdl_Rtin_Type_Array_Acc :=
To_Ghdl_Rtin_Type_Array_Acc (St.Basetype);
Rngs : Ghdl_Range_Array (0 .. Bt.Nbr_Dim - 1);
+ Layout : Address;
begin
+ Layout :=
+ Loc_To_Addr (St.Common.Depth, St.Layout, Res.Ctxt);
Bound_To_Range
- (Loc_To_Addr (St.Common.Depth, St.Bounds, Res.Ctxt),
- Bt, Rngs);
+ (Array_Layout_To_Bounds (Layout), Bt, Rngs);
Res.N_Idx := Ranges_To_Length (Rngs, Bt.Indexes);
end;
when others =>
@@ -176,7 +178,6 @@ package body Grt.Avhpi is
El_Type : Ghdl_Rti_Access;
Off : Ghdl_Index_Type) return Address
is
- pragma Unreferenced (Ctxt);
Is_Sig : Boolean;
El_Size : Ghdl_Index_Type;
El_Type1 : Ghdl_Rti_Access;
@@ -202,13 +203,20 @@ package body Grt.Avhpi is
El_Size := Ghdl_I64'Size / Storage_Unit;
end if;
when Ghdl_Rtik_Subtype_Array =>
- if Is_Sig then
- El_Size := Ghdl_Index_Type
- (To_Ghdl_Rtin_Subtype_Composite_Acc (El_Type1).Sigsize);
- else
- El_Size := Ghdl_Index_Type
- (To_Ghdl_Rtin_Subtype_Composite_Acc (El_Type1).Valsize);
- end if;
+ declare
+ Sizes : Ghdl_Indexes_Ptr;
+ begin
+ Sizes := To_Ghdl_Indexes_Ptr
+ (Loc_To_Addr
+ (El_Type1.Depth,
+ To_Ghdl_Rtin_Subtype_Composite_Acc (El_Type1).Layout,
+ Ctxt));
+ if Is_Sig then
+ El_Size := Sizes.Signal;
+ else
+ El_Size := Sizes.Value;
+ end if;
+ end;
when others =>
Internal_Error ("add_index");
end case;
@@ -1003,6 +1011,7 @@ package body Grt.Avhpi is
To_Ghdl_Rtin_Type_Array_Acc (Arr_Subtype.Basetype);
Idx : constant Ghdl_Index_Type :=
Ghdl_Index_Type (Index);
+ Layout : Address;
Bounds : Ghdl_Range_Array (0 .. Basetype.Nbr_Dim - 1);
Range_Basetype : Ghdl_Rti_Access;
begin
@@ -1012,10 +1021,10 @@ package body Grt.Avhpi is
return;
end if;
-- constraint type is basetype.indexes (idx - 1)
+ Layout := Loc_To_Addr (Arr_Subtype.Common.Depth,
+ Arr_Subtype.Layout, Ref.Ctxt);
Bound_To_Range
- (Loc_To_Addr (Arr_Subtype.Common.Depth,
- Arr_Subtype.Bounds, Ref.Ctxt),
- Basetype, Bounds);
+ (Array_Layout_To_Bounds (Layout), Basetype, Bounds);
Res := (Kind => VhpiIntRangeK,
Ctxt => Ref.Ctxt,
Rng_Type => Basetype.Indexes (Idx - 1),