From f94b64e892c4c5b7cc9b3661a0de0a358e79093c Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 11 May 2015 21:03:45 +0200 Subject: Allow generic without default values in top-level entity. Implement ticket #47. --- src/vhdl/translate/trans-chap1.adb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/vhdl/translate/trans-chap1.adb') diff --git a/src/vhdl/translate/trans-chap1.adb b/src/vhdl/translate/trans-chap1.adb index 8d6099295..35cbfb0f0 100644 --- a/src/vhdl/translate/trans-chap1.adb +++ b/src/vhdl/translate/trans-chap1.adb @@ -41,14 +41,29 @@ package body Trans.Chap1 is procedure Translate_Entity_Init_Generics (Entity : Iir) is - El : Iir; + El : Iir; begin Push_Local_Factory; El := Get_Generic_Chain (Entity); while El /= Null_Iir loop Open_Temp; - Chap4.Elab_Object_Value (El, Get_Default_Value (El)); + + declare + Val : constant Iir := Get_Default_Value (El); + El_Type : constant Iir := Get_Type (El); + begin + if Val = Null_Iir + and then Get_Kind (El_Type) in Iir_Kinds_Array_Type_Definition + and then Get_Constraint_State (El_Type) /= Fully_Constrained + then + -- Do not initialize unconstrained array. They will have + -- to be overriden by user. + null; + else + Chap4.Elab_Object_Value (El, Val); + end if; + end; Close_Temp; El := Get_Chain (El); end loop; -- cgit v1.2.3