diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ghdldrv/ghdlsynth.adb | 3 | ||||
-rw-r--r-- | src/synth/synth-debugger.adb | 33 | ||||
-rw-r--r-- | src/synth/synth-debugger.ads | 31 | ||||
-rw-r--r-- | src/synth/synth-flags.ads | 2 | ||||
-rw-r--r-- | src/synth/synth-insts.adb | 5 | ||||
-rw-r--r-- | src/synth/synth-stmts.adb | 4 |
6 files changed, 78 insertions, 0 deletions
diff --git a/src/ghdldrv/ghdlsynth.adb b/src/ghdldrv/ghdlsynth.adb index 0795fcf6e..1523ab51c 100644 --- a/src/ghdldrv/ghdlsynth.adb +++ b/src/ghdldrv/ghdlsynth.adb @@ -117,6 +117,9 @@ package body Ghdlsynth is elsif Option = "-t" then Flag_Trace_Statements := True; Res := Option_Ok; + elsif Option = "-i" then + Flag_Debug_Init := True; + Res := Option_Ok; else Decode_Option (Command_Lib (Cmd), Option, Arg, Res); end if; 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 => |