aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-sem_stmts.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-12-23 16:17:14 +0100
committerTristan Gingold <tgingold@free.fr>2022-12-23 18:28:10 +0100
commit8845f761ed2299e595afd5eee2444fed7fb79639 (patch)
treeb6a52951a2894f9a61c8945497eb4c8ff00a9e3d /src/vhdl/vhdl-sem_stmts.adb
parent58fa04a4d96a304146ae7ebaf59da6cb10886105 (diff)
downloadghdl-8845f761ed2299e595afd5eee2444fed7fb79639.tar.gz
ghdl-8845f761ed2299e595afd5eee2444fed7fb79639.tar.bz2
ghdl-8845f761ed2299e595afd5eee2444fed7fb79639.zip
vhdl-sem_stmts: simplify code, add comments
Diffstat (limited to 'src/vhdl/vhdl-sem_stmts.adb')
-rw-r--r--src/vhdl/vhdl-sem_stmts.adb32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/vhdl/vhdl-sem_stmts.adb b/src/vhdl/vhdl-sem_stmts.adb
index 1b5228520..c5ae646d8 100644
--- a/src/vhdl/vhdl-sem_stmts.adb
+++ b/src/vhdl/vhdl-sem_stmts.adb
@@ -1946,13 +1946,13 @@ package body Vhdl.Sem_Stmts is
end if;
end Sem_Instantiated_Unit;
+ -- If a component or an entity contains an interface package or type,
+ -- the ports have to be instantiated in the case they use a type of the
+ -- interface.
function Component_Need_Instance (Comp : Iir) return Boolean
is
Inter : Iir;
- Inter_Type, Type_Name : Iir;
- Has_Type_Gen : Boolean;
begin
- Has_Type_Gen := False;
Inter := Get_Generic_Chain (Comp);
while Inter /= Null_Iir loop
case Get_Kind (Inter) is
@@ -1965,33 +1965,10 @@ package body Vhdl.Sem_Stmts is
Inter := Get_Chain (Inter);
end loop;
- -- If neither interface package nor interface type, no need to check
- -- ports.
- if not Has_Type_Gen then
- return False;
- end if;
-
- -- Check if a type from an interface package or a generic type is used.
- Inter := Get_Port_Chain (Comp);
- while Inter /= Null_Iir loop
- Inter_Type := Get_Subtype_Indication (Inter);
- if Inter_Type /= Null_Iir then
- -- Maybe to ad-hoc ?
- Type_Name := Get_Base_Name (Inter_Type);
- case Get_Kind (Type_Name) is
- when Iir_Kind_Interface_Package_Declaration
- | Iir_Kind_Interface_Type_Declaration =>
- return True;
- when others =>
- null;
- end case;
- end if;
- Inter := Get_Chain (Inter);
- end loop;
-
return False;
end Component_Need_Instance;
+ -- Change the formal so that it refers to the original interface.
procedure Reassoc_Association_Chain (Chain : Iir)
is
Assoc : Iir;
@@ -2007,6 +1984,7 @@ package body Vhdl.Sem_Stmts is
Ent := Sem_Inst.Get_Origin (Ent);
Set_Named_Entity (Formal, Ent);
else
+ -- TODO.
raise Internal_Error;
end if;
end if;