aboutsummaryrefslogtreecommitdiffstats
path: root/src/ghdldrv
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-12-13 19:09:44 +0100
committerTristan Gingold <tgingold@free.fr>2021-12-13 19:09:44 +0100
commit8d75953b65e81e404ea193b8994c638b5a8c470d (patch)
tree35478e6c539c19c79ae276a134d5ac59ad127667 /src/ghdldrv
parent6bcba53d0fc8d4e6e168470ecb8216bbb87534ca (diff)
downloadghdl-8d75953b65e81e404ea193b8994c638b5a8c470d.tar.gz
ghdl-8d75953b65e81e404ea193b8994c638b5a8c470d.tar.bz2
ghdl-8d75953b65e81e404ea193b8994c638b5a8c470d.zip
ghdldrv: handle generic overrides on foreign units
Diffstat (limited to 'src/ghdldrv')
-rw-r--r--src/ghdldrv/ghdllocal.adb17
-rw-r--r--src/ghdldrv/ghdlsynth.adb33
2 files changed, 21 insertions, 29 deletions
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb
index 4e0b0b05b..722c1a26f 100644
--- a/src/ghdldrv/ghdllocal.adb
+++ b/src/ghdldrv/ghdllocal.adb
@@ -86,7 +86,6 @@ package body Ghdllocal is
pragma Assert (Opt'First = 1);
pragma Assert (Opt'Last >= 5);
Eq_Pos : Natural;
- Id : Name_Id;
begin
Eq_Pos := 0;
for I in 3 .. Opt'Last loop
@@ -106,21 +105,9 @@ package body Ghdllocal is
return Option_Err;
end if;
- declare
- Res : String (1 .. Eq_Pos - 3) := Opt (3 .. Eq_Pos - 1);
- Err : Boolean;
- begin
- Vhdl.Scanner.Convert_Identifier (Res, Err);
- if Err then
- Error_Msg_Option
- ("incorrect generic name in generic override option");
- return Option_Err;
- end if;
- Id := Name_Table.Get_Identifier (Res);
- end;
-
Vhdl.Configuration.Add_Generic_Override
- (Id, Opt (Eq_Pos + 1 .. Opt'Last));
+ (Opt (3 .. Eq_Pos - 1), Opt (Eq_Pos + 1 .. Opt'Last));
+
return Option_Ok;
end Decode_Generic_Override_Option;
diff --git a/src/ghdldrv/ghdlsynth.adb b/src/ghdldrv/ghdlsynth.adb
index cfc5f281b..ced5b71c9 100644
--- a/src/ghdldrv/ghdlsynth.adb
+++ b/src/ghdldrv/ghdlsynth.adb
@@ -378,20 +378,25 @@ package body Ghdlsynth is
Foreign_Resolve_Instances.all;
end if;
- if Get_Kind (Get_Library_Unit (Config)) /= Iir_Kind_Foreign_Module then
- -- Check (and possibly abandon) if entity can be at the top of the
- -- hierarchy.
- declare
- Entity : constant Iir :=
- Vhdl.Utils.Get_Entity_From_Configuration (Config);
- begin
- Vhdl.Configuration.Apply_Generic_Override (Entity);
- Vhdl.Configuration.Check_Entity_Declaration_Top (Entity, False);
- if Nbr_Errors > 0 then
- return Null_Iir;
- end if;
- end;
- end if;
+ -- Check (and possibly abandon) if entity can be at the top of the
+ -- hierarchy.
+ declare
+ Config_Unit : constant Iir := Get_Library_Unit (Config);
+ Top : Iir;
+ begin
+ if Get_Kind (Config_Unit) = Iir_Kind_Foreign_Module then
+ Top := Config_Unit;
+ Vhdl.Configuration.Apply_Generic_Override (Top);
+ -- No Check_Entity_Declaration (yet).
+ else
+ Top := Vhdl.Utils.Get_Entity_From_Configuration (Config);
+ Vhdl.Configuration.Apply_Generic_Override (Top);
+ Vhdl.Configuration.Check_Entity_Declaration_Top (Top, False);
+ end if;
+ if Nbr_Errors > 0 then
+ return Null_Iir;
+ end if;
+ end;
return Config;
end Ghdl_Synth_Configure;