aboutsummaryrefslogtreecommitdiffstats
path: root/src/ghdldrv/ghdlsimul.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-06-29 03:38:15 +0200
committerTristan Gingold <tgingold@free.fr>2019-06-29 03:38:15 +0200
commite11afef1e7ffbf22bf0aaac0a7166b0aeee9fd2f (patch)
tree728b3fb552a982205563bb36242fc1f7aecfcfa0 /src/ghdldrv/ghdlsimul.adb
parentec43db0fb7543b62ab9d326e978cceb70defe58e (diff)
downloadghdl-e11afef1e7ffbf22bf0aaac0a7166b0aeee9fd2f.tar.gz
ghdl-e11afef1e7ffbf22bf0aaac0a7166b0aeee9fd2f.tar.bz2
ghdl-e11afef1e7ffbf22bf0aaac0a7166b0aeee9fd2f.zip
ghdldrv: refactoring - share more code, isolate ghdlsynth from ghdlsimul.
Diffstat (limited to 'src/ghdldrv/ghdlsimul.adb')
-rw-r--r--src/ghdldrv/ghdlsimul.adb60
1 files changed, 3 insertions, 57 deletions
diff --git a/src/ghdldrv/ghdlsimul.adb b/src/ghdldrv/ghdlsimul.adb
index a37424409..52408b067 100644
--- a/src/ghdldrv/ghdlsimul.adb
+++ b/src/ghdldrv/ghdlsimul.adb
@@ -24,13 +24,9 @@ with GNAT.OS_Lib; use GNAT.OS_Lib;
with Simple_IO;
with Types;
with Flags;
-with Name_Table;
-with Errorout; use Errorout;
with Vhdl.Std_Package;
-with Libraries;
with Vhdl.Canon;
with Vhdl.Configuration;
-with Vhdl.Utils;
with Simul.Annotations;
with Simul.Elaboration;
with Simul.Simulation.Main;
@@ -52,24 +48,11 @@ package body Ghdlsimul is
procedure Compile_Init (Analyze_Only : Boolean) is
begin
- if Analyze_Only then
- Setup_Libraries (True);
- else
- Setup_Libraries (False);
- Libraries.Load_Std_Library;
- -- WORK library is not loaded. FIXME: why ?
- end if;
-
- if Time_Resolution /= 'a' then
- Vhdl.Std_Package.Set_Time_Resolution (Time_Resolution);
- end if;
-
+ Common_Compile_Init (Analyze_Only);
if Analyze_Only then
return;
end if;
- Simul.Annotations.Annotate (Vhdl.Std_Package.Std_Standard_Unit);
-
Vhdl.Canon.Canon_Flag_Add_Labels := True;
Vhdl.Canon.Canon_Flag_Sequentials_Stmts := True;
Vhdl.Canon.Canon_Flag_Expressions := True;
@@ -79,49 +62,12 @@ package body Ghdlsimul is
procedure Compile_Elab
(Cmd_Name : String; Args : Argument_List; Opt_Arg : out Natural)
is
- use Name_Table;
- use Types;
use Vhdl.Configuration;
-
- First_Id : Name_Id;
- Sec_Id : Name_Id;
begin
- Extract_Elab_Unit (Cmd_Name, Args, Opt_Arg);
-
- Flags.Flag_Elaborate := True;
- -- Translation.Chap12.Elaborate (Prim_Name.all, Sec_Name.all, "", True);
-
- if Errorout.Nbr_Errors > 0 then
- -- This may happen (bad entity for example).
- raise Compilation_Error;
- end if;
-
- First_Id := Get_Identifier (Prim_Name.all);
- if Sec_Name = null then
- Sec_Id := Null_Identifier;
- else
- Sec_Id := Get_Identifier (Sec_Name.all);
- end if;
- Top_Conf := Vhdl.Configuration.Configure (First_Id, Sec_Id);
- if Top_Conf = Null_Iir then
- raise Compilation_Error;
- end if;
-
- -- Check (and possibly abandon) if entity can be at the top of the
- -- hierarchy.
- declare
- Conf_Unit : constant Iir := Get_Library_Unit (Top_Conf);
- Arch : constant Iir := Get_Named_Entity
- (Get_Block_Specification (Get_Block_Configuration (Conf_Unit)));
- Entity : constant Iir := Vhdl.Utils.Get_Entity (Arch);
- begin
- Vhdl.Configuration.Check_Entity_Declaration_Top (Entity);
- if Nbr_Errors > 0 then
- raise Compilation_Error;
- end if;
- end;
+ Common_Compile_Elab (Cmd_Name, Args, Opt_Arg, Top_Conf);
-- Annotate all units.
+ Simul.Annotations.Annotate (Vhdl.Std_Package.Std_Standard_Unit);
for I in Design_Units.First .. Design_Units.Last loop
Simul.Annotations.Annotate (Design_Units.Table (I));
end loop;