diff options
Diffstat (limited to 'src/ghdldrv')
-rw-r--r-- | src/ghdldrv/ghdllocal.adb | 17 | ||||
-rw-r--r-- | src/ghdldrv/ghdlsynth.adb | 33 |
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; |