Project

General

Profile

Revision d77323b8 src/tools/importer/vhdl_deriving_yojson.ml

View differences:

src/tools/importer/vhdl_deriving_yojson.ml
2 2

  
3 3
type vhdl_type_t =
4 4
  | Base of string
5
  | Range of string option * int * int
5
  | Range of string option * int * int [@name "RANGE_WITH_DIRECTION"]
6 6
  | Bit_vector of int * int
7 7
  | Array of int * int * vhdl_type_t
8 8
  | Enumerated of string list
9
[@@deriving yojson {strict = false}];;
9
  | Void
10
[@@deriving yojson];;
10 11
  
11 12
(************************************************************************************)		   
12 13
(*                     Constants                                                    *)
......
28 29
type cst_val_t = CstInt of int | CstStdLogic of string
29 30
[@@deriving yojson {strict = false}];;
30 31

  
32
type vhdl_subtype_indication_t =
33
  {
34
    name : string;
35
    definition: vhdl_type_t option [@default Some (Void)];
36
  }
37
[@@deriving yojson {strict = false}];;
38

  
31 39
(* TODO ? Shall we merge definition / declaration  *)
32 40
type vhdl_definition_t =
33
  | Type of {name : string ; definition: vhdl_type_t} [@name "Type"]
34
  | Subtype of {name : string ; definition: vhdl_type_t} [@name "Subtype"]
41
  | Type of {name : string ; definition: vhdl_type_t} [@name "TYPE_DECLARATION"]
42
  | Subtype of {name : string ; typ : vhdl_subtype_indication_t} [@name "SUBTYPE_DECLARATION"]
35 43
[@@deriving yojson {strict = false}];;
36 44
					
37 45
type vhdl_declaration_t =
38
  | VarDecl of { name : string; typ : vhdl_type_t; init_val : cst_val_t option } [@name "VarDecl"]
39
  | CstDecl of { name : string; typ : vhdl_type_t; init_val : cst_val_t  } [@name "CstDecl"]
40
  | SigDecl of { name : string; typ : vhdl_type_t; init_val : cst_val_t option } [@name "SigDecl"]
46
  | VarDecl of { names : string list; typ : vhdl_subtype_indication_t; init_val : cst_val_t option [@default Some (CstInt (0))] } [@name "VARIABLE_DECLARATION"]
47
  | CstDecl of { names : string list; typ : vhdl_subtype_indication_t; init_val : cst_val_t  } [@name "CONSTANT_DECLARATION"]
48
  | SigDecl of { names : string list; typ : vhdl_subtype_indication_t; init_val : cst_val_t option [@default Some (CstInt (0))] } [@name "SIGNAL_DECLARATION"]
41 49
[@@deriving yojson {strict = false}];;
42 50

  
43 51
(************************************************************************************)		   
......
197 205
  {
198 206
    name: string [@default ""];
199 207
    entity: string [@default ""];
200
 (*   declarations: vhdl_declaration_t list option [@key "ARCHITECTURE_DECLARATIVE_PART"] [@default Some []];
201
    body: vhdl_concurrent_stmt_t list option [@key "ARCHITECTURE_STATEMENT_PART"] [@default Some []]; *)
208
    declarations: vhdl_declaration_t list option [@key "ARCHITECTURE_DECLARATIVE_PART"] [@default Some []];
209
    body: vhdl_concurrent_stmt_t list option [@key "ARCHITECTURE_STATEMENT_PART"] [@default Some []]; 
202 210
  }
203 211
[@@deriving yojson {strict = false}];;
204 212
    

Also available in: Unified diff