summaryrefslogtreecommitdiff
path: root/src/vhdl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/translate/trans-chap7.adb266
-rw-r--r--src/vhdl/translate/trans-chap7.ads1
2 files changed, 1 insertions, 266 deletions
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb
index f4dc679..b3dfced 100644
--- a/src/vhdl/translate/trans-chap7.adb
+++ b/src/vhdl/translate/trans-chap7.adb
@@ -4828,264 +4828,6 @@ package body Trans.Chap7 is
Finish_Subprogram_Body;
end Translate_Predefined_Record_Equality;
- procedure Translate_Predefined_Array_Array_Concat (Subprg : Iir)
- is
- F_Info : Subprg_Info_Acc;
- Arr_Type : constant Iir := Get_Return_Type (Subprg);
-
- -- Info for the array type.
- Info : constant Type_Info_Acc := Get_Info (Arr_Type);
- Arr_Ptr_Type : constant O_Tnode := Info.Ortho_Ptr_Type (Mode_Value);
-
- -- Info for the index type.
- Iinfo : Type_Info_Acc;
- Index_Type : Iir;
-
- Id : constant Name_Id := Get_Identifier (Get_Type_Declarator (Arr_Type));
-
- Index_Otype : O_Tnode;
- Interface_List : O_Inter_List;
- Var_Res, Var_L, Var_R : O_Dnode;
- Res, L, R : Mnode;
- Var_Length, Var_L_Len, Var_R_Len : O_Dnode;
- Var_Bounds, Var_Right : O_Dnode;
- V_Bounds : Mnode;
- If_Blk : O_If_Block;
- begin
- F_Info := Add_Info (Subprg, Kind_Subprg);
- F_Info.Use_Stack2 := True;
-
- -- Create function.
- Start_Procedure_Decl
- (Interface_List, Create_Identifier (Id, "_CONCAT"), Global_Storage);
- -- Note: contrary to user function which returns composite value
- -- via a result record, a concatenation returns its value without
- -- the use of the record.
- Subprgs.Create_Subprg_Instance (Interface_List, Subprg);
- New_Interface_Decl (Interface_List, Var_Res, Wki_Res, Arr_Ptr_Type);
- New_Interface_Decl (Interface_List, Var_L, Wki_Left, Arr_Ptr_Type);
- New_Interface_Decl (Interface_List, Var_R, Wki_Right, Arr_Ptr_Type);
- Finish_Subprogram_Decl (Interface_List, F_Info.Ortho_Func);
-
- if Global_Storage = O_Storage_External then
- return;
- end if;
-
- Index_Type := Get_Index_Type (Arr_Type, 0);
- Iinfo := Get_Info (Index_Type);
- Index_Otype := Iinfo.Ortho_Type (Mode_Value);
-
- Start_Subprogram_Body (F_Info.Ortho_Func);
- Subprgs.Start_Subprg_Instance_Use (Subprg);
- New_Var_Decl (Var_Length, Wki_Length, O_Storage_Local,
- Ghdl_Index_Type);
- New_Var_Decl (Var_L_Len, Wki_L_Len, O_Storage_Local, Ghdl_Index_Type);
- New_Var_Decl (Var_R_Len, Wki_R_Len, O_Storage_Local, Ghdl_Index_Type);
- New_Var_Decl (Var_Bounds, Get_Identifier ("bounds"), O_Storage_Local,
- Info.T.Bounds_Ptr_Type);
-
- L := Dp2M (Var_L, Info, Mode_Value);
- R := Dp2M (Var_R, Info, Mode_Value);
- Res := Dp2M (Var_Res, Info, Mode_Value);
- V_Bounds := Dp2M (Var_Bounds, Info, Mode_Value,
- Info.T.Bounds_Type, Info.T.Bounds_Ptr_Type);
-
- -- Compute length.
- New_Assign_Stmt
- (New_Obj (Var_L_Len), Chap3.Get_Array_Length (L, Arr_Type));
- New_Assign_Stmt
- (New_Obj (Var_R_Len), Chap3.Get_Array_Length (R, Arr_Type));
- New_Assign_Stmt
- (New_Obj (Var_Length), New_Dyadic_Op (ON_Add_Ov,
- New_Obj_Value (Var_L_Len),
- New_Obj_Value (Var_R_Len)));
-
- -- Check case where the result is the right operand.
- declare
- Len : O_Enode;
- begin
- if Flags.Vhdl_Std = Vhdl_87 then
- -- LRM87 7.2.4
- -- [...], unless the left operand is a null array, in which
- -- case the result of the concatenation is the right operand.
- Len := New_Obj_Value (Var_L_Len);
-
- else
- -- LRM93 7.2.4
- -- If both operands are null arrays, then the result of the
- -- concatenation is the right operand.
- -- GHDL: since the length type is unsigned, then both operands
- -- are null arrays iff the result is a null array.
- Len := New_Obj_Value (Var_Length);
- end if;
-
- Start_If_Stmt
- (If_Blk, New_Compare_Op (ON_Eq, Len, New_Lit (Ghdl_Index_0),
- Ghdl_Bool_Type));
- Copy_Fat_Pointer (Res, R);
- New_Return_Stmt;
- Finish_If_Stmt (If_Blk);
- end;
-
- -- Allocate bounds.
- New_Assign_Stmt
- (New_Obj (Var_Bounds),
- Gen_Alloc (Alloc_Return,
- New_Lit (New_Sizeof (Info.T.Bounds_Type,
- Ghdl_Index_Type)),
- Info.T.Bounds_Ptr_Type));
- New_Assign_Stmt
- (M2Lp (Chap3.Get_Array_Bounds (Res)), New_Obj_Value (Var_Bounds));
-
- -- Set bound.
- if Flags.Vhdl_Std = Vhdl_87 then
- -- Set length.
- New_Assign_Stmt
- (M2Lv (Chap3.Range_To_Length
- (Chap3.Bounds_To_Range (V_Bounds, Arr_Type, 1))),
- New_Obj_Value (Var_Length));
-
- -- Set direction, left bound and right bound.
- -- LRM87 7.2.4
- -- The left bound of this result is the left bound of the left
- -- operand, unless the left operand is a null array, in which
- -- case the result of the concatenation is the right operand.
- -- The direction of the result is the direction of the left
- -- operand, unless the left operand is a null array, in which
- -- case the direction of the result is that of the right operand.
- declare
- Var_Dir, Var_Left : O_Dnode;
- Var_Length1 : O_Dnode;
- begin
- Start_Declare_Stmt;
- New_Var_Decl (Var_Right, Get_Identifier ("right_bound"),
- O_Storage_Local, Index_Otype);
- New_Var_Decl (Var_Dir, Wki_Dir, O_Storage_Local,
- Ghdl_Dir_Type_Node);
- New_Var_Decl (Var_Left, Get_Identifier ("left_bound"),
- O_Storage_Local, Iinfo.Ortho_Type (Mode_Value));
- New_Var_Decl (Var_Length1, Get_Identifier ("length_1"),
- O_Storage_Local, Ghdl_Index_Type);
-
- -- Copy direction from left.
- New_Assign_Stmt
- (New_Obj (Var_Dir),
- M2E (Chap3.Range_To_Dir
- (Chap3.Get_Array_Range (L, Arr_Type, 1))));
- New_Assign_Stmt
- (M2Lv (Chap3.Range_To_Dir
- (Chap3.Bounds_To_Range (V_Bounds, Arr_Type, 1))),
- New_Obj_Value (Var_Dir));
-
- -- Get left bound of left parameter and copy it to result.
- New_Assign_Stmt
- (New_Obj (Var_Left),
- M2E (Chap3.Range_To_Left
- (Chap3.Get_Array_Range (L, Arr_Type, 1))));
- New_Assign_Stmt
- (M2Lv (Chap3.Range_To_Left
- (Chap3.Bounds_To_Range (V_Bounds, Arr_Type, 1))),
- New_Obj_Value (Var_Left));
-
- -- Note this substraction cannot overflow, since LENGTH >= 1.
- New_Assign_Stmt
- (New_Obj (Var_Length1),
- New_Dyadic_Op (ON_Sub_Ov,
- New_Obj_Value (Var_Length),
- New_Lit (Ghdl_Index_1)));
-
- -- Compute right bound of result:
- -- if dir = dir_to then
- -- right := left + length_1;
- -- else
- -- right := left - length_1;
- -- end if;
- Start_If_Stmt
- (If_Blk,
- New_Compare_Op (ON_Eq, New_Obj_Value (Var_Dir),
- New_Lit (Ghdl_Dir_To_Node), Ghdl_Bool_Type));
- New_Assign_Stmt
- (New_Obj (Var_Right),
- New_Dyadic_Op (ON_Add_Ov,
- New_Obj_Value (Var_Left),
- New_Convert_Ov (New_Obj_Value (Var_Length1),
- Index_Otype)));
- New_Else_Stmt (If_Blk);
- New_Assign_Stmt
- (New_Obj (Var_Right),
- New_Dyadic_Op (ON_Sub_Ov,
- New_Obj_Value (Var_Left),
- New_Convert_Ov (New_Obj_Value (Var_Length1),
- Index_Otype)));
- Finish_If_Stmt (If_Blk);
-
- -- Check the right bounds is inside the bounds of the
- -- index type.
- Chap3.Check_Range (Var_Right, Null_Iir, Index_Type, Subprg);
- New_Assign_Stmt
- (M2Lv (Chap3.Range_To_Right
- (Chap3.Bounds_To_Range (V_Bounds, Arr_Type, 1))),
- New_Obj_Value (Var_Right));
- Finish_Declare_Stmt;
- end;
- else
- -- LRM93 7.2.4
- -- [...], the direction and bounds of the result are determined
- -- as follows: Let S be the index subtype of the base type of the
- -- result. The direction of the result of the concatenation is
- -- the direction of S, and the left bound of the result is
- -- S'LEFT.
- Chap3.Create_Range_From_Length
- (Index_Type, Var_Length,
- Chap3.Bounds_To_Range (V_Bounds, Arr_Type, 1), Subprg);
- end if;
-
- -- Allocate array base.
- Chap3.Allocate_Fat_Array_Base (Alloc_Return, Res, Arr_Type);
-
- -- Copy left.
- declare
- V_Arr : O_Dnode;
- Var_Arr : Mnode;
- begin
- Open_Temp;
- V_Arr := Create_Temp (Info.Ortho_Type (Mode_Value));
- Var_Arr := Dv2M (V_Arr, Info, Mode_Value);
- New_Assign_Stmt
- (M2Lp (Chap3.Get_Array_Bounds (Var_Arr)),
- M2Addr (Chap3.Get_Array_Bounds (L)));
- New_Assign_Stmt
- (M2Lp (Chap3.Get_Array_Base (Var_Arr)),
- M2Addr (Chap3.Get_Array_Base (Res)));
- Chap3.Translate_Object_Copy
- (Var_Arr, New_Obj_Value (Var_L), Arr_Type);
- Close_Temp;
- end;
-
- -- Copy right.
- declare
- V_Arr : O_Dnode;
- Var_Arr : Mnode;
- begin
- Open_Temp;
- V_Arr := Create_Temp (Info.Ortho_Type (Mode_Value));
- Var_Arr := Dv2M (V_Arr, Info, Mode_Value);
- New_Assign_Stmt
- (M2Lp (Chap3.Get_Array_Bounds (Var_Arr)),
- M2Addr (Chap3.Get_Array_Bounds (R)));
- New_Assign_Stmt
- (M2Lp (Chap3.Get_Array_Base (Var_Arr)),
- M2Addr (Chap3.Slice_Base (Chap3.Get_Array_Base (Res),
- Arr_Type,
- New_Obj_Value (Var_L_Len))));
- Chap3.Translate_Object_Copy
- (Var_Arr, New_Obj_Value (Var_R), Arr_Type);
- Close_Temp;
- end;
- Subprgs.Finish_Subprg_Instance_Use (Subprg);
- Finish_Subprogram_Body;
- end Translate_Predefined_Array_Array_Concat;
-
procedure Translate_Predefined_Array_Logical (Subprg : Iir)
is
Arr_Type : constant Iir_Array_Type_Definition :=
@@ -5826,7 +5568,6 @@ package body Trans.Chap7 is
-- may be used for several implicit operators (eg. array comparaison)
Infos.Arr_Eq_Info := null;
Infos.Arr_Cmp_Info := null;
- Infos.Arr_Concat_Info := null;
Infos.Rec_Eq_Info := null;
Infos.Arr_Shl_Info := null;
Infos.Arr_Sha_Info := null;
@@ -6001,12 +5742,7 @@ package body Trans.Chap7 is
| Iir_Predefined_Array_Element_Concat
| Iir_Predefined_Element_Array_Concat
| Iir_Predefined_Element_Element_Concat =>
- if Infos.Arr_Concat_Info = null then
- Translate_Predefined_Array_Array_Concat (Subprg);
- Infos.Arr_Concat_Info := Get_Info (Subprg);
- else
- Set_Info (Subprg, Infos.Arr_Concat_Info);
- end if;
+ null;
when Iir_Predefined_Vector_Minimum
| Iir_Predefined_Vector_Maximum =>
diff --git a/src/vhdl/translate/trans-chap7.ads b/src/vhdl/translate/trans-chap7.ads
index 5e038da..5b3ff22 100644
--- a/src/vhdl/translate/trans-chap7.ads
+++ b/src/vhdl/translate/trans-chap7.ads
@@ -149,7 +149,6 @@ private
Arr_Eq_Info : Subprg_Info_Acc;
Rec_Eq_Info : Subprg_Info_Acc;
Arr_Cmp_Info : Subprg_Info_Acc;
- Arr_Concat_Info : Subprg_Info_Acc;
Arr_Shl_Info : Subprg_Info_Acc;
Arr_Sha_Info : Subprg_Info_Acc;
Arr_Rot_Info : Subprg_Info_Acc;