aboutsummaryrefslogtreecommitdiffstats
path: root/src/grt/grt-waves.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-03-07 05:50:08 +0100
committerTristan Gingold <tgingold@free.fr>2017-03-09 20:42:57 +0100
commit101dd876888f9531cea6657e63706cb43d7c7a67 (patch)
tree18718838c39f7985bcbf3c9842f31ab79ca5d735 /src/grt/grt-waves.adb
parent0b7ccf5869d61528d1a7dbb4fed98b0e300bc7a3 (diff)
downloadghdl-101dd876888f9531cea6657e63706cb43d7c7a67.tar.gz
ghdl-101dd876888f9531cea6657e63706cb43d7c7a67.tar.bz2
ghdl-101dd876888f9531cea6657e63706cb43d7c7a67.zip
Add start_of_processes callback, used by grt-waves
Fix #300
Diffstat (limited to 'src/grt/grt-waves.adb')
-rw-r--r--src/grt/grt-waves.adb19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/grt/grt-waves.adb b/src/grt/grt-waves.adb
index 8e2751268..025f2195e 100644
--- a/src/grt/grt-waves.adb
+++ b/src/grt/grt-waves.adb
@@ -22,17 +22,18 @@
-- 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; use System;
with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
with Interfaces; use Interfaces;
-with System.Storage_Elements; -- Work around GNAT bug.
-pragma Unreferenced (System.Storage_Elements);
with Grt.Types; use Grt.Types;
with Grt.Avhpi; use Grt.Avhpi;
with Grt.Stdio; use Grt.Stdio;
with Grt.C; use Grt.C;
with Grt.Errors; use Grt.Errors;
with Grt.Astdio; use Grt.Astdio;
+with Grt.Callbacks; use Grt.Callbacks;
with Grt.Hooks; use Grt.Hooks;
with Grt.Table;
with Grt.Avls; use Grt.Avls;
@@ -41,7 +42,6 @@ with Grt.Rtis_Addr; use Grt.Rtis_Addr;
with Grt.Rtis_Utils;
with Grt.Rtis_Types;
with Grt.Signals; use Grt.Signals;
-with System; use System;
with Grt.Vstrings; use Grt.Vstrings;
with Grt.Ghw; use Grt.Ghw;
with Grt.Wave_Opt; use Grt.Wave_Opt;
@@ -1573,12 +1573,20 @@ package body Grt.Waves is
Wave_Put ("ESN" & NUL);
end Write_Snapshot;
+ procedure Wave_Start_Cb (Arg : System.Address)
+ is
+ pragma Unreferenced (Arg);
+ begin
+ Write_Snapshot;
+ end Wave_Start_Cb;
+
procedure Wave_Cycle;
-- Called after elaboration.
procedure Wave_Start
is
Root : VhpiHandleT;
+ H : Callback_Handle;
begin
-- Do nothing if there is no VCD file to generate.
if Wave_Stream = NULL_Stream then
@@ -1615,7 +1623,10 @@ package body Grt.Waves is
-- End of header mark.
Wave_Section ("EOH" & NUL);
- Write_Snapshot;
+ -- Write the first snapshot just before running processes for the first
+ -- time. At that point, signals are fully initialized.
+ Register_Callback (Cb_Start_Of_Processes, H, Oneshot,
+ Wave_Start_Cb'Access);
Register_Cycle_Hook (Wave_Cycle'Access);