diff options
-rw-r--r-- | src/vhdl/translate/trans-chap3.adb | 12 | ||||
-rw-r--r-- | src/vhdl/translate/trans.ads | 12 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index 56f600776..14e4955fa 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -732,6 +732,8 @@ package body Trans.Chap3 is is Indexes_List : constant Iir_Flist := Get_Index_Subtype_Definition_List (Def); + El_Type : constant Iir := Get_Element_Subtype (Def); + El_Info : constant Type_Info_Acc := Get_Info (El_Type); Constr : O_Element_List; Dim : String (1 .. 8); N : Natural; @@ -766,6 +768,15 @@ package body Trans.Chap3 is Get_Identifier (Dim (P .. Dim'Last)), Get_Info (Get_Base_Type (Index)).B.Range_Type); end loop; + + if Is_Unbounded_Type (El_Info) then + -- Bounds and size for element. + New_Record_Field (Constr, Info.B.El_Bounds, + Get_Identifier ("el_bound"), El_Info.B.Bounds_Type); + New_Record_Field (Constr, Info.B.El_Size, Get_Identifier ("el_size"), + Ghdl_Sizes_Type); + end if; + Finish_Record_Type (Constr, Info.B.Bounds_Type); Finish_Unbounded_Type_Bounds (Info); end Translate_Array_Type_Bounds; @@ -2293,6 +2304,7 @@ package body Trans.Chap3 is Translate_Array_Element_Definition (Def); if Get_Index_Constraint_Flag (Def) then if Base_Info = null or else Base_Info.Type_Incomplete then + -- This subtype also declare the base type. Create it. declare Mark : Id_Mark_Type; begin diff --git a/src/vhdl/translate/trans.ads b/src/vhdl/translate/trans.ads index 565ee2a87..342af4847 100644 --- a/src/vhdl/translate/trans.ads +++ b/src/vhdl/translate/trans.ads @@ -759,6 +759,11 @@ package Trans is Bounds_Type : O_Tnode; Bounds_Ptr_Type : O_Tnode; + -- Only for unbounded arrays: element size and bounds in + -- the bounds record + El_Size : O_Fnode; + El_Bounds : O_Fnode; + -- The ortho type is a fat pointer to the base and the bounds. -- These are the fields of the fat pointer. Base_Field : O_Fnode_Array; @@ -839,6 +844,8 @@ package Trans is Base_Ptr_Type => (O_Tnode_Null, O_Tnode_Null), Bounds_Type => O_Tnode_Null, Bounds_Ptr_Type => O_Tnode_Null, + El_Size => O_Fnode_Null, + El_Bounds => O_Fnode_Null, Base_Field => (O_Fnode_Null, O_Fnode_Null), Bounds_Field => (O_Fnode_Null, O_Fnode_Null)); @@ -855,6 +862,8 @@ package Trans is Base_Ptr_Type => (O_Tnode_Null, O_Tnode_Null), Bounds_Type => O_Tnode_Null, Bounds_Ptr_Type => O_Tnode_Null, + El_Size => O_Fnode_Null, + El_Bounds => O_Fnode_Null, Base_Field => (O_Fnode_Null, O_Fnode_Null), Bounds_Field => (O_Fnode_Null, O_Fnode_Null)); @@ -1218,7 +1227,8 @@ package Trans is Incomplete_Type : Iir; when Kind_Index => - -- Field declaration for array dimension. + -- For index_subtype_declaration, the field containing + -- the bounds of that index, in the array bounds record. Index_Field : O_Fnode; when Kind_Field => |