diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-12-31 09:54:31 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-12-31 09:54:31 +0100 |
commit | d1a36719e52331f80675ae4eba83c44dcb652782 (patch) | |
tree | 66ba5a6bb6be77c449b7457eb32e045a45ab5896 /src | |
parent | 3d049ce8053a64fe579793a70d9f5fc52df4f1e5 (diff) | |
download | ghdl-d1a36719e52331f80675ae4eba83c44dcb652782.tar.gz ghdl-d1a36719e52331f80675ae4eba83c44dcb652782.tar.bz2 ghdl-d1a36719e52331f80675ae4eba83c44dcb652782.zip |
ams-vhdl: add support for 'delayed for quantity.
Diffstat (limited to 'src')
-rw-r--r-- | src/vhdl/vhdl-elocations.adb | 1 | ||||
-rw-r--r-- | src/vhdl/vhdl-elocations.ads | 1 | ||||
-rw-r--r-- | src/vhdl/vhdl-errors.adb | 3 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.adb | 1 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes.ads | 4 | ||||
-rw-r--r-- | src/vhdl/vhdl-nodes_meta.adb | 70 | ||||
-rw-r--r-- | src/vhdl/vhdl-prints.adb | 2 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_expr.adb | 3 | ||||
-rw-r--r-- | src/vhdl/vhdl-sem_names.adb | 256 |
9 files changed, 197 insertions, 144 deletions
diff --git a/src/vhdl/vhdl-elocations.adb b/src/vhdl/vhdl-elocations.adb index f6e1ac80e..c4cab3475 100644 --- a/src/vhdl/vhdl-elocations.adb +++ b/src/vhdl/vhdl-elocations.adb @@ -418,6 +418,7 @@ package body Vhdl.Elocations is | Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute diff --git a/src/vhdl/vhdl-elocations.ads b/src/vhdl/vhdl-elocations.ads index daeda35ae..696186b1a 100644 --- a/src/vhdl/vhdl-elocations.ads +++ b/src/vhdl/vhdl-elocations.ads @@ -649,6 +649,7 @@ package Vhdl.Elocations is -- Iir_Kind_Ztf_Attribute (None) -- Iir_Kind_Dot_Attribute (None) -- Iir_Kind_Integ_Attribute (None) + -- Iir_Kind_Quantity_Delayed_Attribute (None) -- Iir_Kind_Ramp_Attribute (None) -- Iir_Kind_Above_Attribute (None) diff --git a/src/vhdl/vhdl-errors.adb b/src/vhdl/vhdl-errors.adb index 63e3bb02b..c05fa3265 100644 --- a/src/vhdl/vhdl-errors.adb +++ b/src/vhdl/vhdl-errors.adb @@ -708,7 +708,8 @@ package body Vhdl.Errors is return "'stable attribute"; when Iir_Kind_Quiet_Attribute => return "'quiet attribute"; - when Iir_Kind_Delayed_Attribute => + when Iir_Kind_Delayed_Attribute + | Iir_Kind_Quantity_Delayed_Attribute => return "'delayed attribute"; when Iir_Kind_Driving_Attribute => return "'driving attribute"; diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb index 50d7fe2cf..518270114 100644 --- a/src/vhdl/vhdl-nodes.adb +++ b/src/vhdl/vhdl-nodes.adb @@ -1194,6 +1194,7 @@ package body Vhdl.Nodes is | Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 217f6a562..4ed10957d 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -4453,6 +4453,7 @@ package Vhdl.Nodes is -- Iir_Kind_Above_Attribute (Short) -- Iir_Kind_Dot_Attribute (Short) -- Iir_Kind_Integ_Attribute (Short) + -- Iir_Kind_Quantity_Delayed_Attribute (Short) -- -- Get/Set_Prefix (Field0) -- @@ -4464,6 +4465,7 @@ package Vhdl.Nodes is -- Get/Set_Signal_Attribute_Declaration (Field3) -- -- Only for Iir_Kind_Above_Attribute: + -- Only for Iir_Kind_Quantity_Delayed_Attribute: -- Get/Set_Parameter (Field4) -- -- Get/Set_Base_Name (Field5) @@ -5006,6 +5008,7 @@ package Vhdl.Nodes is Iir_Kind_Dot_Attribute, Iir_Kind_Integ_Attribute, Iir_Kind_Above_Attribute, + Iir_Kind_Quantity_Delayed_Attribute, Iir_Kind_Delayed_Attribute, -- signal_attribute Iir_Kind_Stable_Attribute, -- signal_attribute Iir_Kind_Quiet_Attribute, -- signal_attribute @@ -6223,6 +6226,7 @@ package Vhdl.Nodes is --Iir_Kind_Dot_Attribute --Iir_Kind_Integ_Attribute --Iir_Kind_Above_Attribute + --Iir_Kind_Quantity_Delayed_Attribute --Iir_Kind_Delayed_Attribute --Iir_Kind_Stable_Attribute --Iir_Kind_Quiet_Attribute diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index 48029e8c9..c4e5e7d1a 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -1671,6 +1671,8 @@ package body Vhdl.Nodes_Meta is return "integ_attribute"; when Iir_Kind_Above_Attribute => return "above_attribute"; + when Iir_Kind_Quantity_Delayed_Attribute => + return "quantity_delayed_attribute"; when Iir_Kind_Delayed_Attribute => return "delayed_attribute"; when Iir_Kind_Stable_Attribute => @@ -4868,6 +4870,15 @@ package body Vhdl.Nodes_Meta is Field_Signal_Attribute_Declaration, Field_Parameter, Field_Base_Name, + -- Iir_Kind_Quantity_Delayed_Attribute + Field_Expr_Staticness, + Field_Name_Staticness, + Field_Prefix, + Field_Type, + Field_Attr_Chain, + Field_Signal_Attribute_Declaration, + Field_Parameter, + Field_Base_Name, -- Iir_Kind_Delayed_Attribute Field_Has_Active_Flag, Field_Expr_Staticness, @@ -5324,31 +5335,32 @@ package body Vhdl.Nodes_Meta is Iir_Kind_Dot_Attribute => 2123, Iir_Kind_Integ_Attribute => 2130, Iir_Kind_Above_Attribute => 2138, - Iir_Kind_Delayed_Attribute => 2147, - Iir_Kind_Stable_Attribute => 2156, - Iir_Kind_Quiet_Attribute => 2165, - Iir_Kind_Transaction_Attribute => 2174, - Iir_Kind_Event_Attribute => 2178, - Iir_Kind_Active_Attribute => 2182, - Iir_Kind_Last_Event_Attribute => 2186, - Iir_Kind_Last_Active_Attribute => 2190, - Iir_Kind_Last_Value_Attribute => 2194, - Iir_Kind_Driving_Attribute => 2198, - Iir_Kind_Driving_Value_Attribute => 2202, - Iir_Kind_Behavior_Attribute => 2202, - Iir_Kind_Structure_Attribute => 2202, - Iir_Kind_Simple_Name_Attribute => 2209, - Iir_Kind_Instance_Name_Attribute => 2214, - Iir_Kind_Path_Name_Attribute => 2219, - Iir_Kind_Left_Array_Attribute => 2226, - Iir_Kind_Right_Array_Attribute => 2233, - Iir_Kind_High_Array_Attribute => 2240, - Iir_Kind_Low_Array_Attribute => 2247, - Iir_Kind_Length_Array_Attribute => 2254, - Iir_Kind_Ascending_Array_Attribute => 2261, - Iir_Kind_Range_Array_Attribute => 2268, - Iir_Kind_Reverse_Range_Array_Attribute => 2275, - Iir_Kind_Attribute_Name => 2284 + Iir_Kind_Quantity_Delayed_Attribute => 2146, + Iir_Kind_Delayed_Attribute => 2155, + Iir_Kind_Stable_Attribute => 2164, + Iir_Kind_Quiet_Attribute => 2173, + Iir_Kind_Transaction_Attribute => 2182, + Iir_Kind_Event_Attribute => 2186, + Iir_Kind_Active_Attribute => 2190, + Iir_Kind_Last_Event_Attribute => 2194, + Iir_Kind_Last_Active_Attribute => 2198, + Iir_Kind_Last_Value_Attribute => 2202, + Iir_Kind_Driving_Attribute => 2206, + Iir_Kind_Driving_Value_Attribute => 2210, + Iir_Kind_Behavior_Attribute => 2210, + Iir_Kind_Structure_Attribute => 2210, + Iir_Kind_Simple_Name_Attribute => 2217, + Iir_Kind_Instance_Name_Attribute => 2222, + Iir_Kind_Path_Name_Attribute => 2227, + Iir_Kind_Left_Array_Attribute => 2234, + Iir_Kind_Right_Array_Attribute => 2241, + Iir_Kind_High_Array_Attribute => 2248, + Iir_Kind_Low_Array_Attribute => 2255, + Iir_Kind_Length_Array_Attribute => 2262, + Iir_Kind_Ascending_Array_Attribute => 2269, + Iir_Kind_Range_Array_Attribute => 2276, + Iir_Kind_Reverse_Range_Array_Attribute => 2283, + Iir_Kind_Attribute_Name => 2292 ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -8413,6 +8425,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute @@ -8623,6 +8636,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute @@ -10819,6 +10833,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute @@ -11061,6 +11076,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute @@ -11131,6 +11147,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute @@ -11256,6 +11273,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Ltf_Attribute | Iir_Kind_Ztf_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute @@ -11311,6 +11329,7 @@ package body Vhdl.Nodes_Meta is | Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute @@ -11327,6 +11346,7 @@ package body Vhdl.Nodes_Meta is when Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute | Iir_Kind_Above_Attribute + | Iir_Kind_Quantity_Delayed_Attribute | Iir_Kind_Delayed_Attribute | Iir_Kind_Stable_Attribute | Iir_Kind_Quiet_Attribute diff --git a/src/vhdl/vhdl-prints.adb b/src/vhdl/vhdl-prints.adb index 5b466857b..bd52fc10f 100644 --- a/src/vhdl/vhdl-prints.adb +++ b/src/vhdl/vhdl-prints.adb @@ -4646,6 +4646,8 @@ package body Vhdl.Prints is when Iir_Kind_Signal_Slew_Attribute | Iir_Kind_Quantity_Slew_Attribute => Disp_Parametered_Attribute (Ctxt, Name_Slew, Expr, 2); + when Iir_Kind_Quantity_Delayed_Attribute => + Disp_Parametered_Attribute (Ctxt, Name_Delayed, Expr, 1); when Iir_Kind_Ramp_Attribute => Disp_Parametered_Attribute (Ctxt, Name_Ramp, Expr, 2); when Iir_Kind_Above_Attribute => diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb index fc7e59a7c..a4deece67 100644 --- a/src/vhdl/vhdl-sem_expr.adb +++ b/src/vhdl/vhdl-sem_expr.adb @@ -4376,7 +4376,8 @@ package body Vhdl.Sem_Expr is | Iir_Kind_Ztf_Attribute | Iir_Kind_Dot_Attribute | Iir_Kind_Integ_Attribute - | Iir_Kind_Ramp_Attribute => + | Iir_Kind_Ramp_Attribute + | Iir_Kind_Quantity_Delayed_Attribute => return; when Iir_Kind_Aggregate => Check_Read_Aggregate (Obj); diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb index 2830e6e77..f632b614e 100644 --- a/src/vhdl/vhdl-sem_names.adb +++ b/src/vhdl/vhdl-sem_names.adb @@ -1242,7 +1242,7 @@ package body Vhdl.Sem_Names is end Finish_Sem_Signal_Attribute; procedure Sem_Quantity_Attribute_Parameters - (Attr : Iir; Params : Iir_Array; Params_Type : Iir_Array; Min : Positive) + (Attr : Iir; Params : Iir_Array; Params_Type : Iir_Array; Min : Natural) is Param : Iir; begin @@ -1285,6 +1285,15 @@ package body Vhdl.Sem_Names is Free_Iir (Attr_Name); case Get_Kind (Attr) is + when Iir_Kind_Quantity_Delayed_Attribute => + -- AMS-LRM17 16.2.6 + -- Q'DELAYED[(T)] + -- Parameter: + -- T: A static expression of type REAL that evaluates to a + -- non-negative number. If omitted, defaults to 0.0. + Sem_Quantity_Attribute_Parameters + (Attr, Params, (1 => Real_Type_Definition, + 2 .. 4 => Null_Iir), 0); when Iir_Kind_Above_Attribute => pragma Assert (Params'First = 1 and Params'Last = 1); if Params (1) = Null_Iir then @@ -1917,7 +1926,8 @@ package body Vhdl.Sem_Names is | Iir_Kind_Signal_Slew_Attribute | Iir_Kind_Zoh_Attribute | Iir_Kind_Ltf_Attribute - | Iir_Kind_Ztf_Attribute => + | Iir_Kind_Ztf_Attribute + | Iir_Kind_Quantity_Delayed_Attribute => if Get_Parameter (Res) = Null_Iir then -- Not finished. Need to emit an error message. Finish_Sem_Quantity_Attribute (Name, Res, (1 => Null_Iir)); @@ -3007,7 +3017,8 @@ package body Vhdl.Sem_Names is | Iir_Kind_Signal_Slew_Attribute | Iir_Kind_Zoh_Attribute | Iir_Kind_Ltf_Attribute - | Iir_Kind_Ztf_Attribute => + | Iir_Kind_Ztf_Attribute + | Iir_Kind_Quantity_Delayed_Attribute => declare Params : Iir_Array (1 .. 4); begin @@ -3691,6 +3702,120 @@ package body Vhdl.Sem_Names is return Res; end Sem_Nature_Reference_Attribute; + function Sem_Quantity_Attribute (Attr : Iir_Attribute_Name) return Iir + is + use Std_Names; + Name_Prefix : constant Iir := Get_Prefix (Attr); + Prefix: Iir; + Res : Iir; + Res_Type : Iir; + begin + Prefix := Get_Named_Entity (Name_Prefix); + Prefix := Finish_Sem_Name_1 (Name_Prefix, Prefix); + if not Is_Quantity_Name (Prefix) then + Error_Msg_Sem + (+Attr, "prefix of %i attribute must denote a quantity", +Attr); + end if; + + Res_Type := Get_Type (Prefix); + case Get_Identifier (Attr) is + when Name_Above => + Res := Create_Iir (Iir_Kind_Above_Attribute); + Res_Type := Boolean_Type_Definition; + when Name_Dot => + Res := Create_Iir (Iir_Kind_Dot_Attribute); + when Name_Integ => + Res := Create_Iir (Iir_Kind_Integ_Attribute); + when Name_Zoh => + Res := Create_Iir (Iir_Kind_Zoh_Attribute); + when Name_Ltf => + Res := Create_Iir (Iir_Kind_Ltf_Attribute); + when Name_Ztf => + Res := Create_Iir (Iir_Kind_Ztf_Attribute); + when Name_Delayed => + Res := Create_Iir (Iir_Kind_Quantity_Delayed_Attribute); + when others => + -- Not yet implemented attribute, or really an internal error. + raise Internal_Error; + end case; + + Location_Copy (Res, Attr); + Set_Prefix (Res, Prefix); + Set_Type (Res, Res_Type); + + -- AMS-LRM17 16.2.6 Predefined analog an mixed-signal attributes + -- Prefix: Any quantity denoted by the static name Q. + if Get_Name_Staticness (Prefix) < Globally then + Error_Msg_Sem + (+Res, "prefix of %i attribute must be a static name", +Res); + end if; + + -- According to LRM 7.4, signal attributes are not static expressions + -- since the prefix (a signal) is not a static expression. + Set_Expr_Staticness (Res, None); + + -- AMS-LRM17 8.1 Names + -- A name is said to be a static name if and only if one of the + -- following conditions holds: + -- [...] + -- - The name is an attribute whose prefix is a static quantity name + -- and whose suffix is one of the predefined attributes 'ABOVE, 'DOT, + -- 'INTEG, 'DELAYED, 'SLEW, 'LTF, 'ZOH, or 'ZTF. + Set_Name_Staticness (Res, Globally); + + return Res; + end Sem_Quantity_Attribute; + + function Sem_Slew_Attribute (Attr : Iir_Attribute_Name) return Iir + is + Prefix_Name : constant Iir := Get_Prefix (Attr); + Prefix: Iir; + Res : Iir; + Res_Type : Iir; + begin + Prefix := Get_Named_Entity (Prefix_Name); + if Is_Quantity_Name (Prefix) then + Res := Create_Iir (Iir_Kind_Quantity_Slew_Attribute); + elsif Is_Signal_Name (Prefix) then + Res := Create_Iir (Iir_Kind_Signal_Slew_Attribute); + else + Error_Msg_Sem + (+Attr, + "prefix of 'slew must denote a quantity or a signal", +Attr); + return Error_Mark; + end if; + + -- AMS-VHDL17 16.2.6 + -- Prefix: Any signal denoted by the static name S whose scalar + -- subelements are of a floating-point type. + -- + -- GHDL: not necessary when the prefix is a quantity. + Res_Type := Get_Type (Prefix); + if not Sem_Types.Is_Nature_Type (Res_Type) then + Error_Msg_Sem (+Attr, "prefix of 'slew must be of nature type"); + end if; + + if Get_Name_Staticness (Prefix) < Globally then + Error_Msg_Sem (+Attr, "prefix of 'slew must be a static name"); + end if; + + Set_Type (Res, Res_Type); + Location_Copy (Res, Attr); + Set_Prefix (Res, Prefix); + Set_Expr_Staticness (Res, None); + + -- AMS-LRM17 8.1 Names + -- A name is said to be a static name if and only if one of the + -- following conditions holds: + -- [...] + -- - The name is an attribute whose prefix is a static quantity name + -- and whose suffix is one of the predefined attributes 'ABOVE, 'DOT, + -- 'INTEG, 'DELAYED, 'SLEW, 'LTF, 'ZOH, or 'ZTF. + Set_Name_Staticness (Res, Globally); + + return Res; + end Sem_Slew_Attribute; + function Sem_Signal_Signal_Attribute (Attr : Iir_Attribute_Name; Kind : Iir_Kind) return Iir @@ -3736,12 +3861,20 @@ package body Vhdl.Sem_Names is function Sem_Signal_Attribute (Attr : Iir_Attribute_Name) return Iir is use Std_Names; + Id : constant Name_Id := Get_Identifier (Attr); Prefix: Iir; Res : Iir; Base : Iir; begin Prefix := Get_Named_Entity (Get_Prefix (Attr)); Base := Get_Object_Prefix (Prefix); + if AMS_Vhdl + and then Id = Name_Delayed + and then Is_Quantity_Name (Base) + then + return Sem_Quantity_Attribute (Attr); + end if; + case Get_Kind (Base) is when Iir_Kind_Signal_Declaration | Iir_Kind_Interface_Signal_Declaration @@ -3753,7 +3886,7 @@ package body Vhdl.Sem_Names is (+Attr, "prefix of %i attribute must denote a signal", +Attr); return Error_Mark; end case; - case Get_Identifier (Attr) is + case Id is when Name_Stable => Res := Sem_Signal_Signal_Attribute (Attr, Iir_Kind_Stable_Attribute); @@ -4024,118 +4157,6 @@ package body Vhdl.Sem_Names is return Res; end Sem_Name_Attribute; - function Sem_Quantity_Attribute (Attr : Iir_Attribute_Name) return Iir - is - use Std_Names; - Name_Prefix : constant Iir := Get_Prefix (Attr); - Prefix: Iir; - Res : Iir; - Res_Type : Iir; - begin - Prefix := Get_Named_Entity (Name_Prefix); - Prefix := Finish_Sem_Name_1 (Name_Prefix, Prefix); - if not Is_Quantity_Name (Prefix) then - Error_Msg_Sem - (+Attr, "prefix of %i attribute must denote a quantity", +Attr); - end if; - - Res_Type := Get_Type (Prefix); - case Get_Identifier (Attr) is - when Name_Above => - Res := Create_Iir (Iir_Kind_Above_Attribute); - Res_Type := Boolean_Type_Definition; - when Name_Dot => - Res := Create_Iir (Iir_Kind_Dot_Attribute); - when Name_Integ => - Res := Create_Iir (Iir_Kind_Integ_Attribute); - when Name_Zoh => - Res := Create_Iir (Iir_Kind_Zoh_Attribute); - when Name_Ltf => - Res := Create_Iir (Iir_Kind_Ltf_Attribute); - when Name_Ztf => - Res := Create_Iir (Iir_Kind_Ztf_Attribute); - when others => - -- Not yet implemented attribute, or really an internal error. - raise Internal_Error; - end case; - - Location_Copy (Res, Attr); - Set_Prefix (Res, Prefix); - Set_Type (Res, Res_Type); - - -- AMS-LRM17 16.2.6 Predefined analog an mixed-signal attributes - -- Prefix: Any quantity denoted by the static name Q. - if Get_Name_Staticness (Prefix) < Globally then - Error_Msg_Sem - (+Res, "prefix of %i attribute must be a static name", +Res); - end if; - - -- According to LRM 7.4, signal attributes are not static expressions - -- since the prefix (a signal) is not a static expression. - Set_Expr_Staticness (Res, None); - - -- AMS-LRM17 8.1 Names - -- A name is said to be a static name if and only if one of the - -- following conditions holds: - -- [...] - -- - The name is an attribute whose prefix is a static quantity name - -- and whose suffix is one of the predefined attributes 'ABOVE, 'DOT, - -- 'INTEG, 'DELAYED, 'SLEW, 'LTF, 'ZOH, or 'ZTF. - Set_Name_Staticness (Res, Globally); - - return Res; - end Sem_Quantity_Attribute; - - function Sem_Slew_Attribute (Attr : Iir_Attribute_Name) return Iir - is - Prefix_Name : constant Iir := Get_Prefix (Attr); - Prefix: Iir; - Res : Iir; - Res_Type : Iir; - begin - Prefix := Get_Named_Entity (Prefix_Name); - if Is_Quantity_Name (Prefix) then - Res := Create_Iir (Iir_Kind_Quantity_Slew_Attribute); - elsif Is_Signal_Name (Prefix) then - Res := Create_Iir (Iir_Kind_Signal_Slew_Attribute); - else - Error_Msg_Sem - (+Attr, - "prefix of 'slew must denote a quantity or a signal", +Attr); - return Error_Mark; - end if; - - -- AMS-VHDL17 16.2.6 - -- Prefix: Any signal denoted by the static name S whose scalar - -- subelements are of a floating-point type. - -- - -- GHDL: not necessary when the prefix is a quantity. - Res_Type := Get_Type (Prefix); - if not Sem_Types.Is_Nature_Type (Res_Type) then - Error_Msg_Sem (+Attr, "prefix of 'slew must be of nature type"); - end if; - - if Get_Name_Staticness (Prefix) < Globally then - Error_Msg_Sem (+Attr, "prefix of 'slew must be a static name"); - end if; - - Set_Type (Res, Res_Type); - Location_Copy (Res, Attr); - Set_Prefix (Res, Prefix); - Set_Expr_Staticness (Res, None); - - -- AMS-LRM17 8.1 Names - -- A name is said to be a static name if and only if one of the - -- following conditions holds: - -- [...] - -- - The name is an attribute whose prefix is a static quantity name - -- and whose suffix is one of the predefined attributes 'ABOVE, 'DOT, - -- 'INTEG, 'DELAYED, 'SLEW, 'LTF, 'ZOH, or 'ZTF. - Set_Name_Staticness (Res, Globally); - - return Res; - end Sem_Slew_Attribute; - procedure Sem_Attribute_Name (Attr : Iir_Attribute_Name) is use Std_Names; @@ -4682,7 +4703,8 @@ package body Vhdl.Sem_Names is | Iir_Kind_Ltf_Attribute | Iir_Kind_Ztf_Attribute | Iir_Kind_Signal_Slew_Attribute - | Iir_Kind_Quantity_Slew_Attribute => + | Iir_Kind_Quantity_Slew_Attribute + | Iir_Kind_Quantity_Delayed_Attribute => -- Never static return Res; when Iir_Kinds_Type_Attribute |