diff options
Diffstat (limited to 'simulate')
-rw-r--r-- | simulate/annotations.adb | 35 | ||||
-rw-r--r-- | simulate/debugger.adb | 2 | ||||
-rw-r--r-- | simulate/elaboration.adb | 85 | ||||
-rw-r--r-- | simulate/execution.adb | 14 |
4 files changed, 75 insertions, 61 deletions
diff --git a/simulate/annotations.adb b/simulate/annotations.adb index 4508d83..a0b9ae8 100644 --- a/simulate/annotations.adb +++ b/simulate/annotations.adb @@ -284,7 +284,6 @@ package body Annotations is procedure Annotate_Type_Definition (Block_Info: Sim_Info_Acc; Def: Iir) is El: Iir; - List: Iir_List; begin -- Happen only with universal types. if Def = Null_Iir then @@ -293,7 +292,6 @@ package body Annotations is case Get_Kind (Def) is when Iir_Kind_Enumeration_Type_Definition => - List := Get_Enumeration_Literal_List (Def); if Def = Std_Package.Boolean_Type_Definition or else Def = Std_Package.Bit_Type_Definition then @@ -353,20 +351,27 @@ package body Annotations is Annotate_Anonymous_Type_Definition (Block_Info, El); when Iir_Kind_Array_Subtype_Definition => - List := Get_Index_Subtype_List (Def); - for I in Natural loop - El := Get_Nth_Element (List, I); - exit when El = Null_Iir; - Annotate_Anonymous_Type_Definition (Block_Info, El); - end loop; + declare + List : constant Iir_List := Get_Index_Subtype_List (Def); + begin + for I in Natural loop + El := Get_Index_Type (List, I); + exit when El = Null_Iir; + Annotate_Anonymous_Type_Definition (Block_Info, El); + end loop; + end; when Iir_Kind_Record_Type_Definition => - List := Get_Elements_Declaration_List (Def); - for I in Natural loop - El := Get_Nth_Element (List, I); - exit when El = Null_Iir; - Annotate_Anonymous_Type_Definition (Block_Info, Get_Type (El)); - end loop; + declare + List : constant Iir_List := Get_Elements_Declaration_List (Def); + begin + for I in Natural loop + El := Get_Nth_Element (List, I); + exit when El = Null_Iir; + Annotate_Anonymous_Type_Definition + (Block_Info, Get_Type (El)); + end loop; + end; when Iir_Kind_Record_Subtype_Definition => null; @@ -765,7 +770,7 @@ package body Annotations is when Iir_Kind_For_Loop_Statement => Annotate_Declaration - (Block_Info, Get_Iterator_Scheme (El)); + (Block_Info, Get_Parameter_Specification (El)); Annotate_Sequential_Statement_Chain (Block_Info, Get_Sequential_Statement_Chain (El)); diff --git a/simulate/debugger.adb b/simulate/debugger.adb index 072fba6..1677efa 100644 --- a/simulate/debugger.adb +++ b/simulate/debugger.adb @@ -1298,7 +1298,7 @@ package body Debugger is Add_Declarations (Get_Declaration_Chain (N), False); when Iir_Kind_For_Loop_Statement => Open_Declarative_Region; - Add_Name (Get_Iterator_Scheme (N)); + Add_Name (Get_Parameter_Specification (N)); when Iir_Kind_Block_Statement => Open_Declarative_Region; Add_Declarations (Get_Declaration_Chain (N), False); diff --git a/simulate/elaboration.adb b/simulate/elaboration.adb index 4808b45..c0e5d90 100644 --- a/simulate/elaboration.adb +++ b/simulate/elaboration.adb @@ -734,17 +734,16 @@ package body Elaboration is | Iir_Kind_Record_Type_Definition => Elaborate_Type_Definition (Instance, Ind); when Iir_Kind_Array_Subtype_Definition => - -- LRM93 §12.3.1.3 + -- LRM93 12.3.1.3 -- The elaboration of an index constraint consists of the -- declaration of each of the discrete ranges in the index -- constraint in some order that is not defined by the language. declare - St_Indexes : Iir_List; + St_Indexes : constant Iir_List := Get_Index_Subtype_List (Ind); St_El : Iir; begin - St_Indexes := Get_Index_Subtype_List (Ind); for I in Natural loop - St_El := Get_Nth_Element (St_Indexes, I); + St_El := Get_Index_Type (St_Indexes, I); exit when St_El = Null_Iir; Elaborate_Subtype_Indication_If_Anonymous (Instance, St_El); end loop; @@ -1396,35 +1395,38 @@ package body Elaboration is (Instance : Block_Instance_Acc; Stmt : Iir_Component_Instantiation_Statement) is - Component : constant Iir := Get_Instantiated_Unit (Stmt); Frame : Block_Instance_Acc; begin - if Get_Kind (Component) = Iir_Kind_Component_Declaration then - - -- Elaboration of a component instantiation statement that - -- instanciates a component declaration has no effect unless the - -- component instance is either fully bound to a design entity - -- defined by an entity declaration and architecture body or is - -- bound to a configuration of such a design entity. - -- FIXME: in fact the component is created. - - -- If a component instance is so bound, then elaboration of the - -- corresponding component instantiation statement consists of the - -- elaboration of the implied block statement representing the - -- component instance and [...] - Frame := Create_Block_Instance (Instance, Component, Stmt); - - Elaborate_Generic_Clause (Frame, Get_Generic_Chain (Component)); - Elaborate_Generic_Map_Aspect - (Frame, Instance, Get_Generic_Map_Aspect_Chain (Stmt)); - Elaborate_Port_Clause (Frame, Get_Port_Chain (Component)); - Elaborate_Port_Map_Aspect - (Frame, Instance, - Get_Port_Chain (Component), Get_Port_Map_Aspect_Chain (Stmt)); + if Is_Component_Instantiation (Stmt) then + declare + Component : constant Iir := + Get_Named_Entity (Get_Instantiated_Unit (Stmt)); + begin + -- Elaboration of a component instantiation statement that + -- instanciates a component declaration has no effect unless the + -- component instance is either fully bound to a design entity + -- defined by an entity declaration and architecture body or is + -- bound to a configuration of such a design entity. + -- FIXME: in fact the component is created. + + -- If a component instance is so bound, then elaboration of the + -- corresponding component instantiation statement consists of the + -- elaboration of the implied block statement representing the + -- component instance and [...] + Frame := Create_Block_Instance (Instance, Component, Stmt); + + Elaborate_Generic_Clause (Frame, Get_Generic_Chain (Component)); + Elaborate_Generic_Map_Aspect + (Frame, Instance, Get_Generic_Map_Aspect_Chain (Stmt)); + Elaborate_Port_Clause (Frame, Get_Port_Chain (Component)); + Elaborate_Port_Map_Aspect + (Frame, Instance, + Get_Port_Chain (Component), Get_Port_Map_Aspect_Chain (Stmt)); + end; else -- Direct instantiation declare - Aspect : constant Iir := Component; + Aspect : constant Iir := Get_Instantiated_Unit (Stmt); Arch : Iir; Config : Iir; begin @@ -1676,7 +1678,7 @@ package body Elaboration is Conf : Iir_Component_Configuration) is Component : constant Iir_Component_Declaration := - Get_Instantiated_Unit (Stmt); + Get_Named_Entity (Get_Instantiated_Unit (Stmt)); Entity : Iir_Entity_Declaration; Arch_Name : Name_Id; Arch_Design : Iir_Design_Unit; @@ -1907,9 +1909,7 @@ package body Elaboration is Item : Iir; begin - if Conf = Null_Iir then - raise Internal_Error; - end if; + pragma Assert (Conf /= Null_Iir); -- Associate configuration items with subinstance. Gather items for -- for-generate statements. @@ -1964,7 +1964,7 @@ package body Elaboration is for I in Natural loop El := Get_Nth_Element (List, I); exit when El = Null_Iir; - Info := Get_Info (El); + Info := Get_Info (Get_Named_Entity (El)); if Sub_Conf (Info.Inst_Slot) /= Null_Iir then raise Internal_Error; end if; @@ -2031,10 +2031,16 @@ package body Elaboration is Elaborate_Block_Configuration (Sub_Conf (Slot), Sub_Instances (Slot)); when Iir_Kind_Component_Instantiation_Statement => - Info := Get_Info (Stmt); - Slot := Info.Inst_Slot; - Elaborate_Component_Configuration - (Stmt, Sub_Instances (Slot), Sub_Conf (Slot)); + if Is_Component_Instantiation (Stmt) then + Info := Get_Info (Stmt); + Slot := Info.Inst_Slot; + Elaborate_Component_Configuration + (Stmt, Sub_Instances (Slot), Sub_Conf (Slot)); + else + -- Nothing to do for entity instantiation, will be + -- done during elaboration of statements. + null; + end if; when others => null; end case; @@ -2287,12 +2293,13 @@ package body Elaboration is -- GHDL: done by sem. declare + Attr_Decl : constant Iir := + Get_Named_Entity (Get_Attribute_Designator (Decl)); + Attr_Type : constant Iir := Get_Type (Attr_Decl); Value : Iir_Attribute_Value; Val : Iir_Value_Literal_Acc; - Attr_Type : Iir; begin Value := Get_Attribute_Value_Spec_Chain (Decl); - Attr_Type := Get_Type (Get_Attribute_Designator (Decl)); while Value /= Null_Iir loop -- 2. The expression is evaluated to determine the value -- of the attribute. diff --git a/simulate/execution.adb b/simulate/execution.adb index d82f32f..af34e96 100644 --- a/simulate/execution.adb +++ b/simulate/execution.adb @@ -2968,6 +2968,9 @@ package body Execution is Error_Msg_Constraint (Expr); return null; + when Iir_Kind_Parenthesis_Expression => + return Execute_Expression (Block, Get_Expression (Expr)); + when Iir_Kind_Type_Conversion => return Execute_Type_Conversion (Block, Expr, @@ -4297,7 +4300,8 @@ package body Execution is Stmt : Iir) is begin - Destroy_Iterator_Declaration (Instance, Get_Iterator_Scheme (Stmt)); + Destroy_Iterator_Declaration + (Instance, Get_Parameter_Specification (Stmt)); end Finalize_For_Loop_Statement; procedure Finalize_Loop_Statement (Instance : Block_Instance_Acc; @@ -4313,15 +4317,13 @@ package body Execution is is Instance : constant Block_Instance_Acc := Proc.Instance; Stmt : constant Iir_For_Loop_Statement := Instance.Stmt; + Iterator : constant Iir := Get_Parameter_Specification (Stmt); Bounds : Iir_Value_Literal_Acc; - Iterator : Iir; Index : Iir_Value_Literal_Acc; Stmt_Chain : Iir; Is_Nul : Boolean; Marker : Mark_Type; begin - Iterator := Get_Iterator_Scheme (Stmt); - -- Elaborate the iterator (and its type). Elaborate_Declaration (Instance, Iterator); @@ -4355,7 +4357,7 @@ package body Execution is function Finish_For_Loop_Statement (Instance : Block_Instance_Acc) return Boolean is - Iterator : constant Iir := Get_Iterator_Scheme (Instance.Stmt); + Iterator : constant Iir := Get_Parameter_Specification (Instance.Stmt); Bounds : Iir_Value_Literal_Acc; Index : Iir_Value_Literal_Acc; Marker : Mark_Type; @@ -4459,7 +4461,7 @@ package body Execution is is Instance : constant Block_Instance_Acc := Proc.Instance; Stmt : constant Iir := Instance.Stmt; - Label : constant Iir := Get_Loop (Stmt); + Label : constant Iir := Get_Named_Entity (Get_Loop_Label (Stmt)); Cond : Boolean; Parent : Iir; begin |