diff options
Diffstat (limited to 'simulate')
-rw-r--r-- | simulate/elaboration.adb | 37 | ||||
-rw-r--r-- | simulate/execution.adb | 27 | ||||
-rw-r--r-- | simulate/simulation.adb | 3 |
3 files changed, 25 insertions, 42 deletions
diff --git a/simulate/elaboration.adb b/simulate/elaboration.adb index eb0d14b..dc3a625 100644 --- a/simulate/elaboration.adb +++ b/simulate/elaboration.adb @@ -1416,22 +1416,20 @@ package body Elaboration is -- Direct instantiation declare Aspect : constant Iir := Component; - Entity_Unit : Iir; Arch : Iir; Config : Iir; begin case Get_Kind (Aspect) is when Iir_Kind_Entity_Aspect_Entity => - Entity_Unit := Get_Entity (Aspect); Arch := Get_Architecture (Aspect); if Arch = Null_Iir then Arch := Libraries.Get_Latest_Architecture - (Get_Library_Unit (Entity_Unit)); + (Get_Entity (Aspect)); end if; - Config := Get_Default_Configuration_Declaration (Arch); + Config := Get_Library_Unit + (Get_Default_Configuration_Declaration (Arch)); when Iir_Kind_Entity_Aspect_Configuration => Config := Get_Configuration (Aspect); - Entity_Unit := Get_Entity (Config); Arch := Get_Block_Specification (Get_Block_Configuration (Config)); when Iir_Kind_Entity_Aspect_Open => @@ -1439,7 +1437,7 @@ package body Elaboration is when others => raise Internal_Error; end case; - Config := Get_Block_Configuration (Get_Library_Unit (Config)); + Config := Get_Block_Configuration (Config); Frame := Elaborate_Architecture (Arch, Config, Instance, Stmt, @@ -1670,7 +1668,6 @@ package body Elaboration is is Component : constant Iir_Component_Declaration := Get_Instantiated_Unit (Stmt); - Entity_Design : Iir_Design_Unit; Entity : Iir_Entity_Declaration; Arch_Name : Name_Id; Arch_Design : Iir_Design_Unit; @@ -1679,7 +1676,6 @@ package body Elaboration is pragma Unreferenced (Arch_Frame); Generic_Map_Aspect_Chain : Iir; Port_Map_Aspect_Chain : Iir; - Unit : Iir; Binding : Iir_Binding_Indication; Aspect : Iir; Sub_Conf : Iir; @@ -1730,9 +1726,9 @@ package body Elaboration is case Get_Kind (Aspect) is when Iir_Kind_Design_Unit => - Entity_Design := Aspect; + raise Internal_Error; when Iir_Kind_Entity_Aspect_Entity => - Entity_Design := Get_Entity (Aspect); + Entity := Get_Entity (Aspect); if Get_Architecture (Aspect) /= Null_Iir then Arch_Name := Get_Identifier (Get_Architecture (Aspect)); end if; @@ -1741,29 +1737,16 @@ package body Elaboration is raise Internal_Error; end if; declare - Cf : Iir; + Conf : constant Iir := Get_Configuration (Aspect); begin - Cf := Get_Configuration (Aspect); - Cf := Get_Library_Unit (Cf); - Entity_Design := Get_Entity (Cf); - Sub_Conf := Get_Block_Configuration (Cf); + Entity := Get_Entity (Conf); + Sub_Conf := Get_Block_Configuration (Conf); Arch := Get_Block_Specification (Sub_Conf); end; when others => Error_Kind ("elaborate_component_declaration0", Aspect); end case; - Unit := Get_Library_Unit (Entity_Design); - case Get_Kind (Unit) is - when Iir_Kind_Entity_Declaration => - Entity := Unit; - when Iir_Kind_Configuration_Declaration => - Entity_Design := Get_Entity (Unit); - Entity := Get_Library_Unit (Entity_Design); - when others => - Error_Kind ("elaborate_component_declaration2", Unit); - end case; - if Arch = Null_Iir then if Arch_Name = Null_Identifier then Arch := Libraries.Get_Latest_Architecture (Entity); @@ -1774,7 +1757,7 @@ package body Elaboration is Arch_Name := Get_Identifier (Arch); end if; Arch_Design := Libraries.Load_Secondary_Unit - (Entity_Design, Arch_Name, Stmt); + (Get_Design_Unit (Entity), Arch_Name, Stmt); if Arch_Design = Null_Iir then Error_Msg_Elab ("no architecture `" & Name_Table.Image (Arch_Name) & "' for " & Disp_Node (Entity), Stmt); diff --git a/simulate/execution.adb b/simulate/execution.adb index 0d9e427..3568e9d 100644 --- a/simulate/execution.adb +++ b/simulate/execution.adb @@ -24,7 +24,6 @@ with Errorout; use Errorout; with Evaluation; with Iirs_Utils; use Iirs_Utils; with Annotations; use Annotations; -with Flags; with Name_Table; with File_Operation; with Debugger; use Debugger; @@ -1962,32 +1961,29 @@ package body Execution is Index_Order : Order; -- Lower and upper bounds of the slice. Low, High: Iir_Index32; - - use Flags; begin Srange := Execute_Bounds (Block, Get_Suffix (Expr)); Prefix := Get_Prefix (Expr); - -- LRM93 §6.5: It is an error if either of the bounds of the - -- discrete range does not belong to the index range of the - -- prefixing array, unless the slice is a null slice. Execute_Name_With_Base (Block, Prefix, Base, Prefix_Array, Is_Sig); if Prefix_Array = null then raise Internal_Error; end if; - -- Check for null slice. + -- LRM93 6.5 + -- It is an error if the direction of the discrete range is not + -- the same as that of the index range of the array denoted by + -- the prefix of the slice name. if Srange.Dir /= Prefix_Array.Bounds.D (1).Dir then - if Vhdl_Std = Vhdl_87 then - Res := null; -- FIXME - return; - else - raise Internal_Error; - end if; + Error_Msg_Exec ("slice direction mismatch", Expr); end if; + -- LRM93 6.5 + -- It is an error if either of the bounds of the + -- discrete range does not belong to the index range of the + -- prefixing array, unless the slice is a null slice. Index_Order := Compare_Value (Srange.Left, Srange.Right); if (Srange.Dir = Iir_To and Index_Order = Greater) or (Srange.Dir = Iir_Downto and Index_Order = Less) @@ -2579,6 +2575,11 @@ package body Execution is (Block, Get_Prefix (Expr), Get_Value (Get_Parameter (Expr))); return Execute_Length (Res); + when Iir_Kind_Ascending_Array_Attribute => + Res := Execute_Indexes + (Block, Get_Prefix (Expr), Get_Value (Get_Parameter (Expr))); + return Boolean_To_Lit (Res.Dir = Iir_To); + when Iir_Kind_Event_Attribute => Res := Execute_Name (Block, Get_Prefix (Expr), True); return Boolean_To_Lit (Execute_Event_Attribute (Res)); diff --git a/simulate/simulation.adb b/simulate/simulation.adb index 3e04e38..304faa9 100644 --- a/simulate/simulation.adb +++ b/simulate/simulation.adb @@ -1592,8 +1592,7 @@ package body Simulation is Instance_Pool := Global_Pool'Access; Elaboration.Elaborate_Design (Top_Config); - Entity := Get_Library_Unit - (Get_Entity (Get_Library_Unit (Top_Config))); + Entity := Get_Entity (Get_Library_Unit (Top_Config)); if not Is_Empty (Expr_Pool) then raise Internal_Error; |