diff options
| -rw-r--r-- | src/simul/simul-vhdl_elab.adb | 4 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_decls.adb | 4 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_inst.adb | 37 | ||||
| -rw-r--r-- | src/vhdl/vhdl-sem_inst.ads | 11 | 
4 files changed, 54 insertions, 2 deletions
| diff --git a/src/simul/simul-vhdl_elab.adb b/src/simul/simul-vhdl_elab.adb index bb0aac880..5c41511d6 100644 --- a/src/simul/simul-vhdl_elab.adb +++ b/src/simul/simul-vhdl_elab.adb @@ -434,6 +434,10 @@ package body Simul.Vhdl_Elab is             | Iir_Kind_Group_Template_Declaration             | Iir_Kind_Group_Declaration =>              null; + +         when Iir_Kind_Package_Instantiation_Declaration => +            --  TODO: signals in package ? +            null;           when others =>              Error_Kind ("gather_processes_decl", Decl);        end case; diff --git a/src/vhdl/vhdl-sem_decls.adb b/src/vhdl/vhdl-sem_decls.adb index a9c686707..974cc21d8 100644 --- a/src/vhdl/vhdl-sem_decls.adb +++ b/src/vhdl/vhdl-sem_decls.adb @@ -517,7 +517,9 @@ package body Vhdl.Sem_Decls is           --  Not yet fully supported - need to check the instance.        end if; -      Sem_Inst.Instantiate_Package_Declaration (Inter, Pkg); +      --  Create generics and declarations for the interface package so that +      --  references are resolved to those declarations. +      Sem_Inst.Instantiate_Interface_Package_Declaration (Inter, Pkg);        Sem_Scopes.Add_Name (Inter);        Set_Is_Within_Flag (Inter, True); diff --git a/src/vhdl/vhdl-sem_inst.adb b/src/vhdl/vhdl-sem_inst.adb index 4e7e1aa42..db34e5f39 100644 --- a/src/vhdl/vhdl-sem_inst.adb +++ b/src/vhdl/vhdl-sem_inst.adb @@ -1100,6 +1100,43 @@ package body Vhdl.Sem_Inst is        Restore_Origin (Mark);     end Instantiate_Subprogram_Declaration; +   procedure Instantiate_Interface_Package_Declaration (Inter : Iir; Pkg : Iir) +   is +      Header : constant Iir := Get_Package_Header (Pkg); +      Prev_Instance_File : constant Source_File_Entry := Instance_File; +      Mark : constant Instance_Index_Type := Prev_Instance_Table.Last; +      Prev_Within_Shared_Instance : constant Boolean := +        Is_Within_Shared_Instance; +   begin +      Create_Relocation (Inter, Pkg); +      Set_Instance_Source_File (Inter, Instance_File); + +      --  Be sure Get_Origin_Priv can be called on existing nodes. +      Expand_Origin_Table; + +      --  For Parent: the instance of PKG is INST. +      Set_Origin (Pkg, Inter); + +      Is_Within_Shared_Instance := not Get_Macro_Expanded_Flag (Pkg); + +      --  Manually instantiate the package declaration. +      Set_Generic_Chain +        (Inter, Instantiate_Generic_Chain (Inter, Get_Generic_Chain (Header))); +      Instantiate_Generic_Map_Chain (Inter, Pkg); +      Set_Declaration_Chain +        (Inter, Instantiate_Iir_Chain (Get_Declaration_Chain (Pkg))); +      Set_Attribute_Value_Chain +        (Inter, Instantiate_Iir (Get_Attribute_Value_Chain (Pkg), True)); +      Instantiate_Attribute_Value_Chain (Inter); + +      Set_Origin (Pkg, Null_Iir); + +      Instance_File := Prev_Instance_File; +      Restore_Origin (Mark); + +      Is_Within_Shared_Instance := Prev_Within_Shared_Instance; +   end Instantiate_Interface_Package_Declaration; +     procedure Instantiate_Package_Declaration (Inst : Iir; Pkg : Iir)     is        Header : constant Iir := Get_Package_Header (Pkg); diff --git a/src/vhdl/vhdl-sem_inst.ads b/src/vhdl/vhdl-sem_inst.ads index 6d8a76300..1099479de 100644 --- a/src/vhdl/vhdl-sem_inst.ads +++ b/src/vhdl/vhdl-sem_inst.ads @@ -21,7 +21,16 @@ package Vhdl.Sem_Inst is     --  If N is not an instance, this function returns Null_Iir.     function Get_Origin (N : Iir) return Iir; -   --  Create declaration chain and generic declarations for INST from PKG. +   --  Create declaration chain and generic declarations for INTER from PKG, +   --  so the the parent of INTER can be analyzed and references to PKG +   --  points to an instance. +   --  It is necessary to create an instance because two interface packages +   --  are different even if they have the same uninstantiated package. +   procedure Instantiate_Interface_Package_Declaration +     (Inter : Iir; Pkg : Iir); + +   --  - package instantiations +   --    instantiate each node.     procedure Instantiate_Package_Declaration (Inst : Iir; Pkg : Iir);     --  Create interface parameters of INST from SUBPRG. | 
