diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-01-10 07:44:56 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-01-10 07:44:56 +0100 |
commit | 3641df142fff346e8acb4ed74cfab0a16fcbb9e3 (patch) | |
tree | ae4d77ac3700a007edddd9418e71ae30e27985f9 | |
parent | 686be1369e17771c4d179626c20ce7ae5e090edc (diff) | |
download | ghdl-3641df142fff346e8acb4ed74cfab0a16fcbb9e3.tar.gz ghdl-3641df142fff346e8acb4ed74cfab0a16fcbb9e3.tar.bz2 ghdl-3641df142fff346e8acb4ed74cfab0a16fcbb9e3.zip |
synth: refine handling of interface type. Fix #1944
-rw-r--r-- | src/synth/elab-vhdl_insts.adb | 8 | ||||
-rw-r--r-- | src/vhdl/vhdl-annotations.adb | 22 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/synth/elab-vhdl_insts.adb b/src/synth/elab-vhdl_insts.adb index ac955db0e..5192046b1 100644 --- a/src/synth/elab-vhdl_insts.adb +++ b/src/synth/elab-vhdl_insts.adb @@ -108,10 +108,14 @@ package body Elab.Vhdl_Insts is when Iir_Kind_Interface_Type_Declaration => declare + Act : Node; Act_Typ : Type_Acc; begin - Act_Typ := Synth_Subtype_Indication - (Syn_Inst, Get_Actual (Assoc)); + Act := Get_Actual (Assoc); + if Get_Kind (Act) in Iir_Kinds_Denoting_Name then + Act := Get_Type (Act); + end if; + Act_Typ := Synth_Subtype_Indication (Syn_Inst, Act); Create_Subtype_Object (Sub_Inst, Get_Type (Inter), Act_Typ); end; diff --git a/src/vhdl/vhdl-annotations.adb b/src/vhdl/vhdl-annotations.adb index 13aa8bf3b..ec6efd46a 100644 --- a/src/vhdl/vhdl-annotations.adb +++ b/src/vhdl/vhdl-annotations.adb @@ -600,18 +600,25 @@ package body Vhdl.Annotations is procedure Annotate_Package_Declaration (Block_Info : Sim_Info_Acc; Decl: Iir) is + Is_Inst : constant Boolean := + Get_Kind (Decl) = Iir_Kind_Package_Instantiation_Declaration; Package_Info : Sim_Info_Acc; Header : Iir; begin + if not Is_Inst + and then Is_Uninstantiated_Package (Decl) + and then Get_Macro_Expanded_Flag (Decl) + then + return; + end if; + Package_Info := new Sim_Info_Type' (Kind => Kind_Package, Ref => Decl, Nbr_Objects => 0, Pkg_Slot => Invalid_Object_Slot, Pkg_Parent => null); - if Get_Kind (Decl) = Iir_Kind_Package_Instantiation_Declaration - or else not Is_Uninstantiated_Package (Decl) - then + if Is_Inst or else not Is_Uninstantiated_Package (Decl) then Block_Info.Nbr_Objects := Block_Info.Nbr_Objects + 1; Package_Info.Pkg_Slot := Block_Info.Nbr_Objects; Package_Info.Pkg_Parent := Block_Info; @@ -619,7 +626,7 @@ package body Vhdl.Annotations is Set_Info (Decl, Package_Info); - if Get_Kind (Decl) = Iir_Kind_Package_Instantiation_Declaration then + if Is_Inst then Annotate_Interface_List (Package_Info, Get_Generic_Chain (Decl), True); else @@ -629,10 +636,11 @@ package body Vhdl.Annotations is (Package_Info, Get_Generic_Chain (Header), True); end if; end if; + -- declarations Annotate_Declaration_List (Package_Info, Get_Declaration_Chain (Decl)); - if Get_Kind (Decl) = Iir_Kind_Package_Instantiation_Declaration then + if Is_Inst then declare Bod : constant Iir := Get_Instance_Package_Body (Decl); begin @@ -648,7 +656,9 @@ package body Vhdl.Annotations is begin -- There is not corresponding body for an instantiation, so -- also add objects for the shared body. - Package_Info.Nbr_Objects := Uninst_Info.Nbr_Objects; + if not Get_Macro_Expanded_Flag (Uninst) then + Package_Info.Nbr_Objects := Uninst_Info.Nbr_Objects; + end if; end; end if; end; |