diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-12-13 19:09:44 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-12-13 19:09:44 +0100 |
commit | 8d75953b65e81e404ea193b8994c638b5a8c470d (patch) | |
tree | 35478e6c539c19c79ae276a134d5ac59ad127667 /src/ghdldrv/ghdlsynth.adb | |
parent | 6bcba53d0fc8d4e6e168470ecb8216bbb87534ca (diff) | |
download | ghdl-8d75953b65e81e404ea193b8994c638b5a8c470d.tar.gz ghdl-8d75953b65e81e404ea193b8994c638b5a8c470d.tar.bz2 ghdl-8d75953b65e81e404ea193b8994c638b5a8c470d.zip |
ghdldrv: handle generic overrides on foreign units
Diffstat (limited to 'src/ghdldrv/ghdlsynth.adb')
-rw-r--r-- | src/ghdldrv/ghdlsynth.adb | 33 |
1 files changed, 19 insertions, 14 deletions
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; |