diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-07-21 21:28:17 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-07-22 07:32:57 +0200 |
commit | f8b99802f4ac7057e15bf23cb9fa37955d75abb4 (patch) | |
tree | 6c9586ccae5672064d1ed6b7bfa9b8f08b28ff2d /src/ghdldrv/ghdlsynth.adb | |
parent | 1bbec5cda2fcebd9190b1cdb05a102f40dee87c3 (diff) | |
download | ghdl-f8b99802f4ac7057e15bf23cb9fa37955d75abb4.tar.gz ghdl-f8b99802f4ac7057e15bf23cb9fa37955d75abb4.tar.bz2 ghdl-f8b99802f4ac7057e15bf23cb9fa37955d75abb4.zip |
synth: minor rework.
Diffstat (limited to 'src/ghdldrv/ghdlsynth.adb')
-rw-r--r-- | src/ghdldrv/ghdlsynth.adb | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/ghdldrv/ghdlsynth.adb b/src/ghdldrv/ghdlsynth.adb index 861a9eb66..6c5c7378f 100644 --- a/src/ghdldrv/ghdlsynth.adb +++ b/src/ghdldrv/ghdlsynth.adb @@ -90,7 +90,9 @@ package body Ghdlsynth is end if; end Decode_Option; - function Ghdl_Synth (Args : Argument_List) return Module + -- Init, analyze and configure. + -- Return the top configuration. + function Ghdl_Synth_Configure (Args : Argument_List) return Node is use Vhdl.Errors; use Vhdl.Configuration; @@ -135,13 +137,13 @@ package body Ghdlsynth is Top := Vhdl.Configuration.Find_Top_Entity (Libraries.Work_Library); if Top = Null_Node then Ghdlmain.Error ("no top unit found"); - return No_Module; + return Null_Iir; end if; Errorout.Report_Msg (Msgid_Note, Option, No_Source_Coord, "top entity is %i", (1 => +Top)); if Nbr_Errors > 0 then -- No need to configure if there are missing units. - return No_Module; + return Null_Iir; end if; Prim_Id := Get_Identifier (Top); Sec_Id := Null_Identifier; @@ -150,7 +152,7 @@ package body Ghdlsynth is Prim_Id, Sec_Id); if Opt_Arg <= Args'Last then Ghdlmain.Error ("extra options ignored"); - return No_Module; + return Null_Iir; end if; end if; @@ -158,20 +160,18 @@ package body Ghdlsynth is if Nbr_Errors > 0 then -- No need to configure if there are missing units. - return No_Module; + return Null_Iir; end if; -- Check (and possibly abandon) if entity can be at the top of the -- hierarchy. declare - Conf_Unit : constant Iir := Get_Library_Unit (Config); - Arch : constant Iir := Get_Named_Entity - (Get_Block_Specification (Get_Block_Configuration (Conf_Unit))); - Entity : constant Iir := Vhdl.Utils.Get_Entity (Arch); + Entity : constant Iir := + Vhdl.Utils.Get_Entity_From_Configuration (Config); begin Vhdl.Configuration.Check_Entity_Declaration_Top (Entity, False); if Nbr_Errors > 0 then - return No_Module; + return Null_Iir; end if; end; @@ -181,6 +181,19 @@ package body Ghdlsynth is Vhdl.Annotations.Annotate (Design_Units.Table (I)); end loop; + return Config; + end Ghdl_Synth_Configure; + + function Ghdl_Synth (Args : Argument_List) return Module + is + Config : Node; + begin + Config := Ghdl_Synth_Configure (Args); + + if Config = Null_Iir then + return No_Module; + end if; + return Synthesis.Synth_Design (Config); end Ghdl_Synth; |