aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/simulate/simul-debugger-ams.adb
blob: b7760cbf60500c1bae7e51e42f52e055b2b405e4 (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
--  Interpreter AMS simulation
--  Copyright (C) 2014 Tristan Gingold
--
--  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, see <gnu.org/licenses>.

with Simple_IO; use Simple_IO;
with Vhdl.Utils; use Vhdl.Utils;
with Vhdl.Prints;

package body Simul.Debugger.AMS 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 =>
            Vhdl.Prints.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 Simul.Debugger.AMS;