diff options
-rw-r--r-- | src/synth/elab-vhdl_types.adb | 8 | ||||
-rw-r--r-- | src/synth/elab-vhdl_types.ads | 4 | ||||
-rw-r--r-- | src/synth/synth-vhdl_expr.adb | 14 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/synth/elab-vhdl_types.adb b/src/synth/elab-vhdl_types.adb index 992f9c9fa..b8c1c0665 100644 --- a/src/synth/elab-vhdl_types.adb +++ b/src/synth/elab-vhdl_types.adb @@ -95,6 +95,14 @@ package body Elab.Vhdl_Types is return Get_Array_Bound (Typ); end Synth_Array_Attribute; + function Synth_Type_Attribute (Syn_Inst : Synth_Instance_Acc; Attr : Node) + return Type_Acc is + begin + return Get_Subtype_Object + (Syn_Inst, + Get_Subtype_Indication (Get_Named_Entity (Get_Prefix (Attr)))); + end Synth_Type_Attribute; + procedure Synth_Discrete_Range (Syn_Inst : Synth_Instance_Acc; Bound : Node; Rng : out Discrete_Range_Type) is diff --git a/src/synth/elab-vhdl_types.ads b/src/synth/elab-vhdl_types.ads index afab9e494..5f8bbab0e 100644 --- a/src/synth/elab-vhdl_types.ads +++ b/src/synth/elab-vhdl_types.ads @@ -37,6 +37,10 @@ package Elab.Vhdl_Types is function Synth_Array_Attribute (Syn_Inst : Synth_Instance_Acc; Attr : Node) return Bound_Type; + -- Return the type for 'left/'right/... attributes. + function Synth_Type_Attribute (Syn_Inst : Synth_Instance_Acc; Attr : Node) + return Type_Acc; + procedure Synth_Discrete_Range (Syn_Inst : Synth_Instance_Acc; Bound : Node; Rng : out Discrete_Range_Type); diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb index 62f41d3b5..6f33ff209 100644 --- a/src/synth/synth-vhdl_expr.adb +++ b/src/synth/synth-vhdl_expr.adb @@ -2078,6 +2078,20 @@ package body Synth.Vhdl_Expr is when Iir_Kind_Parenthesis_Expression => return Synth_Expression_With_Type (Syn_Inst, Get_Expression (Expr), Expr_Type); + when Iir_Kind_Left_Type_Attribute => + declare + T : Type_Acc; + begin + T := Synth_Type_Attribute (Syn_Inst, Expr); + return Create_Value_Discrete (T.Drange.Left, Expr_Type); + end; + when Iir_Kind_Right_Type_Attribute => + declare + T : Type_Acc; + begin + T := Synth_Type_Attribute (Syn_Inst, Expr); + return Create_Value_Discrete (T.Drange.Right, Expr_Type); + end; when Iir_Kind_Left_Array_Attribute => declare B : Bound_Type; |