aboutsummaryrefslogtreecommitdiffstats
path: root/src/simulate/simulation-ams-debugger.adb
blob: 9cdbc75b28d5be632fd5c016eb87332c88d0da54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
--  Interpreter AMS simulation
--  Copyright (C) 2014 Tristan Gingold
--
--  GHDL 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, or (at your option) any later
--  version.
--
--  GHDL 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 GHDL; see the file COPYING.  If not, write to the Free
--  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
--  02111-1307, USA.

with Debugger; use Debugger;
with Iirs_Utils; use Iirs_Utils;
with Ada.Text_IO; use Ada.Text_IO;
with Disp_Vhdl;

package body Simulation.AMS.Debugger is
   procedure Disp_Quantity_Name (Quantity : Quantity_Index_Type)
   is
      Obj : Scalar_Quantity renames Scalar_Quantities.Table (Quantity);
   begin
      Disp_Instance_Name (Obj.Instance, True);
      Put ('.');
      Put (Image_Identifier (Obj.Decl));
      if Obj.Kind = Quantity_Reference then
         Put ("'Ref");
      end if;
   end Disp_Quantity_Name;

   procedure Disp_Term (Term : Ams_Term_Acc) is
   begin
      case Term.Sign is
         when Op_Plus =>
            Put (" + ");
         when Op_Minus =>
            Put (" - ");
      end case;

      case Term.Op is
         when Op_Quantity =>
            Disp_Quantity_Name (Term.Quantity);
         when Op_Vhdl_Expr =>
            Disp_Vhdl.Disp_Expression (Term.Vhdl_Expr);
      end case;
   end Disp_Term;

   procedure Disp_Characteristic_Expression
     (Ce : Characteristic_Expressions_Index)
   is
      Obj : Characteristic_Expr renames
        Characteristic_Expressions.Table (Ce);
      Expr : Ams_Term_Acc := Obj.Expr;
   begin
      case Obj.Kind is
         when Explicit =>
            Put ("Explic:");
         when Contribution =>
            Put ("Contri:");
         when Structural =>
            Put ("Struct:");
      end case;

      while Expr /= null loop
         Disp_Term (Expr);
         Expr := Expr.Next;
      end loop;
      New_Line;
   end Disp_Characteristic_Expression;

   procedure Disp_Characteristic_Expressions is
   begin
      Put_Line ("Characteristic expressions:");
      for I in Characteristic_Expressions.First
        .. Characteristic_Expressions.Last
      loop
         Disp_Characteristic_Expression (I);
      end loop;
   end Disp_Characteristic_Expressions;
end Simulation.AMS.Debugger;