aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/sem_specs.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-09-24 06:42:34 +0200
committerTristan Gingold <tgingold@free.fr>2015-09-24 06:42:34 +0200
commita66ca30c81966aee0f5ec0d50f337760613010b4 (patch)
tree0a102831b3628163f87d4c75d8b16e71aa8865a5 /src/vhdl/sem_specs.adb
parent0ee76513c5c49823307946ba14580f4047b9a101 (diff)
downloadghdl-a66ca30c81966aee0f5ec0d50f337760613010b4.tar.gz
ghdl-a66ca30c81966aee0f5ec0d50f337760613010b4.tar.bz2
ghdl-a66ca30c81966aee0f5ec0d50f337760613010b4.zip
Fix ticket94: default binding indication for component.
Diffstat (limited to 'src/vhdl/sem_specs.adb')
-rw-r--r--src/vhdl/sem_specs.adb38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/vhdl/sem_specs.adb b/src/vhdl/sem_specs.adb
index 718ee1787..8c22e9cc7 100644
--- a/src/vhdl/sem_specs.adb
+++ b/src/vhdl/sem_specs.adb
@@ -1671,18 +1671,29 @@ package body Sem_Specs is
function Get_Visible_Entity_Declaration (Comp: Iir_Component_Declaration)
return Iir_Design_Unit
is
- function Is_Entity_Declaration (Decl : Iir) return Boolean is
+ -- Return the design_unit if DECL is an entity declaration or the
+ -- design unit of an entity declaration. Otherwise return Null_Iir.
+ -- This double check is needed as the interpretation may be both.
+ function Is_Entity_Declaration (Decl : Iir) return Iir is
begin
- return Get_Kind (Decl) = Iir_Kind_Design_Unit and then
- Get_Kind (Get_Library_Unit (Decl)) = Iir_Kind_Entity_Declaration;
+ if Get_Kind (Decl) = Iir_Kind_Entity_Declaration then
+ return Get_Design_Unit (Decl);
+ elsif Get_Kind (Decl) = Iir_Kind_Design_Unit
+ and then
+ Get_Kind (Get_Library_Unit (Decl)) = Iir_Kind_Entity_Declaration
+ then
+ return Decl;
+ else
+ return Null_Iir;
+ end if;
end Is_Entity_Declaration;
+ Name : constant Name_Id := Get_Identifier (Comp);
Inter : Name_Interpretation_Type;
- Name : Name_Id;
Decl : Iir;
+ Res : Iir;
Target_Lib : Iir;
begin
- Name := Get_Identifier (Comp);
Inter := Get_Interpretation (Name);
if Valid_Interpretation (Inter) then
@@ -1693,8 +1704,9 @@ package body Sem_Specs is
-- the instantiated component and that is directly visible
-- (see 10.3),
Decl := Get_Declaration (Inter);
- if Is_Entity_Declaration (Decl) then
- return Decl;
+ Res := Is_Entity_Declaration (Decl);
+ if Res /= Null_Iir then
+ return Res;
end if;
-- b) An entity declaration that has the same simple name that of
@@ -1706,8 +1718,9 @@ package body Sem_Specs is
Inter := Get_Under_Interpretation (Name);
if Valid_Interpretation (Inter) then
Decl := Get_Declaration (Inter);
- if Is_Entity_Declaration (Decl) then
- return Decl;
+ Res := Is_Entity_Declaration (Decl);
+ if Res /= Null_Iir then
+ return Res;
end if;
end if;
end if;
@@ -1730,8 +1743,11 @@ package body Sem_Specs is
end loop;
Decl := Libraries.Find_Primary_Unit (Target_Lib, Name);
- if Decl /= Null_Iir and then Is_Entity_Declaration (Decl) then
- return Decl;
+ if Decl /= Null_Iir then
+ Res := Is_Entity_Declaration (Decl);
+ if Res /= Null_Iir then
+ return Res;
+ end if;
end if;
end if;