aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorPatrick Lehmann <Paebbels@gmail.com>2021-12-15 22:10:09 +0100
committerGitHub <noreply@github.com>2021-12-15 22:10:09 +0100
commit918e15bb6fab7da8719624ac9d37a47db4751375 (patch)
treee343b717af2139c142b660a1c918bce06ecd946a /src/vhdl
parent75bd31ff74ba3965bec27bf34a93b9c451e0d749 (diff)
parentf32d77707a2639fed94978965b3a9690c2bf7904 (diff)
downloadghdl-918e15bb6fab7da8719624ac9d37a47db4751375.tar.gz
ghdl-918e15bb6fab7da8719624ac9d37a47db4751375.tar.bz2
ghdl-918e15bb6fab7da8719624ac9d37a47db4751375.zip
Merge branch 'ghdl:master' into paebbels/pyGHDL-updates
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/vhdl-annotations.adb11
-rw-r--r--src/vhdl/vhdl-configuration.adb69
-rw-r--r--src/vhdl/vhdl-configuration.ads6
-rw-r--r--src/vhdl/vhdl-sem_expr.adb3
4 files changed, 64 insertions, 25 deletions
diff --git a/src/vhdl/vhdl-annotations.adb b/src/vhdl/vhdl-annotations.adb
index b1a36646e..13aa8bf3b 100644
--- a/src/vhdl/vhdl-annotations.adb
+++ b/src/vhdl/vhdl-annotations.adb
@@ -431,7 +431,8 @@ package body Vhdl.Annotations is
when Iir_Kind_Protected_Type_Declaration =>
Annotate_Protected_Type_Declaration (Block_Info, Def);
- when Iir_Kind_Incomplete_Type_Definition =>
+ when Iir_Kind_Incomplete_Type_Definition
+ | Iir_Kind_Subtype_Attribute =>
null;
when Iir_Kind_Foreign_Vector_Type_Definition =>
@@ -509,8 +510,12 @@ package body Vhdl.Annotations is
Create_Object_Info (Block_Info, Decl);
when Iir_Kind_Interface_Package_Declaration =>
Annotate_Interface_Package_Declaration (Block_Info, Decl);
- when Iir_Kinds_Interface_Subprogram_Declaration
- | Iir_Kind_Interface_Type_Declaration =>
+ when Iir_Kind_Interface_Type_Declaration =>
+ if Flag_Synthesis then
+ -- Create an info on the interface_type_definition
+ Create_Object_Info (Block_Info, Get_Type (Decl));
+ end if;
+ when Iir_Kinds_Interface_Subprogram_Declaration =>
-- Macro-expanded
null;
when others =>
diff --git a/src/vhdl/vhdl-configuration.adb b/src/vhdl/vhdl-configuration.adb
index aeb737028..64a615bfb 100644
--- a/src/vhdl/vhdl-configuration.adb
+++ b/src/vhdl/vhdl-configuration.adb
@@ -27,6 +27,7 @@ with Vhdl.Sem_Scopes;
with Vhdl.Sem_Lib; use Vhdl.Sem_Lib;
with Vhdl.Canon;
with Vhdl.Evaluation;
+with Vhdl.Scanner;
package body Vhdl.Configuration is
procedure Add_Design_Concurrent_Stmts (Parent : Iir);
@@ -1167,7 +1168,7 @@ package body Vhdl.Configuration is
end Find_Top_Entity;
type Override_Entry is record
- Gen : Name_Id;
+ Gen : String_Acc;
Value : String_Acc;
end record;
@@ -1177,9 +1178,9 @@ package body Vhdl.Configuration is
Table_Low_Bound => 1,
Table_Initial => 16);
- procedure Add_Generic_Override (Id : Name_Id; Value : String) is
+ procedure Add_Generic_Override (Name : String; Value : String) is
begin
- Override_Table.Append (Override_Entry'(Gen => Id,
+ Override_Table.Append (Override_Entry'(Gen => new String'(Name),
Value => new String'(Value)));
end Add_Generic_Override;
@@ -1325,29 +1326,57 @@ package body Vhdl.Configuration is
procedure Apply_Generic_Override (Ent : Iir)
is
- Inter_Chain : constant Iir := Get_Generic_Chain (Ent);
- Inter : Iir;
begin
for I in Override_Table.First .. Override_Table.Last loop
declare
Over : constant Override_Entry := Override_Table.Table (I);
begin
- Inter := Inter_Chain;
- while Inter /= Null_Iir loop
- exit when Get_Identifier (Inter) = Over.Gen;
- Inter := Get_Chain (Inter);
- end loop;
+ case Get_Kind (Ent) is
+ when Iir_Kind_Entity_Declaration =>
+ declare
+ Inter_Chain : constant Iir := Get_Generic_Chain (Ent);
+ Gen_Name : String := Over.Gen.all;
+ Gen_Id : Name_Id;
+ Inter : Iir;
+ Err : Boolean;
+ begin
+ Vhdl.Scanner.Convert_Identifier (Gen_Name, Err);
+ if Err then
+ Error_Msg_Option
+ ("incorrect name in generic override option");
+ Gen_Id := Null_Identifier;
+ else
+ Gen_Id := Name_Table.Get_Identifier (Gen_Name);
- if Inter = Null_Iir then
- Error_Msg_Elab ("no generic %i for -g", +Over.Gen);
- elsif Get_Kind (Inter) /= Iir_Kind_Interface_Constant_Declaration
- then
- Error_Msg_Elab
- ("generic %n cannot be overriden (not a constant)",
- +Over.Gen);
- else
- Override_Generic (Inter, Over.Value);
- end if;
+ Inter := Inter_Chain;
+ while Inter /= Null_Iir loop
+ exit when Get_Identifier (Inter) = Gen_Id;
+ Inter := Get_Chain (Inter);
+ end loop;
+ end if;
+
+ if Gen_Id = Null_Identifier then
+ -- Skip it
+ null;
+ elsif Inter = Null_Iir then
+ Error_Msg_Elab ("no generic %i for -g", +Gen_Id);
+ elsif (Get_Kind (Inter)
+ /= Iir_Kind_Interface_Constant_Declaration)
+ then
+ -- Could be a generic package, a generic type...
+ Error_Msg_Elab
+ ("generic %n cannot be overriden (not a constant)",
+ +Gen_Id);
+ else
+ Override_Generic (Inter, Over.Value);
+ end if;
+ end;
+ when Iir_Kind_Foreign_Module =>
+ Apply_Foreign_Override
+ (Get_Foreign_Node (Ent), Over.Gen.all, Over.Value.all);
+ when others =>
+ raise Internal_Error;
+ end case;
end;
end loop;
end Apply_Generic_Override;
diff --git a/src/vhdl/vhdl-configuration.ads b/src/vhdl/vhdl-configuration.ads
index d272d23e9..dfd59c516 100644
--- a/src/vhdl/vhdl-configuration.ads
+++ b/src/vhdl/vhdl-configuration.ads
@@ -69,8 +69,12 @@ package Vhdl.Configuration is
type Mark_Instantiated_Units_Access is access procedure (N : Int32);
Mark_Foreign_Module : Mark_Instantiated_Units_Access;
+ type Apply_Foreign_Override_Access is access procedure
+ (Top : Int32; Gen : String; Value : String);
+ Apply_Foreign_Override : Apply_Foreign_Override_Access;
+
-- Add an override for generic ID.
- procedure Add_Generic_Override (Id : Name_Id; Value : String);
+ procedure Add_Generic_Override (Name : String; Value : String);
-- Apply generic overrides to entity ENT.
procedure Apply_Generic_Override (Ent : Iir);
diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb
index 21e7b2237..04a73071c 100644
--- a/src/vhdl/vhdl-sem_expr.adb
+++ b/src/vhdl/vhdl-sem_expr.adb
@@ -4767,7 +4767,8 @@ package body Vhdl.Sem_Expr is
Obj := Get_Named_Entity (Obj);
when Iir_Kinds_Psl_Builtin =>
return;
- when Iir_Kind_Error =>
+ when Iir_Kind_Parenthesis_Name
+ | Iir_Kind_Error =>
return;
when others =>
Error_Kind ("check_read", Obj);