aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2019-11-20 07:40:25 +0100
committerTristan Gingold <tgingold@free.fr>2019-11-20 18:29:51 +0100
commit01b133bc895d91e096ae054b5d02c1e6e54ec2e1 (patch)
tree8a0e14727a459a4be4b6e1581446af8a12f0f0a3 /src/synth
parent65abd669b8cdeff955a5c4264c99a97110cd8a93 (diff)
downloadghdl-01b133bc895d91e096ae054b5d02c1e6e54ec2e1.tar.gz
ghdl-01b133bc895d91e096ae054b5d02c1e6e54ec2e1.tar.bz2
ghdl-01b133bc895d91e096ae054b5d02c1e6e54ec2e1.zip
synth: infrastructure for debugger.
Diffstat (limited to 'src/synth')
-rw-r--r--src/synth/synth-debugger.adb33
-rw-r--r--src/synth/synth-debugger.ads31
-rw-r--r--src/synth/synth-flags.ads2
-rw-r--r--src/synth/synth-insts.adb5
-rw-r--r--src/synth/synth-stmts.adb4
5 files changed, 75 insertions, 0 deletions
diff --git a/src/synth/synth-debugger.adb b/src/synth/synth-debugger.adb
new file mode 100644
index 000000000..cd1b16c70
--- /dev/null
+++ b/src/synth/synth-debugger.adb
@@ -0,0 +1,33 @@
+-- Debugging during synthesis (not enabled).
+-- Copyright (C) 2019 Tristan Gingold
+--
+-- This file is part of GHDL.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+-- MA 02110-1301, USA.
+
+with Types; use Types;
+
+package body Synth.Debugger is
+ procedure Debug_Init is
+ begin
+ null;
+ end Debug_Init;
+
+ procedure Debug_Break (Inst : Synth_Instance_Acc; Stmt : Node) is
+ begin
+ raise Internal_Error;
+ end Debug_Break;
+end Synth.Debugger;
diff --git a/src/synth/synth-debugger.ads b/src/synth/synth-debugger.ads
new file mode 100644
index 000000000..b993cd3e1
--- /dev/null
+++ b/src/synth/synth-debugger.ads
@@ -0,0 +1,31 @@
+-- Debugging during synthesis.
+-- Copyright (C) 2019 Tristan Gingold
+--
+-- This file is part of GHDL.
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+-- MA 02110-1301, USA.
+
+with Vhdl.Nodes; use Vhdl.Nodes;
+
+with Synth.Context; use Synth.Context;
+
+package Synth.Debugger is
+ -- If true, call Debug() before executing the next sequential statement.
+ Flag_Need_Debug : Boolean := False;
+
+ procedure Debug_Init;
+ procedure Debug_Break (Inst : Synth_Instance_Acc; Stmt : Node);
+end Synth.Debugger;
diff --git a/src/synth/synth-flags.ads b/src/synth/synth-flags.ads
index 4a85cb09a..c3ef0fda3 100644
--- a/src/synth/synth-flags.ads
+++ b/src/synth/synth-flags.ads
@@ -28,4 +28,6 @@ package Synth.Flags is
Flag_Debug_Noexpand : Boolean := False;
Flag_Trace_Statements : Boolean := False;
+
+ Flag_Debug_Init : Boolean := False;
end Synth.Flags;
diff --git a/src/synth/synth-insts.adb b/src/synth/synth-insts.adb
index 19d51e997..d2f5aea23 100644
--- a/src/synth/synth-insts.adb
+++ b/src/synth/synth-insts.adb
@@ -45,6 +45,7 @@ with Synth.Stmts; use Synth.Stmts;
with Synth.Decls; use Synth.Decls;
with Synth.Expr; use Synth.Expr;
with Synth.Source; use Synth.Source;
+with Synth.Debugger;
package body Synth.Insts is
Root_Instance : Synth_Instance_Acc;
@@ -960,6 +961,10 @@ package body Synth.Insts is
begin
Root_Instance := Global_Instance;
+ if Flags.Flag_Debug_Init then
+ Synth.Debugger.Debug_Init;
+ end if;
+
-- Dependencies first.
Synth_Dependencies (Global_Instance, Get_Design_Unit (Entity));
Synth_Dependencies (Global_Instance, Get_Design_Unit (Arch));
diff --git a/src/synth/synth-stmts.adb b/src/synth/synth-stmts.adb
index de4bbb7cb..59b3a5136 100644
--- a/src/synth/synth-stmts.adb
+++ b/src/synth/synth-stmts.adb
@@ -49,6 +49,7 @@ with Synth.Source;
with Synth.Static_Proc;
with Synth.Heap;
with Synth.Flags;
+with Synth.Debugger;
with Netlists.Builders; use Netlists.Builders;
with Netlists.Gates;
@@ -2009,6 +2010,9 @@ package body Synth.Stmts is
& Natural'Image (Line));
end;
end if;
+ if Synth.Debugger.Flag_Need_Debug then
+ Synth.Debugger.Debug_Break (C.Inst, Stmt);
+ end if;
case Get_Kind (Stmt) is
when Iir_Kind_If_Statement =>