aboutsummaryrefslogtreecommitdiffstats
path: root/src/synth/synth-vhdl_environment.ads
blob: e9bf6129f93de275ddc5abf7b783636bd6bb80a1 (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
--  Environment definition for synthesis.
--  Copyright (C) 2017 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, see <gnu.org/licenses>.

with Types; use Types;

with Netlists; use Netlists;
with Netlists.Builders;

with Vhdl.Nodes;

with Synth.Environment;
with Synth.Environment.Debug;
with Synth.Objtypes; use Synth.Objtypes;
-- with Synth_Vhdl.Context;

package Synth.Vhdl_Environment is

   type Decl_Type is record
      Obj : Vhdl.Nodes.Node;
      Typ : Type_Acc;
   end record;

   function Get_Bitwidth (Val : Memtyp) return Uns32;

   function Memtyp_To_Net (Ctxt : Builders.Context_Acc; Val : Memtyp)
                          return Net;

   function Partial_Memtyp_To_Net
     (Ctxt : Builders.Context_Acc; Val : Memtyp; Off : Uns32; Wd : Uns32)
     return Net;

   procedure Warning_No_Assignment
     (Decl : Decl_Type; First_Off : Uns32; Last_Off : Uns32);

   procedure Error_Multiple_Assignments
     (Decl : Decl_Type; First_Off : Uns32; Last_Off : Uns32);

   package Env is new Synth.Environment
     (Decl_Type => Decl_Type,
      Static_Type => Standard.Synth.Objtypes.Memtyp,
      Get_Width => Get_Bitwidth,
      Is_Equal => Is_Equal,
      Static_To_Net => Memtyp_To_Net,
      Partial_Static_To_Net => Partial_Memtyp_To_Net,
      Warning_No_Assignment => Warning_No_Assignment,
      Error_Multiple_Assignments => Error_Multiple_Assignments);
--      "+" => Vhdl.Nodes.Get_Location);

   package Debug is new Env.Debug;
end Synth.Vhdl_Environment;