diff options
author | Tristan Gingold <tgingold@free.fr> | 2015-05-11 21:03:45 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2015-05-11 21:03:45 +0200 |
commit | f94b64e892c4c5b7cc9b3661a0de0a358e79093c (patch) | |
tree | 98df9f9fd235536855c5474625fee57aff16c7f0 /src/vhdl/translate/trans-chap1.adb | |
parent | ae9bf87f0ecb5f8e43f8e1df4ce9fdb5a16bff8d (diff) | |
download | ghdl-f94b64e892c4c5b7cc9b3661a0de0a358e79093c.tar.gz ghdl-f94b64e892c4c5b7cc9b3661a0de0a358e79093c.tar.bz2 ghdl-f94b64e892c4c5b7cc9b3661a0de0a358e79093c.zip |
Allow generic without default values in top-level entity.
Implement ticket #47.
Diffstat (limited to 'src/vhdl/translate/trans-chap1.adb')
-rw-r--r-- | src/vhdl/translate/trans-chap1.adb | 19 |
1 files changed, 17 insertions, 2 deletions
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; |