diff options
author | Tristan Gingold <tgingold@free.fr> | 2015-03-01 18:09:30 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2015-03-01 18:09:30 +0100 |
commit | ad4ac5499e426cff9b76479e8ff6250a32fcbb57 (patch) | |
tree | d24f1903700733dbb125ebea420d0980d84d8da9 /src/vhdl/translate/trans-chap12.adb | |
parent | 3619ff721b0456b2f15bd2d4913fd57aa97e827b (diff) | |
download | ghdl-ad4ac5499e426cff9b76479e8ff6250a32fcbb57.tar.gz ghdl-ad4ac5499e426cff9b76479e8ff6250a32fcbb57.tar.bz2 ghdl-ad4ac5499e426cff9b76479e8ff6250a32fcbb57.zip |
Elaborate generics in two steps. Fix -c/-e for llvm builds.
Diffstat (limited to 'src/vhdl/translate/trans-chap12.adb')
-rw-r--r-- | src/vhdl/translate/trans-chap12.adb | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/vhdl/translate/trans-chap12.adb b/src/vhdl/translate/trans-chap12.adb index 5c314f69a..0861852b8 100644 --- a/src/vhdl/translate/trans-chap12.adb +++ b/src/vhdl/translate/trans-chap12.adb @@ -42,8 +42,8 @@ package body Trans.Chap12 is Config_Subprg : O_Dnode; Nbr_Pkgs : Natural) is - Entity_Info : Block_Info_Acc; - Arch_Info : Block_Info_Acc; + Entity_Info : constant Block_Info_Acc := Get_Info (Entity); + Arch_Info : constant Block_Info_Acc := Get_Info (Arch); Inter_List : O_Inter_List; Assoc : O_Assoc_List; Instance : O_Dnode; @@ -52,9 +52,6 @@ package body Trans.Chap12 is Arr_Type : O_Tnode; Arr : O_Dnode; begin - Arch_Info := Get_Info (Arch); - Entity_Info := Get_Info (Entity); - -- We need to create code. Set_Global_Storage (O_Storage_Private); @@ -78,7 +75,7 @@ package body Trans.Chap12 is New_Var_Decl (Instance, Wki_Instance, O_Storage_Local, Entity_Info.Block_Decls_Ptr_Type); - -- Create instance for the architecture. + -- Allocate instance for the architecture. New_Assign_Stmt (New_Obj (Arch_Instance), Gen_Alloc (Alloc_System, @@ -132,19 +129,21 @@ package body Trans.Chap12 is Start_Association (Assoc, Entity_Info.Block_Elab_Pkg_Subprg); New_Procedure_Call (Assoc); - -- init instance + -- Init instance: assign default values to generic and create ports. + -- Allow user override of generics. Set_Scope_Via_Param_Ptr (Entity_Info.Block_Scope, Instance); Push_Identifier_Prefix (Mark, ""); - Chap1.Translate_Entity_Init (Entity); + Chap1.Translate_Entity_Init_Generics (Entity); + Start_Association (Assoc, Ghdl_Init_Top_Generics); + New_Procedure_Call (Assoc); + Chap1.Translate_Entity_Init_Ports (Entity); - -- elab instance + -- Elab instance. Start_Association (Assoc, Arch_Info.Block_Elab_Subprg); New_Association (Assoc, New_Obj_Value (Instance)); New_Procedure_Call (Assoc); - --Chap6.Link_Instance_Name (Null_Iir, Entity); - - -- configure instance. + -- Configure instance. Start_Association (Assoc, Config_Subprg); New_Association (Assoc, New_Obj_Value (Arch_Instance)); New_Procedure_Call (Assoc); |