diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-12-02 21:18:37 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-12-02 21:18:37 +0100 |
commit | e6a643ea1db47dc5fcf3893a81b3193869edbc38 (patch) | |
tree | 9b72a932ffb8f43a4900a5098296fff22b120048 /src/ghdldrv | |
parent | d11ad2282157564dad9e53eccf9f2ec8a05bbda7 (diff) | |
download | ghdl-e6a643ea1db47dc5fcf3893a81b3193869edbc38.tar.gz ghdl-e6a643ea1db47dc5fcf3893a81b3193869edbc38.tar.bz2 ghdl-e6a643ea1db47dc5fcf3893a81b3193869edbc38.zip |
synth: support multiple synthesis.
Diffstat (limited to 'src/ghdldrv')
-rw-r--r-- | src/ghdldrv/ghdlsynth.adb | 47 | ||||
-rw-r--r-- | src/ghdldrv/ghdlsynth.ads | 5 |
2 files changed, 34 insertions, 18 deletions
diff --git a/src/ghdldrv/ghdlsynth.adb b/src/ghdldrv/ghdlsynth.adb index 856fb2cc8..faa92a6f1 100644 --- a/src/ghdldrv/ghdlsynth.adb +++ b/src/ghdldrv/ghdlsynth.adb @@ -131,7 +131,8 @@ package body Ghdlsynth is -- Init, analyze and configure. -- Return the top configuration. - function Ghdl_Synth_Configure (Args : Argument_List) return Node + function Ghdl_Synth_Configure (Init : Boolean; Args : Argument_List) + return Node is use Vhdl.Errors; use Vhdl.Configuration; @@ -153,20 +154,23 @@ package body Ghdlsynth is end if; end loop; - Vhdl.Annotations.Flag_Synthesis := True; - Vhdl.Scanner.Flag_Comment_Keyword := True; - Vhdl.Scanner.Flag_Pragma_Comment := True; + if Init then + Vhdl.Annotations.Flag_Synthesis := True; + Vhdl.Scanner.Flag_Comment_Keyword := True; + Vhdl.Scanner.Flag_Pragma_Comment := True; - Common_Compile_Init (False); - -- Will elaborate. - Flags.Flag_Elaborate := True; - Flags.Flag_Elaborate_With_Outdated := E_Opt >= Args'First; + Common_Compile_Init (False); + -- Will elaborate. + Flags.Flag_Elaborate := True; - -- Load content only if there are no files. - Libraries.Load_Work_Library (E_Opt >= Args'First); + -- Load content only if there are no files. + Libraries.Load_Work_Library (E_Opt >= Args'First); - -- Do not canon concurrent statements. - Vhdl.Canon.Canon_Flag_Concurrent_Stmts := False; + -- Do not canon concurrent statements. + Vhdl.Canon.Canon_Flag_Concurrent_Stmts := False; + end if; + + Flags.Flag_Elaborate_With_Outdated := E_Opt >= Args'First; -- Analyze files (if any) for I in Args'First .. E_Opt - 1 loop @@ -239,6 +243,7 @@ package body Ghdlsynth is end; -- Annotate all units. + Vhdl.Annotations.Initialize_Annotate; Vhdl.Annotations.Annotate (Vhdl.Std_Package.Std_Standard_Unit); for I in Design_Units.First .. Design_Units.Last loop Vhdl.Annotations.Annotate (Design_Units.Table (I)); @@ -247,9 +252,11 @@ package body Ghdlsynth is return Config; end Ghdl_Synth_Configure; - function Ghdl_Synth (Argc : Natural; Argv : C_String_Array_Acc) - return Module + function Ghdl_Synth + (Init : Natural; Argc : Natural; Argv : C_String_Array_Acc) + return Module is + use Vhdl.Configuration; Args : Argument_List (1 .. Argc); Res : Module; Cmd : Command_Acc; @@ -270,12 +277,20 @@ package body Ghdlsynth is Decode_Command_Options ("--synth", Cmd, Args, First_Arg); -- Do the real work! - Config := Ghdl_Synth_Configure (Args (First_Arg .. Args'Last)); + Config := Ghdl_Synth_Configure + (Init /= 0, Args (First_Arg .. Args'Last)); if Config = Null_Iir then return No_Module; end if; Synthesis.Synth_Design (Config, Res, Inst); + + for I in Design_Units.First .. Design_Units.Last loop + Set_Elab_Flag (Design_Units.Table (I), False); + end loop; + + Vhdl.Annotations.Finalize_Annotate; + Synth.Context.Free_Base_Instance; return Res; exception @@ -295,7 +310,7 @@ package body Ghdlsynth is Config : Iir; Ent : Iir; begin - Config := Ghdl_Synth_Configure (Args); + Config := Ghdl_Synth_Configure (True, Args); if Config = Null_Iir then raise Errorout.Compilation_Error; diff --git a/src/ghdldrv/ghdlsynth.ads b/src/ghdldrv/ghdlsynth.ads index b4ad92b86..8d36faebc 100644 --- a/src/ghdldrv/ghdlsynth.ads +++ b/src/ghdldrv/ghdlsynth.ads @@ -28,6 +28,7 @@ package Ghdlsynth is type C_String_Array is array (Natural) of Ghdl_C_String; type C_String_Array_Acc is access C_String_Array; - function Ghdl_Synth (Argc : Natural; Argv : C_String_Array_Acc) - return Module; + function Ghdl_Synth + (Init : Natural; Argc : Natural; Argv : C_String_Array_Acc) + return Module; end Ghdlsynth; |