diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-12-18 17:16:57 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-12-18 17:16:57 +0100 |
commit | c0095f3f0c37a2db4d56dc289854252e2e6e67d4 (patch) | |
tree | 6fa51ee45d62cd7af1d181bda4495d00ccb6b484 /src/vhdl/vhdl-sem_inst.adb | |
parent | b4f09236ad974a133318d17a8487b36ebc35a78c (diff) | |
download | ghdl-c0095f3f0c37a2db4d56dc289854252e2e6e67d4.tar.gz ghdl-c0095f3f0c37a2db4d56dc289854252e2e6e67d4.tar.bz2 ghdl-c0095f3f0c37a2db4d56dc289854252e2e6e67d4.zip |
vhdl-sem_inst: add instantiate_interface_package_declaration
Diffstat (limited to 'src/vhdl/vhdl-sem_inst.adb')
-rw-r--r-- | src/vhdl/vhdl-sem_inst.adb | 37 |
1 files changed, 37 insertions, 0 deletions
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); |