aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-11-12 20:22:30 +0100
committerTristan Gingold <tgingold@free.fr>2019-11-12 20:36:04 +0100
commitc2b6fd2775bdfb183a4de81d64f745e282ffd9fb (patch)
tree8be0ab894d88eb7f771da67276a9337e7d07ece0 /src
parenta4a587d729314a8741b72284f624f167fa675062 (diff)
downloadghdl-c2b6fd2775bdfb183a4de81d64f745e282ffd9fb.tar.gz
ghdl-c2b6fd2775bdfb183a4de81d64f745e282ffd9fb.tar.bz2
ghdl-c2b6fd2775bdfb183a4de81d64f745e282ffd9fb.zip
synth-stmts: return sub arrays/records for
Diffstat (limited to 'src')
-rw-r--r--src/synth/synth-stmts.adb20
-rw-r--r--src/synth/synth-values.adb2
-rw-r--r--src/synth/synth-values.ads4
3 files changed, 16 insertions, 10 deletions
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb
index 6eb81a32d..eb2a67133 100644
--- a/src/synth/synth-stmts.adb
+++ b/src/synth/synth-stmts.adb
@@ -151,6 +151,7 @@ package body Synth.Stmts is
Dest_Type := Targ.Typ;
if Targ.Kind = Value_Alias then
+ -- Replace alias by the aliased name.
Dest_Obj := Targ.A_Obj;
Dest_Off := Targ.A_Off;
else
@@ -194,7 +195,7 @@ package body Synth.Stmts is
Dest_Off := Dest_Off + Off;
Strip_Const (Dest_Obj);
- if Dest_Obj.Kind = Value_Const_Array then
+ if Dest_Obj.Kind in Value_Array .. Value_Const_Array then
Dest_Obj := Dest_Obj.Arr.V
(Iir_Index32 ((Dest_W - Dest_Off) / W));
Dest_Off := 0;
@@ -275,7 +276,7 @@ package body Synth.Stmts is
end if;
Dest_Off := Sl_Off;
else
- if Dest_Obj.Kind = Value_Const_Array then
+ if Dest_Obj.Kind in Value_Array .. Value_Const_Array then
declare
Arr : Value_Array_Acc;
Off : Iir_Index32;
@@ -286,15 +287,20 @@ package body Synth.Stmts is
case Pfx_Bnd.Dir is
when Iir_To =>
Off := Iir_Index32
- (Pfx_Bnd.Right - Res_Bnd.Right);
+ (Res_Bnd.Left - Pfx_Bnd.Left);
when Iir_Downto =>
Off := Iir_Index32
- (Res_Bnd.Right - Pfx_Bnd.Right);
+ (Pfx_Bnd.Left - Res_Bnd.Left);
end case;
Arr.V := Dest_Obj.Arr.V
- (Off .. Off + Iir_Index32 (Res_Bnd.Len) - 1);
- Dest_Obj := Create_Value_Const_Array
- (Dest_Type, Arr);
+ (Off + 1 .. Off + Iir_Index32 (Res_Bnd.Len));
+ if Dest_Obj.Kind = Value_Array then
+ Dest_Obj := Create_Value_Array
+ (Dest_Type, Arr);
+ else
+ Dest_Obj := Create_Value_Const_Array
+ (Dest_Type, Arr);
+ end if;
end;
else
-- Slice of a vector.
diff --git a/src/synth/synth-values.adb b/src/synth/synth-values.adb
index a27056ee5..657cd457f 100644
--- a/src/synth/synth-values.adb
+++ b/src/synth/synth-values.adb
@@ -803,7 +803,7 @@ package body Synth.Values is
raise Internal_Error;
when Type_Array =>
declare
- El_Typ : constant Type_Acc := Typ.Vec_El;
+ El_Typ : constant Type_Acc := Get_Array_Element (Typ);
Arr : Value_Array_Acc;
begin
Arr := Create_Value_Array
diff --git a/src/synth/synth-values.ads b/src/synth/synth-values.ads
index bdf7aca84..4712eb2b7 100644
--- a/src/synth/synth-values.ads
+++ b/src/synth/synth-values.ads
@@ -214,8 +214,6 @@ package Synth.Values is
Scal : Int64;
when Value_Float =>
Fp : Fp64;
- when Value_Subtype =>
- null;
when Value_Array
| Value_Const_Array =>
Arr : Value_Array_Acc;
@@ -228,6 +226,8 @@ package Synth.Values is
File : File_Index;
when Value_Instance =>
Instance : Instance_Id;
+ when Value_Subtype =>
+ null;
when Value_Const =>
C_Val : Value_Acc;
C_Loc : Syn_Src;