diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ghdldrv/ghdlsynth.adb | 33 | ||||
-rw-r--r-- | src/vhdl/vhdl-utils.adb | 10 | ||||
-rw-r--r-- | src/vhdl/vhdl-utils.ads | 4 |
3 files changed, 37 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; diff --git a/src/vhdl/vhdl-utils.adb b/src/vhdl/vhdl-utils.adb index 43b3a8d92..1c0a39b4a 100644 --- a/src/vhdl/vhdl-utils.adb +++ b/src/vhdl/vhdl-utils.adb @@ -1570,6 +1570,16 @@ package body Vhdl.Utils is end case; end Get_Entity_From_Entity_Aspect; + function Get_Entity_From_Configuration (Config : Iir) return Iir + is + 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); + begin + return Entity; + end Get_Entity_From_Configuration; + function Is_Nested_Package (Pkg : Iir) return Boolean is begin return Get_Kind (Get_Parent (Pkg)) /= Iir_Kind_Design_Unit; diff --git a/src/vhdl/vhdl-utils.ads b/src/vhdl/vhdl-utils.ads index e8b713799..e80135f04 100644 --- a/src/vhdl/vhdl-utils.ads +++ b/src/vhdl/vhdl-utils.ads @@ -348,6 +348,10 @@ package Vhdl.Utils is -- if ASPECT is open, return Null_Iir; function Get_Entity_From_Entity_Aspect (Aspect : Iir) return Iir; + -- Return the corresponding entity declaration from top-level configuration + -- design unit CONFIG. + function Get_Entity_From_Configuration (Config : Iir) return Iir; + -- Definition from LRM08 4.8 Package bodies -- True if PKG (a package declaration or a package body) is not a library -- unit. Can be true only for vhdl08. |