diff options
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/translate/ortho_front.adb | 32 | ||||
-rw-r--r-- | src/vhdl/vhdl-configuration.adb | 14 | ||||
-rw-r--r-- | src/vhdl/vhdl-configuration.ads | 3 |
3 files changed, 38 insertions, 11 deletions
diff --git a/src/vhdl/translate/ortho_front.adb b/src/vhdl/translate/ortho_front.adb index 8823705bb..a1364a243 100644 --- a/src/vhdl/translate/ortho_front.adb +++ b/src/vhdl/translate/ortho_front.adb @@ -58,9 +58,9 @@ package body Ortho_Front is ); Action : Action_Type := Action_Compile; - -- Name of the entity to elaborate. + -- Name of the library/entity/architecture to elaborate. + Elab_Library : Name_Id; Elab_Entity : Name_Id; - -- Name of the architecture to elaborate. Elab_Architecture : Name_Id; -- Filename for the list of files to link. Elab_Filelist : String_Acc; @@ -90,13 +90,16 @@ package body Ortho_Front is Options.Initialize; Elab_Filelist := null; + Elab_Library := Null_Identifier; Elab_Entity := Null_Identifier; Elab_Architecture := Null_Identifier; Flag_Expect_Failure := False; end Init; function Decode_Elab_Option (Arg : String_Acc; Cmd : String) - return Natural is + return Natural + is + Dot : Natural; begin Elab_Architecture := Null_Identifier; -- Entity (+ architecture) to elaborate @@ -105,6 +108,19 @@ package body Ortho_Front is ("entity or configuration name required after " & Cmd); return 0; end if; + + Dot := Arg'First - 1; + if Arg (Arg'First) /= '\' then + for I in Arg'Range loop + if Arg (I) = '.' then + Dot := I; + Elab_Library := + Name_Table.Get_Identifier (Arg (Arg'First .. I - 1)); + exit; + end if; + end loop; + end if; + if Arg (Arg.all'Last) = ')' then -- Name is ENTITY(ARCH). -- Split. @@ -128,7 +144,7 @@ package body Ortho_Front is Is_Ext := False; end if; loop - if P = Arg.all'First then + if P = Dot + 1 then Error_Msg_Option ("ill-formed name after " & Cmd); return 0; end if; @@ -150,10 +166,10 @@ package body Ortho_Front is Elab_Architecture := Name_Table.Get_Identifier (Arg (P + 1 .. Arg'Last - 1)); Elab_Entity := - Name_Table.Get_Identifier (Arg (Arg'First .. P - 1)); + Name_Table.Get_Identifier (Arg (Dot + 1 .. P - 1)); end; else - Elab_Entity := Name_Table.Get_Identifier (Arg.all); + Elab_Entity := Name_Table.Get_Identifier (Arg (Dot + 1 .. Arg'Last)); Elab_Architecture := Null_Identifier; end if; return 2; @@ -567,7 +583,7 @@ package body Ortho_Front is Shlib_Interning.Init; Config := Vhdl.Configuration.Configure - (Elab_Entity, Elab_Architecture); + (Elab_Library, Elab_Entity, Elab_Architecture); if Errorout.Nbr_Errors > 0 then -- This may happen (bad entity for example). raise Compilation_Error; @@ -626,7 +642,7 @@ package body Ortho_Front is Flags.Flag_Elaborate := True; Flags.Flag_Only_Elab_Warnings := False; Config := Vhdl.Configuration.Configure - (Elab_Entity, Elab_Architecture); + (Elab_Library, Elab_Entity, Elab_Architecture); Translation.Elaborate (Config, True); if Errorout.Nbr_Errors > 0 then diff --git a/src/vhdl/vhdl-configuration.adb b/src/vhdl/vhdl-configuration.adb index 395888d69..ad086cd3d 100644 --- a/src/vhdl/vhdl-configuration.adb +++ b/src/vhdl/vhdl-configuration.adb @@ -638,16 +638,26 @@ package body Vhdl.Configuration is -- corresponding configurations. -- -- Return the configuration declaration for the design. - function Configure (Primary_Id : Name_Id; Secondary_Id : Name_Id) + function Configure + (Library_Id: Name_Id; Primary_Id : Name_Id; Secondary_Id : Name_Id) return Iir is use Libraries; + Library : Iir; Unit : Iir_Design_Unit; Lib_Unit : Iir; Top : Iir; begin - Unit := Find_Primary_Unit (Work_Library, Primary_Id); + if Library_Id /= Null_Identifier then + Library := Get_Library (Library_Id, Command_Line_Location); + if Library = Null_Iir then + return Null_Iir; + end if; + else + Library := Work_Library; + end if; + Unit := Find_Primary_Unit (Library, Primary_Id); if Unit = Null_Iir then Error_Msg_Elab ("cannot find entity or configuration " & Name_Table.Image (Primary_Id)); diff --git a/src/vhdl/vhdl-configuration.ads b/src/vhdl/vhdl-configuration.ads index c9fd50850..1abff5057 100644 --- a/src/vhdl/vhdl-configuration.ads +++ b/src/vhdl/vhdl-configuration.ads @@ -33,7 +33,8 @@ package Vhdl.Configuration is -- creates a list of design unit. -- and return the top configuration. -- Note: this set the Elab_Flag on units. - function Configure (Primary_Id : Name_Id; Secondary_Id : Name_Id) + function Configure + (Library_Id : Name_Id; Primary_Id : Name_Id; Secondary_Id : Name_Id) return Iir; -- Add design unit UNIT (with its dependences) in the design_units table. |