aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-sem_specs.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-04-05 09:20:04 +0200
committerTristan Gingold <tgingold@free.fr>2021-04-05 10:47:39 +0200
commit3c9c6023c38ed1272634a7d2aed5dbe1c318842a (patch)
tree9b0c80f87645a14fbcea51e05ecccaeb02ca6aeb /src/vhdl/vhdl-sem_specs.adb
parentf3e936f0ca532fb57f2700a46ba1ff84557f7305 (diff)
downloadghdl-3c9c6023c38ed1272634a7d2aed5dbe1c318842a.tar.gz
ghdl-3c9c6023c38ed1272634a7d2aed5dbe1c318842a.tar.bz2
ghdl-3c9c6023c38ed1272634a7d2aed5dbe1c318842a.zip
vhdl and libraries: add support for binding to a foreign module
Diffstat (limited to 'src/vhdl/vhdl-sem_specs.adb')
-rw-r--r--src/vhdl/vhdl-sem_specs.adb31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/vhdl/vhdl-sem_specs.adb b/src/vhdl/vhdl-sem_specs.adb
index a005f4214..456b0b055 100644
--- a/src/vhdl/vhdl-sem_specs.adb
+++ b/src/vhdl/vhdl-sem_specs.adb
@@ -1813,16 +1813,19 @@ package body Vhdl.Sem_Specs is
null;
end if;
- Design_Unit := Load_Primary_Unit
- (Get_Library (Get_Design_File (Entity_Unit)),
- Get_Identifier (Get_Library_Unit (Entity_Unit)),
- Parent);
- if Design_Unit = Null_Iir then
- -- Found an entity which is not in the library.
- raise Internal_Error;
- end if;
-
- Entity := Get_Library_Unit (Design_Unit);
+ case Iir_Kinds_Design_Unit (Get_Kind (Entity_Unit)) is
+ when Iir_Kind_Design_Unit =>
+ Design_Unit := Load_Primary_Unit
+ (Get_Library (Get_Design_File (Entity_Unit)),
+ Get_Identifier (Get_Library_Unit (Entity_Unit)),
+ Parent);
+ -- Found an entity which is not in the library.
+ pragma Assert (Design_Unit /= Null_Iir);
+ Entity := Get_Library_Unit (Design_Unit);
+
+ when Iir_Kind_Foreign_Module =>
+ Entity := Entity_Unit;
+ end case;
Res := Create_Iir (Iir_Kind_Binding_Indication);
Location_Copy (Res, Parent);
@@ -1838,7 +1841,10 @@ package body Vhdl.Sem_Specs is
Set_Entity_Name (Aspect, Entity_Name);
Set_Entity_Aspect (Res, Aspect);
- if Create_Map_Aspect then
+ -- No aspect for foreign modules.
+ if Create_Map_Aspect
+ and then Get_Kind (Entity) = Iir_Kind_Entity_Declaration
+ then
-- LRM 5.2.2
-- The default binding indication includes a default generic map
-- aspect if the design entity implied by the entity aspect contains
@@ -2085,6 +2091,9 @@ package body Vhdl.Sem_Specs is
Decl := Libraries.Find_Primary_Unit (Target_Lib, Name);
if Decl /= Null_Iir then
+ if Get_Kind (Decl) = Iir_Kind_Foreign_Module then
+ return Decl;
+ end if;
Res := Is_Entity_Declaration (Decl);
if Res /= Null_Iir then
return Res;