diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-12-18 19:12:57 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-12-20 20:58:40 +0100 |
commit | 6bc6e9b69843f897bf43002c8da58e513db7b6e3 (patch) | |
tree | 894d8ec73c06f977dba69975a3cf472af7b4bb8e /src/grt/grt-main.adb | |
parent | 9db20e133d5c47f8d54710c2676792337cc94f54 (diff) | |
download | ghdl-6bc6e9b69843f897bf43002c8da58e513db7b6e3.tar.gz ghdl-6bc6e9b69843f897bf43002c8da58e513db7b6e3.tar.bz2 ghdl-6bc6e9b69843f897bf43002c8da58e513db7b6e3.zip |
grt: reorganize simulation loop.
Diffstat (limited to 'src/grt/grt-main.adb')
-rw-r--r-- | src/grt/grt-main.adb | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/src/grt/grt-main.adb b/src/grt/grt-main.adb index 6fae4c871..44abf5439 100644 --- a/src/grt/grt-main.adb +++ b/src/grt/grt-main.adb @@ -22,11 +22,9 @@ -- covered by the GNU General Public License. This exception does not -- however invalidate any other reasons why the executable file might be -- covered by the GNU Public License. -with System.Storage_Elements; -- Work around GNAT bug. -pragma Unreferenced (System.Storage_Elements); with Grt.Types; use Grt.Types; with Grt.Stdio; -with Grt.Errors; +with Grt.Errors; use Grt.Errors; with Grt.Processes; with Grt.Signals; with Grt.Options; use Grt.Options; @@ -105,11 +103,7 @@ package body Grt.Main is end if; end Check_Flag_String; - procedure Run - is - use Grt.Errors; - Stop : Boolean; - Status : Integer; + procedure Run_Elab (Stop : out Boolean) is begin -- Set stream for error messages Grt.Errors.Set_Error_Stream (Grt.Stdio.stdout); @@ -149,6 +143,7 @@ package body Grt.Main is -- Elaboration. Run through longjump to catch errors. if Run_Through_Longjump (Ghdl_Elaborate_Wrapper'Access) < 0 then Grt.Errors.Error ("error during elaboration"); + Stop := True; return; end if; @@ -173,11 +168,23 @@ package body Grt.Main is if Disp_Sensitivity then Grt.Disp_Signals.Disp_All_Sensitivity; end if; + end if; - -- Do the simulation. - Status := Run_Through_Longjump (Grt.Processes.Simulation'Access); + -- Can continue. + Stop := False; + end Run_Elab; + + function Run_Simul return Integer is + begin + if Flag_No_Run then + return 0; end if; + return Run_Through_Longjump (Grt.Processes.Simulation'Access); + end Run_Simul; + + procedure Run_Finish (Status : Integer) is + begin Grt.Hooks.Call_Finish_Hooks; if Flag_Stats then @@ -194,6 +201,21 @@ package body Grt.Main is Error ("simulation failed"); end if; end if; + end Run_Finish; + + procedure Run + is + Stop : Boolean; + Status : Integer; + begin + Run_Elab (Stop); + if Stop then + return; + end if; + + Status := Run_Simul; + + Run_Finish (Status); end Run; end Grt.Main; |