From f100e7c33b3064d92a46ef09936aebd899203d8e Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 30 Jun 2016 06:15:30 +0200 Subject: Enable vest recursive instantiation test. --- src/vhdl/configuration.adb | 11 ++++++++--- src/vhdl/translate/trans-chap12.adb | 4 ++++ src/vhdl/translate/trans-chap5.adb | 16 +++++++++++----- 3 files changed, 23 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/vhdl/configuration.adb b/src/vhdl/configuration.adb index e4b862f3b..8c442dd76 100644 --- a/src/vhdl/configuration.adb +++ b/src/vhdl/configuration.adb @@ -52,9 +52,14 @@ package body Configuration is -- If already in the table, then nothing to do. if Get_Configuration_Mark_Flag (Unit) then - if not Get_Configuration_Done_Flag (Unit) then - raise Internal_Error; - end if; + -- There might be some direct recursions: + -- * the default configuration might be implicitly referenced by + -- a direct entity instantiation + -- * a configuration may be referenced by itself for a recursive + -- instantiation + pragma Assert (Get_Configuration_Done_Flag (Unit) + or else (Get_Kind (Get_Library_Unit (Unit)) + = Iir_Kind_Configuration_Declaration)); return; end if; Set_Configuration_Mark_Flag (Unit, True); diff --git a/src/vhdl/translate/trans-chap12.adb b/src/vhdl/translate/trans-chap12.adb index a5f2e9cfd..25b73fa71 100644 --- a/src/vhdl/translate/trans-chap12.adb +++ b/src/vhdl/translate/trans-chap12.adb @@ -658,6 +658,10 @@ package body Trans.Chap12 is Rtis.Generate_Library (Libraries.Std_Library, True); Translate_Standard (Whole); + -- Std.Standard has no body and is always in the closure. Exclude it + -- from the stub and filelist generation. + Set_Elab_Flag (Std_Standard_Unit, True); + -- Translate all configurations needed. -- Also, set the ELAB_FLAG on package with body. for I in Design_Units.First .. Design_Units.Last loop diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index c115b84b4..7bdb84385 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -36,7 +36,10 @@ package body Trans.Chap5 is Scope => Scope_Ptr.all); end Save_Map_Env; - procedure Set_Map_Env (Env : Map_Env) is + procedure Set_Map_Env (Env : Map_Env) + is + -- Avoid potential compiler bug with discriminant check. + pragma Suppress (Discriminant_Check); begin Env.Scope_Ptr.all := Env.Scope; end Set_Map_Env; @@ -421,9 +424,10 @@ package body Trans.Chap5 is end if; else - Set_Map_Env (Actual_Env); - Actual_En := Chap7.Translate_Expression (Actual, Formal_Type); + -- Association by value. The formal cannot be referenced in the + -- actual. Set_Map_Env (Formal_Env); + Actual_En := Chap7.Translate_Expression (Actual, Formal_Type); Actual_Sig := E2M (Actual_En, Get_Info (Formal_Type), Mode_Value); Chap6.Translate_Signal_Name (Formal, Formal_Sig, Formal_Val); Mode := Connect_Value; @@ -449,12 +453,12 @@ package body Trans.Chap5 is Chap4.Elab_In_Conversion (Assoc, Actual_Sig); Set_Map_Env (Formal_Env); Formal_Sig := Chap6.Translate_Name (Formal, Mode_Signal); - Set_Map_Env (Actual_Env); Data := (Actual_Sig => Actual_Sig, Actual_Type => Formal_Type, Mode => Connect_Effective, By_Copy => False); Connect (Formal_Sig, Formal_Type, Data); + Set_Map_Env (Actual_Env); end if; if Get_Out_Conversion (Assoc) /= Null_Iir then -- flow: FORMAL to ACTUAL @@ -639,7 +643,9 @@ package body Trans.Chap5 is begin Set_Map_Env (Formal_Env); -- Set bounds of unconstrained ports. - if Fbt_Info.Type_Mode = Type_Mode_Fat_Array then + if Get_Whole_Association_Flag (Assoc) + and then Fbt_Info.Type_Mode = Type_Mode_Fat_Array + then Open_Temp; Elab_Unconstrained_Port_Bounds (Formal, Assoc); Close_Temp; -- cgit v1.2.3