Project

General

Profile

Download (224 KB) Statistics
| Branch: | Tag: | Revision:
1
let base_types =
2
  ["integer";
3
  "character";
4
  "bit";
5
  "real";
6
  "natural";
7
  "positive";
8
  "std_logic";
9
  "std_logic_vector"] 
10
let std_logic_cst = ["U"; "X"; "0"; "1"; "Z"; "W"; "L"; "H"; "-"] 
11
let literal_base = ["B"; "O"; "X"; "UB"; "UO"; "UX"; "SB"; "SO"; "SX"; "D"] 
12
type vhdl_cst_val_t =
13
  | CstInt of int 
14
  | CstStdLogic of string 
15
  | CstLiteral of string [@name "CST_LITERAL"]
16

    
17
let rec (pp_vhdl_cst_val_t :
18
          Format.formatter -> vhdl_cst_val_t -> Ppx_deriving_runtime.unit)
19
  =
20
  ((let open! Ppx_deriving_runtime in
21
      fun fmt  ->
22
        function
23
        | CstInt a0 ->
24
            (Format.fprintf fmt "(@[<2>CstInt@ ";
25
             (Format.fprintf fmt "%d") a0;
26
             Format.fprintf fmt "@])")
27
        | CstStdLogic a0 ->
28
            (Format.fprintf fmt "(@[<2>CstStdLogic@ ";
29
             (Format.fprintf fmt "%S") a0;
30
             Format.fprintf fmt "@])")
31
        | CstLiteral a0 ->
32
            (Format.fprintf fmt "(@[<2>CstLiteral@ ";
33
             (Format.fprintf fmt "%S") a0;
34
             Format.fprintf fmt "@])"))
35
  [@ocaml.warning "-A"])
36

    
37
and show_vhdl_cst_val_t : vhdl_cst_val_t -> Ppx_deriving_runtime.string =
38
  fun x  -> Format.asprintf "%a" pp_vhdl_cst_val_t x
39

    
40
let rec (vhdl_cst_val_t_to_yojson : vhdl_cst_val_t -> Yojson.Safe.json) =
41
  ((let open! Ppx_deriving_yojson_runtime in
42
      function
43
      | CstInt arg0 ->
44
          `List
45
            [`String "CstInt";
46
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg0]
47
      | CstStdLogic arg0 ->
48
          `List
49
            [`String "CstStdLogic";
50
            ((fun (x : Ppx_deriving_runtime.string)  -> `String x)) arg0]
51
      | CstLiteral arg0 ->
52
          `List
53
            [`String "CST_LITERAL";
54
            ((fun (x : Ppx_deriving_runtime.string)  -> `String x)) arg0])
55
  [@ocaml.warning "-A"])
56

    
57
and (vhdl_cst_val_t_of_yojson :
58
      Yojson.Safe.json -> vhdl_cst_val_t Ppx_deriving_yojson_runtime.error_or)
59
  =
60
  ((let open! Ppx_deriving_yojson_runtime in
61
      function
62
      | `List ((`String "CstInt")::arg0::[]) ->
63
          ((function
64
            | `Int x -> Result.Ok x
65
            | _ -> Result.Error "Vhdl_ast.vhdl_cst_val_t") arg0) >>=
66
            ((fun arg0  -> Result.Ok (CstInt arg0)))
67
      | `List ((`String "CstStdLogic")::arg0::[]) ->
68
          ((function
69
            | `String x -> Result.Ok x
70
            | _ -> Result.Error "Vhdl_ast.vhdl_cst_val_t") arg0) >>=
71
            ((fun arg0  -> Result.Ok (CstStdLogic arg0)))
72
      | `List ((`String "CST_LITERAL")::arg0::[]) ->
73
          ((function
74
            | `String x -> Result.Ok x
75
            | _ -> Result.Error "Vhdl_ast.vhdl_cst_val_t") arg0) >>=
76
            ((fun arg0  -> Result.Ok (CstLiteral arg0)))
77
      | _ -> Result.Error "Vhdl_ast.vhdl_cst_val_t")
78
  [@ocaml.warning "-A"])
79

    
80
type vhdl_type_t =
81
  | Base of string 
82
  | Range of string option * int * int 
83
  | Bit_vector of int * int 
84
  | Array of int * int * vhdl_type_t 
85
  | Enumerated of string list 
86
  | Void 
87
and vhdl_subtype_indication_t =
88
  {
89
  name: vhdl_name_t [@default NoName];
90
  functionName: vhdl_name_t [@default NoName];
91
  const: vhdl_constraint_t [@default NoConstraint]}
92
and vhdl_discrete_range_t =
93
  | SubDiscreteRange of vhdl_subtype_indication_t
94
  [@name "SUB_DISCRETE_RANGE"]
95
  | NamedRange of vhdl_name_t [@name "NAMED_RANGE"]
96
  | DirectedRange of
97
  {
98
  direction: string ;
99
  from: vhdl_expr_t ;
100
  _to: vhdl_expr_t } [@name "RANGE_WITH_DIRECTION"]
101
and vhdl_constraint_t =
102
  | RefConstraint of {
103
  ref_name: vhdl_name_t } 
104
  | RangeConstraint of {
105
  range: vhdl_discrete_range_t } [@name "RANGE_CONSTRAINT"]
106
  | IndexConstraint of {
107
  ranges: vhdl_discrete_range_t list } [@name "INDEX_CONSTRAINT"]
108
  | ArrayConstraint of
109
  {
110
  ranges: vhdl_discrete_range_t list ;
111
  sub: vhdl_constraint_t } [@name "ARRAY_CONSTRAINT"]
112
  | RecordConstraint 
113
  | NoConstraint 
114
and vhdl_definition_t =
115
  | Type of {
116
  name: vhdl_name_t ;
117
  definition: vhdl_type_t } [@name "TYPE_DECLARATION"]
118
  | Subtype of {
119
  name: vhdl_name_t ;
120
  typ: vhdl_subtype_indication_t } [@name "SUBTYPE_DECLARATION"]
121
and vhdl_expr_t =
122
  | Call of vhdl_name_t [@name "CALL"]
123
  | Cst of vhdl_cst_val_t [@name "CONSTANT_VALUE"]
124
  | Op of {
125
  id: string [@default ""];
126
  args: vhdl_expr_t list [@default []]} [@name "EXPRESSION"]
127
  | IsNull [@name "IsNull"]
128
  | Time of {
129
  value: int ;
130
  phy_unit: string [@default ""]} 
131
  | Sig of {
132
  name: vhdl_name_t ;
133
  att: vhdl_signal_attributes_t option } 
134
  | SuffixMod of {
135
  expr: vhdl_expr_t ;
136
  selection: vhdl_suffix_selection_t } 
137
  | Aggregate of {
138
  elems: vhdl_element_assoc_t list } [@name "AGGREGATE"]
139
  | Others [@name "OTHERS"]
140
and vhdl_name_t =
141
  | Simple of string [@name "SIMPLE_NAME"]
142
  | Identifier of string [@name "IDENTIFIER"]
143
  | Selected of vhdl_name_t list [@name "SELECTED_NAME"]
144
  | Index of {
145
  id: vhdl_name_t ;
146
  exprs: vhdl_expr_t list } [@name "INDEXED_NAME"]
147
  | Slice of {
148
  id: vhdl_name_t ;
149
  range: vhdl_discrete_range_t } [@name "SLICE_NAME"]
150
  | Attribute of
151
  {
152
  id: vhdl_name_t ;
153
  designator: vhdl_name_t ;
154
  expr: vhdl_expr_t [@default IsNull]} [@name "ATTRIBUTE_NAME"]
155
  | Function of {
156
  id: vhdl_name_t ;
157
  assoc_list: vhdl_assoc_element_t list } [@name "FUNCTION_CALL"]
158
  | NoName 
159
and vhdl_assoc_element_t =
160
  {
161
  formal_name: vhdl_name_t option [@default Some NoName];
162
  formal_arg: vhdl_name_t option [@default Some NoName];
163
  actual_name: vhdl_name_t option [@default Some NoName];
164
  actual_designator: vhdl_name_t option [@default Some NoName];
165
  actual_expr: vhdl_expr_t option [@default Some IsNull]}
166
and vhdl_element_assoc_t = {
167
  choices: vhdl_expr_t list ;
168
  expr: vhdl_expr_t }
169
and vhdl_array_attributes_t =
170
  | AAttInt of {
171
  id: string ;
172
  arg: int } 
173
  | AAttAscending 
174
and vhdl_signal_attributes_t =
175
  | SigAtt of string 
176
and vhdl_string_attributes_t =
177
  | StringAtt of string 
178
and vhdl_suffix_selection_t =
179
  | Idx of int 
180
  | SuffixRange of int * int
181

    
182
let rec pp_vhdl_type_t :
183
  Format.formatter -> vhdl_type_t -> Ppx_deriving_runtime.unit =
184
  let __0 () = pp_vhdl_type_t  in
185
  ((let open! Ppx_deriving_runtime in
186
      fun fmt  ->
187
        function
188
        | Base a0 ->
189
            (Format.fprintf fmt "(@[<2>Base@ ";
190
             (Format.fprintf fmt "%S") a0;
191
             Format.fprintf fmt "@])")
192
        | Range (a0,a1,a2) ->
193
            (Format.fprintf fmt "(@[<2>Range (@,";
194
             ((((function
195
                 | None  -> Format.pp_print_string fmt "None"
196
                 | Some x ->
197
                     (Format.pp_print_string fmt "(Some ";
198
                      (Format.fprintf fmt "%S") x;
199
                      Format.pp_print_string fmt ")"))) a0;
200
               Format.fprintf fmt ",@ ";
201
               (Format.fprintf fmt "%d") a1);
202
              Format.fprintf fmt ",@ ";
203
              (Format.fprintf fmt "%d") a2);
204
             Format.fprintf fmt "@,))@]")
205
        | Bit_vector (a0,a1) ->
206
            (Format.fprintf fmt "(@[<2>Bit_vector (@,";
207
             ((Format.fprintf fmt "%d") a0;
208
              Format.fprintf fmt ",@ ";
209
              (Format.fprintf fmt "%d") a1);
210
             Format.fprintf fmt "@,))@]")
211
        | Array (a0,a1,a2) ->
212
            (Format.fprintf fmt "(@[<2>Array (@,";
213
             (((Format.fprintf fmt "%d") a0;
214
               Format.fprintf fmt ",@ ";
215
               (Format.fprintf fmt "%d") a1);
216
              Format.fprintf fmt ",@ ";
217
              ((__0 ()) fmt) a2);
218
             Format.fprintf fmt "@,))@]")
219
        | Enumerated a0 ->
220
            (Format.fprintf fmt "(@[<2>Enumerated@ ";
221
             ((fun x  ->
222
                 Format.fprintf fmt "@[<2>[";
223
                 ignore
224
                   (List.fold_left
225
                      (fun sep  ->
226
                         fun x  ->
227
                           if sep then Format.fprintf fmt ";@ ";
228
                           (Format.fprintf fmt "%S") x;
229
                           true) false x);
230
                 Format.fprintf fmt "@,]@]")) a0;
231
             Format.fprintf fmt "@])")
232
        | Void  -> Format.pp_print_string fmt "Void")
233
    [@ocaml.warning "-A"])
234

    
235
and show_vhdl_type_t : vhdl_type_t -> Ppx_deriving_runtime.string =
236
  fun x  -> Format.asprintf "%a" pp_vhdl_type_t x
237

    
238
and pp_vhdl_subtype_indication_t :
239
  Format.formatter -> vhdl_subtype_indication_t -> Ppx_deriving_runtime.unit
240
  =
241
  let __2 () = pp_vhdl_constraint_t
242
  
243
  and __1 () = pp_vhdl_name_t
244
  
245
  and __0 () = pp_vhdl_name_t
246
   in
247
  ((let open! Ppx_deriving_runtime in
248
      fun fmt  ->
249
        fun x  ->
250
          Format.fprintf fmt "@[<2>{ ";
251
          (((Format.fprintf fmt "@[%s =@ " "name";
252
             ((__0 ()) fmt) x.name;
253
             Format.fprintf fmt "@]");
254
            Format.fprintf fmt ";@ ";
255
            Format.fprintf fmt "@[%s =@ " "functionName";
256
            ((__1 ()) fmt) x.functionName;
257
            Format.fprintf fmt "@]");
258
           Format.fprintf fmt ";@ ";
259
           Format.fprintf fmt "@[%s =@ " "const";
260
           ((__2 ()) fmt) x.const;
261
           Format.fprintf fmt "@]");
262
          Format.fprintf fmt "@ }@]")
263
    [@ocaml.warning "-A"])
264

    
265
and show_vhdl_subtype_indication_t :
266
  vhdl_subtype_indication_t -> Ppx_deriving_runtime.string =
267
  fun x  -> Format.asprintf "%a" pp_vhdl_subtype_indication_t x
268

    
269
and pp_vhdl_discrete_range_t :
270
  Format.formatter -> vhdl_discrete_range_t -> Ppx_deriving_runtime.unit =
271
  let __3 () = pp_vhdl_expr_t
272
  
273
  and __2 () = pp_vhdl_expr_t
274
  
275
  and __1 () = pp_vhdl_name_t
276
  
277
  and __0 () = pp_vhdl_subtype_indication_t
278
   in
279
  ((let open! Ppx_deriving_runtime in
280
      fun fmt  ->
281
        function
282
        | SubDiscreteRange a0 ->
283
            (Format.fprintf fmt "(@[<2>SubDiscreteRange@ ";
284
             ((__0 ()) fmt) a0;
285
             Format.fprintf fmt "@])")
286
        | NamedRange a0 ->
287
            (Format.fprintf fmt "(@[<2>NamedRange@ ";
288
             ((__1 ()) fmt) a0;
289
             Format.fprintf fmt "@])")
290
        | DirectedRange { direction = adirection; from = afrom; _to = a_to }
291
            ->
292
            (Format.fprintf fmt "@[<2>DirectedRange {@,";
293
             (((Format.fprintf fmt "@[%s =@ " "direction";
294
                (Format.fprintf fmt "%S") adirection;
295
                Format.fprintf fmt "@]");
296
               Format.fprintf fmt ";@ ";
297
               Format.fprintf fmt "@[%s =@ " "from";
298
               ((__2 ()) fmt) afrom;
299
               Format.fprintf fmt "@]");
300
              Format.fprintf fmt ";@ ";
301
              Format.fprintf fmt "@[%s =@ " "_to";
302
              ((__3 ()) fmt) a_to;
303
              Format.fprintf fmt "@]");
304
             Format.fprintf fmt "@]}"))
305
    [@ocaml.warning "-A"])
306

    
307
and show_vhdl_discrete_range_t :
308
  vhdl_discrete_range_t -> Ppx_deriving_runtime.string =
309
  fun x  -> Format.asprintf "%a" pp_vhdl_discrete_range_t x
310

    
311
and pp_vhdl_constraint_t :
312
  Format.formatter -> vhdl_constraint_t -> Ppx_deriving_runtime.unit =
313
  let __4 () = pp_vhdl_constraint_t
314
  
315
  and __3 () = pp_vhdl_discrete_range_t
316
  
317
  and __2 () = pp_vhdl_discrete_range_t
318
  
319
  and __1 () = pp_vhdl_discrete_range_t
320
  
321
  and __0 () = pp_vhdl_name_t
322
   in
323
  ((let open! Ppx_deriving_runtime in
324
      fun fmt  ->
325
        function
326
        | RefConstraint { ref_name = aref_name } ->
327
            (Format.fprintf fmt "@[<2>RefConstraint {@,";
328
             (Format.fprintf fmt "@[%s =@ " "ref_name";
329
              ((__0 ()) fmt) aref_name;
330
              Format.fprintf fmt "@]");
331
             Format.fprintf fmt "@]}")
332
        | RangeConstraint { range = arange } ->
333
            (Format.fprintf fmt "@[<2>RangeConstraint {@,";
334
             (Format.fprintf fmt "@[%s =@ " "range";
335
              ((__1 ()) fmt) arange;
336
              Format.fprintf fmt "@]");
337
             Format.fprintf fmt "@]}")
338
        | IndexConstraint { ranges = aranges } ->
339
            (Format.fprintf fmt "@[<2>IndexConstraint {@,";
340
             (Format.fprintf fmt "@[%s =@ " "ranges";
341
              ((fun x  ->
342
                  Format.fprintf fmt "@[<2>[";
343
                  ignore
344
                    (List.fold_left
345
                       (fun sep  ->
346
                          fun x  ->
347
                            if sep then Format.fprintf fmt ";@ ";
348
                            ((__2 ()) fmt) x;
349
                            true) false x);
350
                  Format.fprintf fmt "@,]@]")) aranges;
351
              Format.fprintf fmt "@]");
352
             Format.fprintf fmt "@]}")
353
        | ArrayConstraint { ranges = aranges; sub = asub } ->
354
            (Format.fprintf fmt "@[<2>ArrayConstraint {@,";
355
             ((Format.fprintf fmt "@[%s =@ " "ranges";
356
               ((fun x  ->
357
                   Format.fprintf fmt "@[<2>[";
358
                   ignore
359
                     (List.fold_left
360
                        (fun sep  ->
361
                           fun x  ->
362
                             if sep then Format.fprintf fmt ";@ ";
363
                             ((__3 ()) fmt) x;
364
                             true) false x);
365
                   Format.fprintf fmt "@,]@]")) aranges;
366
               Format.fprintf fmt "@]");
367
              Format.fprintf fmt ";@ ";
368
              Format.fprintf fmt "@[%s =@ " "sub";
369
              ((__4 ()) fmt) asub;
370
              Format.fprintf fmt "@]");
371
             Format.fprintf fmt "@]}")
372
        | RecordConstraint  -> Format.pp_print_string fmt "RecordConstraint"
373
        | NoConstraint  -> Format.pp_print_string fmt "NoConstraint")
374
    [@ocaml.warning "-A"])
375

    
376
and show_vhdl_constraint_t : vhdl_constraint_t -> Ppx_deriving_runtime.string
377
  = fun x  -> Format.asprintf "%a" pp_vhdl_constraint_t x
378

    
379
and pp_vhdl_definition_t :
380
  Format.formatter -> vhdl_definition_t -> Ppx_deriving_runtime.unit =
381
  let __3 () = pp_vhdl_subtype_indication_t
382
  
383
  and __2 () = pp_vhdl_name_t
384
  
385
  and __1 () = pp_vhdl_type_t
386
  
387
  and __0 () = pp_vhdl_name_t
388
   in
389
  ((let open! Ppx_deriving_runtime in
390
      fun fmt  ->
391
        function
392
        | Type { name = aname; definition = adefinition } ->
393
            (Format.fprintf fmt "@[<2>Type {@,";
394
             ((Format.fprintf fmt "@[%s =@ " "name";
395
               ((__0 ()) fmt) aname;
396
               Format.fprintf fmt "@]");
397
              Format.fprintf fmt ";@ ";
398
              Format.fprintf fmt "@[%s =@ " "definition";
399
              ((__1 ()) fmt) adefinition;
400
              Format.fprintf fmt "@]");
401
             Format.fprintf fmt "@]}")
402
        | Subtype { name = aname; typ = atyp } ->
403
            (Format.fprintf fmt "@[<2>Subtype {@,";
404
             ((Format.fprintf fmt "@[%s =@ " "name";
405
               ((__2 ()) fmt) aname;
406
               Format.fprintf fmt "@]");
407
              Format.fprintf fmt ";@ ";
408
              Format.fprintf fmt "@[%s =@ " "typ";
409
              ((__3 ()) fmt) atyp;
410
              Format.fprintf fmt "@]");
411
             Format.fprintf fmt "@]}"))
412
    [@ocaml.warning "-A"])
413

    
414
and show_vhdl_definition_t : vhdl_definition_t -> Ppx_deriving_runtime.string
415
  = fun x  -> Format.asprintf "%a" pp_vhdl_definition_t x
416

    
417
and pp_vhdl_expr_t :
418
  Format.formatter -> vhdl_expr_t -> Ppx_deriving_runtime.unit =
419
  let __7 () = pp_vhdl_element_assoc_t
420
  
421
  and __6 () = pp_vhdl_suffix_selection_t
422
  
423
  and __5 () = pp_vhdl_expr_t
424
  
425
  and __4 () = pp_vhdl_signal_attributes_t
426
  
427
  and __3 () = pp_vhdl_name_t
428
  
429
  and __2 () = pp_vhdl_expr_t
430
  
431
  and __1 () = pp_vhdl_cst_val_t
432
  
433
  and __0 () = pp_vhdl_name_t
434
   in
435
  ((let open! Ppx_deriving_runtime in
436
      fun fmt  ->
437
        function
438
        | Call a0 ->
439
            (Format.fprintf fmt "(@[<2>Call@ ";
440
             ((__0 ()) fmt) a0;
441
             Format.fprintf fmt "@])")
442
        | Cst a0 ->
443
            (Format.fprintf fmt "(@[<2>Cst@ ";
444
             ((__1 ()) fmt) a0;
445
             Format.fprintf fmt "@])")
446
        | Op { id = aid; args = aargs } ->
447
            (Format.fprintf fmt "@[<2>Op {@,";
448
             ((Format.fprintf fmt "@[%s =@ " "id";
449
               (Format.fprintf fmt "%S") aid;
450
               Format.fprintf fmt "@]");
451
              Format.fprintf fmt ";@ ";
452
              Format.fprintf fmt "@[%s =@ " "args";
453
              ((fun x  ->
454
                  Format.fprintf fmt "@[<2>[";
455
                  ignore
456
                    (List.fold_left
457
                       (fun sep  ->
458
                          fun x  ->
459
                            if sep then Format.fprintf fmt ";@ ";
460
                            ((__2 ()) fmt) x;
461
                            true) false x);
462
                  Format.fprintf fmt "@,]@]")) aargs;
463
              Format.fprintf fmt "@]");
464
             Format.fprintf fmt "@]}")
465
        | IsNull  -> Format.pp_print_string fmt "IsNull"
466
        | Time { value = avalue; phy_unit = aphy_unit } ->
467
            (Format.fprintf fmt "@[<2>Time {@,";
468
             ((Format.fprintf fmt "@[%s =@ " "value";
469
               (Format.fprintf fmt "%d") avalue;
470
               Format.fprintf fmt "@]");
471
              Format.fprintf fmt ";@ ";
472
              Format.fprintf fmt "@[%s =@ " "phy_unit";
473
              (Format.fprintf fmt "%S") aphy_unit;
474
              Format.fprintf fmt "@]");
475
             Format.fprintf fmt "@]}")
476
        | Sig { name = aname; att = aatt } ->
477
            (Format.fprintf fmt "@[<2>Sig {@,";
478
             ((Format.fprintf fmt "@[%s =@ " "name";
479
               ((__3 ()) fmt) aname;
480
               Format.fprintf fmt "@]");
481
              Format.fprintf fmt ";@ ";
482
              Format.fprintf fmt "@[%s =@ " "att";
483
              ((function
484
                | None  -> Format.pp_print_string fmt "None"
485
                | Some x ->
486
                    (Format.pp_print_string fmt "(Some ";
487
                     ((__4 ()) fmt) x;
488
                     Format.pp_print_string fmt ")"))) aatt;
489
              Format.fprintf fmt "@]");
490
             Format.fprintf fmt "@]}")
491
        | SuffixMod { expr = aexpr; selection = aselection } ->
492
            (Format.fprintf fmt "@[<2>SuffixMod {@,";
493
             ((Format.fprintf fmt "@[%s =@ " "expr";
494
               ((__5 ()) fmt) aexpr;
495
               Format.fprintf fmt "@]");
496
              Format.fprintf fmt ";@ ";
497
              Format.fprintf fmt "@[%s =@ " "selection";
498
              ((__6 ()) fmt) aselection;
499
              Format.fprintf fmt "@]");
500
             Format.fprintf fmt "@]}")
501
        | Aggregate { elems = aelems } ->
502
            (Format.fprintf fmt "@[<2>Aggregate {@,";
503
             (Format.fprintf fmt "@[%s =@ " "elems";
504
              ((fun x  ->
505
                  Format.fprintf fmt "@[<2>[";
506
                  ignore
507
                    (List.fold_left
508
                       (fun sep  ->
509
                          fun x  ->
510
                            if sep then Format.fprintf fmt ";@ ";
511
                            ((__7 ()) fmt) x;
512
                            true) false x);
513
                  Format.fprintf fmt "@,]@]")) aelems;
514
              Format.fprintf fmt "@]");
515
             Format.fprintf fmt "@]}")
516
        | Others  -> Format.pp_print_string fmt "Others")
517
    [@ocaml.warning "-A"])
518

    
519
and show_vhdl_expr_t : vhdl_expr_t -> Ppx_deriving_runtime.string =
520
  fun x  -> Format.asprintf "%a" pp_vhdl_expr_t x
521

    
522
and pp_vhdl_name_t :
523
  Format.formatter -> vhdl_name_t -> Ppx_deriving_runtime.unit =
524
  let __9 () = pp_vhdl_assoc_element_t
525
  
526
  and __8 () = pp_vhdl_name_t
527
  
528
  and __7 () = pp_vhdl_expr_t
529
  
530
  and __6 () = pp_vhdl_name_t
531
  
532
  and __5 () = pp_vhdl_name_t
533
  
534
  and __4 () = pp_vhdl_discrete_range_t
535
  
536
  and __3 () = pp_vhdl_name_t
537
  
538
  and __2 () = pp_vhdl_expr_t
539
  
540
  and __1 () = pp_vhdl_name_t
541
  
542
  and __0 () = pp_vhdl_name_t
543
   in
544
  ((let open! Ppx_deriving_runtime in
545
      fun fmt  ->
546
        function
547
        | Simple a0 ->
548
            (Format.fprintf fmt "(@[<2>Simple@ ";
549
             (Format.fprintf fmt "%S") a0;
550
             Format.fprintf fmt "@])")
551
        | Identifier a0 ->
552
            (Format.fprintf fmt "(@[<2>Identifier@ ";
553
             (Format.fprintf fmt "%S") a0;
554
             Format.fprintf fmt "@])")
555
        | Selected a0 ->
556
            (Format.fprintf fmt "(@[<2>Selected@ ";
557
             ((fun x  ->
558
                 Format.fprintf fmt "@[<2>[";
559
                 ignore
560
                   (List.fold_left
561
                      (fun sep  ->
562
                         fun x  ->
563
                           if sep then Format.fprintf fmt ";@ ";
564
                           ((__0 ()) fmt) x;
565
                           true) false x);
566
                 Format.fprintf fmt "@,]@]")) a0;
567
             Format.fprintf fmt "@])")
568
        | Index { id = aid; exprs = aexprs } ->
569
            (Format.fprintf fmt "@[<2>Index {@,";
570
             ((Format.fprintf fmt "@[%s =@ " "id";
571
               ((__1 ()) fmt) aid;
572
               Format.fprintf fmt "@]");
573
              Format.fprintf fmt ";@ ";
574
              Format.fprintf fmt "@[%s =@ " "exprs";
575
              ((fun x  ->
576
                  Format.fprintf fmt "@[<2>[";
577
                  ignore
578
                    (List.fold_left
579
                       (fun sep  ->
580
                          fun x  ->
581
                            if sep then Format.fprintf fmt ";@ ";
582
                            ((__2 ()) fmt) x;
583
                            true) false x);
584
                  Format.fprintf fmt "@,]@]")) aexprs;
585
              Format.fprintf fmt "@]");
586
             Format.fprintf fmt "@]}")
587
        | Slice { id = aid; range = arange } ->
588
            (Format.fprintf fmt "@[<2>Slice {@,";
589
             ((Format.fprintf fmt "@[%s =@ " "id";
590
               ((__3 ()) fmt) aid;
591
               Format.fprintf fmt "@]");
592
              Format.fprintf fmt ";@ ";
593
              Format.fprintf fmt "@[%s =@ " "range";
594
              ((__4 ()) fmt) arange;
595
              Format.fprintf fmt "@]");
596
             Format.fprintf fmt "@]}")
597
        | Attribute { id = aid; designator = adesignator; expr = aexpr } ->
598
            (Format.fprintf fmt "@[<2>Attribute {@,";
599
             (((Format.fprintf fmt "@[%s =@ " "id";
600
                ((__5 ()) fmt) aid;
601
                Format.fprintf fmt "@]");
602
               Format.fprintf fmt ";@ ";
603
               Format.fprintf fmt "@[%s =@ " "designator";
604
               ((__6 ()) fmt) adesignator;
605
               Format.fprintf fmt "@]");
606
              Format.fprintf fmt ";@ ";
607
              Format.fprintf fmt "@[%s =@ " "expr";
608
              ((__7 ()) fmt) aexpr;
609
              Format.fprintf fmt "@]");
610
             Format.fprintf fmt "@]}")
611
        | Function { id = aid; assoc_list = aassoc_list } ->
612
            (Format.fprintf fmt "@[<2>Function {@,";
613
             ((Format.fprintf fmt "@[%s =@ " "id";
614
               ((__8 ()) fmt) aid;
615
               Format.fprintf fmt "@]");
616
              Format.fprintf fmt ";@ ";
617
              Format.fprintf fmt "@[%s =@ " "assoc_list";
618
              ((fun x  ->
619
                  Format.fprintf fmt "@[<2>[";
620
                  ignore
621
                    (List.fold_left
622
                       (fun sep  ->
623
                          fun x  ->
624
                            if sep then Format.fprintf fmt ";@ ";
625
                            ((__9 ()) fmt) x;
626
                            true) false x);
627
                  Format.fprintf fmt "@,]@]")) aassoc_list;
628
              Format.fprintf fmt "@]");
629
             Format.fprintf fmt "@]}")
630
        | NoName  -> Format.pp_print_string fmt "NoName")
631
    [@ocaml.warning "-A"])
632

    
633
and show_vhdl_name_t : vhdl_name_t -> Ppx_deriving_runtime.string =
634
  fun x  -> Format.asprintf "%a" pp_vhdl_name_t x
635

    
636
and pp_vhdl_assoc_element_t :
637
  Format.formatter -> vhdl_assoc_element_t -> Ppx_deriving_runtime.unit =
638
  let __4 () = pp_vhdl_expr_t
639
  
640
  and __3 () = pp_vhdl_name_t
641
  
642
  and __2 () = pp_vhdl_name_t
643
  
644
  and __1 () = pp_vhdl_name_t
645
  
646
  and __0 () = pp_vhdl_name_t
647
   in
648
  ((let open! Ppx_deriving_runtime in
649
      fun fmt  ->
650
        fun x  ->
651
          Format.fprintf fmt "@[<2>{ ";
652
          (((((Format.fprintf fmt "@[%s =@ " "formal_name";
653
               ((function
654
                 | None  -> Format.pp_print_string fmt "None"
655
                 | Some x ->
656
                     (Format.pp_print_string fmt "(Some ";
657
                      ((__0 ()) fmt) x;
658
                      Format.pp_print_string fmt ")"))) x.formal_name;
659
               Format.fprintf fmt "@]");
660
              Format.fprintf fmt ";@ ";
661
              Format.fprintf fmt "@[%s =@ " "formal_arg";
662
              ((function
663
                | None  -> Format.pp_print_string fmt "None"
664
                | Some x ->
665
                    (Format.pp_print_string fmt "(Some ";
666
                     ((__1 ()) fmt) x;
667
                     Format.pp_print_string fmt ")"))) x.formal_arg;
668
              Format.fprintf fmt "@]");
669
             Format.fprintf fmt ";@ ";
670
             Format.fprintf fmt "@[%s =@ " "actual_name";
671
             ((function
672
               | None  -> Format.pp_print_string fmt "None"
673
               | Some x ->
674
                   (Format.pp_print_string fmt "(Some ";
675
                    ((__2 ()) fmt) x;
676
                    Format.pp_print_string fmt ")"))) x.actual_name;
677
             Format.fprintf fmt "@]");
678
            Format.fprintf fmt ";@ ";
679
            Format.fprintf fmt "@[%s =@ " "actual_designator";
680
            ((function
681
              | None  -> Format.pp_print_string fmt "None"
682
              | Some x ->
683
                  (Format.pp_print_string fmt "(Some ";
684
                   ((__3 ()) fmt) x;
685
                   Format.pp_print_string fmt ")"))) x.actual_designator;
686
            Format.fprintf fmt "@]");
687
           Format.fprintf fmt ";@ ";
688
           Format.fprintf fmt "@[%s =@ " "actual_expr";
689
           ((function
690
             | None  -> Format.pp_print_string fmt "None"
691
             | Some x ->
692
                 (Format.pp_print_string fmt "(Some ";
693
                  ((__4 ()) fmt) x;
694
                  Format.pp_print_string fmt ")"))) x.actual_expr;
695
           Format.fprintf fmt "@]");
696
          Format.fprintf fmt "@ }@]")
697
    [@ocaml.warning "-A"])
698

    
699
and show_vhdl_assoc_element_t :
700
  vhdl_assoc_element_t -> Ppx_deriving_runtime.string =
701
  fun x  -> Format.asprintf "%a" pp_vhdl_assoc_element_t x
702

    
703
and pp_vhdl_element_assoc_t :
704
  Format.formatter -> vhdl_element_assoc_t -> Ppx_deriving_runtime.unit =
705
  let __1 () = pp_vhdl_expr_t
706
  
707
  and __0 () = pp_vhdl_expr_t
708
   in
709
  ((let open! Ppx_deriving_runtime in
710
      fun fmt  ->
711
        fun x  ->
712
          Format.fprintf fmt "@[<2>{ ";
713
          ((Format.fprintf fmt "@[%s =@ " "choices";
714
            ((fun x  ->
715
                Format.fprintf fmt "@[<2>[";
716
                ignore
717
                  (List.fold_left
718
                     (fun sep  ->
719
                        fun x  ->
720
                          if sep then Format.fprintf fmt ";@ ";
721
                          ((__0 ()) fmt) x;
722
                          true) false x);
723
                Format.fprintf fmt "@,]@]")) x.choices;
724
            Format.fprintf fmt "@]");
725
           Format.fprintf fmt ";@ ";
726
           Format.fprintf fmt "@[%s =@ " "expr";
727
           ((__1 ()) fmt) x.expr;
728
           Format.fprintf fmt "@]");
729
          Format.fprintf fmt "@ }@]")
730
    [@ocaml.warning "-A"])
731

    
732
and show_vhdl_element_assoc_t :
733
  vhdl_element_assoc_t -> Ppx_deriving_runtime.string =
734
  fun x  -> Format.asprintf "%a" pp_vhdl_element_assoc_t x
735

    
736
and (pp_vhdl_array_attributes_t :
737
      Format.formatter ->
738
        vhdl_array_attributes_t -> Ppx_deriving_runtime.unit)
739
  =
740
  ((let open! Ppx_deriving_runtime in
741
      fun fmt  ->
742
        function
743
        | AAttInt { id = aid; arg = aarg } ->
744
            (Format.fprintf fmt "@[<2>AAttInt {@,";
745
             ((Format.fprintf fmt "@[%s =@ " "id";
746
               (Format.fprintf fmt "%S") aid;
747
               Format.fprintf fmt "@]");
748
              Format.fprintf fmt ";@ ";
749
              Format.fprintf fmt "@[%s =@ " "arg";
750
              (Format.fprintf fmt "%d") aarg;
751
              Format.fprintf fmt "@]");
752
             Format.fprintf fmt "@]}")
753
        | AAttAscending  -> Format.pp_print_string fmt "AAttAscending")
754
  [@ocaml.warning "-A"])
755

    
756
and show_vhdl_array_attributes_t :
757
  vhdl_array_attributes_t -> Ppx_deriving_runtime.string =
758
  fun x  -> Format.asprintf "%a" pp_vhdl_array_attributes_t x
759

    
760
and (pp_vhdl_signal_attributes_t :
761
      Format.formatter ->
762
        vhdl_signal_attributes_t -> Ppx_deriving_runtime.unit)
763
  =
764
  ((let open! Ppx_deriving_runtime in
765
      fun fmt  ->
766
        function
767
        | SigAtt a0 ->
768
            (Format.fprintf fmt "(@[<2>SigAtt@ ";
769
             (Format.fprintf fmt "%S") a0;
770
             Format.fprintf fmt "@])"))
771
  [@ocaml.warning "-A"])
772

    
773
and show_vhdl_signal_attributes_t :
774
  vhdl_signal_attributes_t -> Ppx_deriving_runtime.string =
775
  fun x  -> Format.asprintf "%a" pp_vhdl_signal_attributes_t x
776

    
777
and (pp_vhdl_string_attributes_t :
778
      Format.formatter ->
779
        vhdl_string_attributes_t -> Ppx_deriving_runtime.unit)
780
  =
781
  ((let open! Ppx_deriving_runtime in
782
      fun fmt  ->
783
        function
784
        | StringAtt a0 ->
785
            (Format.fprintf fmt "(@[<2>StringAtt@ ";
786
             (Format.fprintf fmt "%S") a0;
787
             Format.fprintf fmt "@])"))
788
  [@ocaml.warning "-A"])
789

    
790
and show_vhdl_string_attributes_t :
791
  vhdl_string_attributes_t -> Ppx_deriving_runtime.string =
792
  fun x  -> Format.asprintf "%a" pp_vhdl_string_attributes_t x
793

    
794
and (pp_vhdl_suffix_selection_t :
795
      Format.formatter ->
796
        vhdl_suffix_selection_t -> Ppx_deriving_runtime.unit)
797
  =
798
  ((let open! Ppx_deriving_runtime in
799
      fun fmt  ->
800
        function
801
        | Idx a0 ->
802
            (Format.fprintf fmt "(@[<2>Idx@ ";
803
             (Format.fprintf fmt "%d") a0;
804
             Format.fprintf fmt "@])")
805
        | SuffixRange (a0,a1) ->
806
            (Format.fprintf fmt "(@[<2>SuffixRange (@,";
807
             ((Format.fprintf fmt "%d") a0;
808
              Format.fprintf fmt ",@ ";
809
              (Format.fprintf fmt "%d") a1);
810
             Format.fprintf fmt "@,))@]"))
811
  [@ocaml.warning "-A"])
812

    
813
and show_vhdl_suffix_selection_t :
814
  vhdl_suffix_selection_t -> Ppx_deriving_runtime.string =
815
  fun x  -> Format.asprintf "%a" pp_vhdl_suffix_selection_t x
816

    
817
let rec (vhdl_type_t_to_yojson : vhdl_type_t -> Yojson.Safe.json) =
818
  ((let open! Ppx_deriving_yojson_runtime in
819
      function
820
      | Base arg0 ->
821
          `List
822
            [`String "Base";
823
            ((fun (x : Ppx_deriving_runtime.string)  -> `String x)) arg0]
824
      | Range (arg0,arg1,arg2) ->
825
          `List
826
            [`String "Range";
827
            ((function
828
              | None  -> `Null
829
              | Some x ->
830
                  ((fun (x : Ppx_deriving_runtime.string)  -> `String x)) x))
831
              arg0;
832
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg1;
833
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg2]
834
      | Bit_vector (arg0,arg1) ->
835
          `List
836
            [`String "Bit_vector";
837
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg0;
838
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg1]
839
      | Array (arg0,arg1,arg2) ->
840
          `List
841
            [`String "Array";
842
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg0;
843
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg1;
844
            ((fun x  -> vhdl_type_t_to_yojson x)) arg2]
845
      | Enumerated arg0 ->
846
          `List
847
            [`String "Enumerated";
848
            ((fun x  ->
849
                `List
850
                  (List.map
851
                     (fun (x : Ppx_deriving_runtime.string)  -> `String x) x)))
852
              arg0]
853
      | Void  -> `List [`String "Void"])
854
  [@ocaml.warning "-A"])
855

    
856
and (vhdl_type_t_of_yojson :
857
      Yojson.Safe.json -> vhdl_type_t Ppx_deriving_yojson_runtime.error_or)
858
  =
859
  ((let open! Ppx_deriving_yojson_runtime in
860
      function
861
      | `List ((`String "Base")::arg0::[]) ->
862
          ((function
863
            | `String x -> Result.Ok x
864
            | _ -> Result.Error "Vhdl_ast.vhdl_type_t") arg0) >>=
865
            ((fun arg0  -> Result.Ok (Base arg0)))
866
      | `List ((`String "Range")::arg0::arg1::arg2::[]) ->
867
          ((function
868
            | `Int x -> Result.Ok x
869
            | _ -> Result.Error "Vhdl_ast.vhdl_type_t") arg2) >>=
870
            ((fun arg2  ->
871
                ((function
872
                  | `Int x -> Result.Ok x
873
                  | _ -> Result.Error "Vhdl_ast.vhdl_type_t") arg1) >>=
874
                  (fun arg1  ->
875
                     ((function
876
                       | `Null -> Result.Ok None
877
                       | x ->
878
                           ((function
879
                             | `String x -> Result.Ok x
880
                             | _ -> Result.Error "Vhdl_ast.vhdl_type_t") x)
881
                             >>= ((fun x  -> Result.Ok (Some x)))) arg0)
882
                       >>=
883
                       (fun arg0  -> Result.Ok (Range (arg0, arg1, arg2))))))
884
      | `List ((`String "Bit_vector")::arg0::arg1::[]) ->
885
          ((function
886
            | `Int x -> Result.Ok x
887
            | _ -> Result.Error "Vhdl_ast.vhdl_type_t") arg1) >>=
888
            ((fun arg1  ->
889
                ((function
890
                  | `Int x -> Result.Ok x
891
                  | _ -> Result.Error "Vhdl_ast.vhdl_type_t") arg0) >>=
892
                  (fun arg0  -> Result.Ok (Bit_vector (arg0, arg1)))))
893
      | `List ((`String "Array")::arg0::arg1::arg2::[]) ->
894
          ((fun x  -> vhdl_type_t_of_yojson x) arg2) >>=
895
            ((fun arg2  ->
896
                ((function
897
                  | `Int x -> Result.Ok x
898
                  | _ -> Result.Error "Vhdl_ast.vhdl_type_t") arg1) >>=
899
                  (fun arg1  ->
900
                     ((function
901
                       | `Int x -> Result.Ok x
902
                       | _ -> Result.Error "Vhdl_ast.vhdl_type_t") arg0) >>=
903
                       (fun arg0  -> Result.Ok (Array (arg0, arg1, arg2))))))
904
      | `List ((`String "Enumerated")::arg0::[]) ->
905
          ((function
906
            | `List xs ->
907
                map_bind
908
                  (function
909
                   | `String x -> Result.Ok x
910
                   | _ -> Result.Error "Vhdl_ast.vhdl_type_t") [] xs
911
            | _ -> Result.Error "Vhdl_ast.vhdl_type_t") arg0) >>=
912
            ((fun arg0  -> Result.Ok (Enumerated arg0)))
913
      | `List ((`String "Void")::[]) -> Result.Ok Void
914
      | _ -> Result.Error "Vhdl_ast.vhdl_type_t")
915
  [@ocaml.warning "-A"])
916

    
917
and (vhdl_subtype_indication_t_to_yojson :
918
      vhdl_subtype_indication_t -> Yojson.Safe.json)
919
  =
920
  ((let open! Ppx_deriving_yojson_runtime in
921
      fun x  ->
922
        let fields = []  in
923
        let fields =
924
          if x.const = NoConstraint
925
          then fields
926
          else
927
            ("const", (((fun x  -> vhdl_constraint_t_to_yojson x)) x.const))
928
            :: fields
929
           in
930
        let fields =
931
          if x.functionName = NoName
932
          then fields
933
          else
934
            ("functionName",
935
              (((fun x  -> vhdl_name_t_to_yojson x)) x.functionName))
936
            :: fields
937
           in
938
        let fields =
939
          if x.name = NoName
940
          then fields
941
          else ("name", (((fun x  -> vhdl_name_t_to_yojson x)) x.name)) ::
942
            fields
943
           in
944
        `Assoc fields)
945
  [@ocaml.warning "-A"])
946

    
947
and (vhdl_subtype_indication_t_of_yojson :
948
      Yojson.Safe.json ->
949
        vhdl_subtype_indication_t Ppx_deriving_yojson_runtime.error_or)
950
  =
951
  ((let open! Ppx_deriving_yojson_runtime in
952
      function
953
      | `Assoc xs ->
954
          let rec loop xs ((arg0,arg1,arg2) as _state) =
955
            match xs with
956
            | ("name",x)::xs ->
957
                loop xs (((fun x  -> vhdl_name_t_of_yojson x) x), arg1, arg2)
958
            | ("functionName",x)::xs ->
959
                loop xs (arg0, ((fun x  -> vhdl_name_t_of_yojson x) x), arg2)
960
            | ("const",x)::xs ->
961
                loop xs
962
                  (arg0, arg1, ((fun x  -> vhdl_constraint_t_of_yojson x) x))
963
            | [] ->
964
                arg2 >>=
965
                  ((fun arg2  ->
966
                      arg1 >>=
967
                        (fun arg1  ->
968
                           arg0 >>=
969
                             (fun arg0  ->
970
                                Result.Ok
971
                                  {
972
                                    name = arg0;
973
                                    functionName = arg1;
974
                                    const = arg2
975
                                  }))))
976
            | _::xs -> loop xs _state  in
977
          loop xs
978
            ((Result.Ok NoName), (Result.Ok NoName),
979
              (Result.Ok NoConstraint))
980
      | _ -> Result.Error "Vhdl_ast.vhdl_subtype_indication_t")
981
  [@ocaml.warning "-A"])
982

    
983
and (vhdl_discrete_range_t_to_yojson :
984
      vhdl_discrete_range_t -> Yojson.Safe.json)
985
  =
986
  ((let open! Ppx_deriving_yojson_runtime in
987
      function
988
      | SubDiscreteRange arg0 ->
989
          `List
990
            [`String "SUB_DISCRETE_RANGE";
991
            ((fun x  -> vhdl_subtype_indication_t_to_yojson x)) arg0]
992
      | NamedRange arg0 ->
993
          `List
994
            [`String "NAMED_RANGE";
995
            ((fun x  -> vhdl_name_t_to_yojson x)) arg0]
996
      | DirectedRange arg0 ->
997
          `List
998
            [`String "RANGE_WITH_DIRECTION";
999
            (let fields = []  in
1000
             let fields =
1001
               ("_to", ((fun x  -> vhdl_expr_t_to_yojson x) arg0._to)) ::
1002
               fields  in
1003
             let fields =
1004
               ("from", ((fun x  -> vhdl_expr_t_to_yojson x) arg0.from)) ::
1005
               fields  in
1006
             let fields =
1007
               ("direction",
1008
                 ((fun (x : Ppx_deriving_runtime.string)  -> `String x)
1009
                    arg0.direction))
1010
               :: fields  in
1011
             `Assoc fields)])
1012
  [@ocaml.warning "-A"])
1013

    
1014
and (vhdl_discrete_range_t_of_yojson :
1015
      Yojson.Safe.json ->
1016
        vhdl_discrete_range_t Ppx_deriving_yojson_runtime.error_or)
1017
  =
1018
  ((let open! Ppx_deriving_yojson_runtime in
1019
      function
1020
      | `List ((`String "SUB_DISCRETE_RANGE")::arg0::[]) ->
1021
          ((fun x  -> vhdl_subtype_indication_t_of_yojson x) arg0) >>=
1022
            ((fun arg0  -> Result.Ok (SubDiscreteRange arg0)))
1023
      | `List ((`String "NAMED_RANGE")::arg0::[]) ->
1024
          ((fun x  -> vhdl_name_t_of_yojson x) arg0) >>=
1025
            ((fun arg0  -> Result.Ok (NamedRange arg0)))
1026
      | `List ((`String "RANGE_WITH_DIRECTION")::arg0::[]) ->
1027
          ((function
1028
            | `Assoc xs ->
1029
                let rec loop xs ((arg0,arg1,arg2) as _state) =
1030
                  match xs with
1031
                  | ("direction",x)::xs ->
1032
                      loop xs
1033
                        (((function
1034
                           | `String x -> Result.Ok x
1035
                           | _ ->
1036
                               Result.Error
1037
                                 "Vhdl_ast.vhdl_discrete_range_t.direction")
1038
                            x), arg1, arg2)
1039
                  | ("from",x)::xs ->
1040
                      loop xs
1041
                        (arg0, ((fun x  -> vhdl_expr_t_of_yojson x) x), arg2)
1042
                  | ("_to",x)::xs ->
1043
                      loop xs
1044
                        (arg0, arg1, ((fun x  -> vhdl_expr_t_of_yojson x) x))
1045
                  | [] ->
1046
                      arg2 >>=
1047
                        ((fun arg2  ->
1048
                            arg1 >>=
1049
                              (fun arg1  ->
1050
                                 arg0 >>=
1051
                                   (fun arg0  ->
1052
                                      Result.Ok
1053
                                        (DirectedRange
1054
                                           {
1055
                                             direction = arg0;
1056
                                             from = arg1;
1057
                                             _to = arg2
1058
                                           })))))
1059
                  | _::xs -> loop xs _state  in
1060
                loop xs
1061
                  ((Result.Error "Vhdl_ast.vhdl_discrete_range_t.direction"),
1062
                    (Result.Error "Vhdl_ast.vhdl_discrete_range_t.from"),
1063
                    (Result.Error "Vhdl_ast.vhdl_discrete_range_t._to"))
1064
            | _ -> Result.Error "Vhdl_ast.vhdl_discrete_range_t")) arg0
1065
      | _ -> Result.Error "Vhdl_ast.vhdl_discrete_range_t")
1066
  [@ocaml.warning "-A"])
1067

    
1068
and (vhdl_constraint_t_to_yojson : vhdl_constraint_t -> Yojson.Safe.json) =
1069
  ((let open! Ppx_deriving_yojson_runtime in
1070
      function
1071
      | RefConstraint arg0 ->
1072
          `List
1073
            [`String "RefConstraint";
1074
            (let fields = []  in
1075
             let fields =
1076
               ("ref_name",
1077
                 ((fun x  -> vhdl_name_t_to_yojson x) arg0.ref_name))
1078
               :: fields  in
1079
             `Assoc fields)]
1080
      | RangeConstraint arg0 ->
1081
          `List
1082
            [`String "RANGE_CONSTRAINT";
1083
            (let fields = []  in
1084
             let fields =
1085
               ("range",
1086
                 ((fun x  -> vhdl_discrete_range_t_to_yojson x) arg0.range))
1087
               :: fields  in
1088
             `Assoc fields)]
1089
      | IndexConstraint arg0 ->
1090
          `List
1091
            [`String "INDEX_CONSTRAINT";
1092
            (let fields = []  in
1093
             let fields =
1094
               ("ranges",
1095
                 ((fun x  ->
1096
                     `List
1097
                       (List.map
1098
                          (fun x  -> vhdl_discrete_range_t_to_yojson x) x))
1099
                    arg0.ranges))
1100
               :: fields  in
1101
             `Assoc fields)]
1102
      | ArrayConstraint arg0 ->
1103
          `List
1104
            [`String "ARRAY_CONSTRAINT";
1105
            (let fields = []  in
1106
             let fields =
1107
               ("sub", ((fun x  -> vhdl_constraint_t_to_yojson x) arg0.sub))
1108
               :: fields  in
1109
             let fields =
1110
               ("ranges",
1111
                 ((fun x  ->
1112
                     `List
1113
                       (List.map
1114
                          (fun x  -> vhdl_discrete_range_t_to_yojson x) x))
1115
                    arg0.ranges))
1116
               :: fields  in
1117
             `Assoc fields)]
1118
      | RecordConstraint  -> `List [`String "RecordConstraint"]
1119
      | NoConstraint  -> `List [`String "NoConstraint"])
1120
  [@ocaml.warning "-A"])
1121

    
1122
and (vhdl_constraint_t_of_yojson :
1123
      Yojson.Safe.json ->
1124
        vhdl_constraint_t Ppx_deriving_yojson_runtime.error_or)
1125
  =
1126
  ((let open! Ppx_deriving_yojson_runtime in
1127
      function
1128
      | `List ((`String "RefConstraint")::arg0::[]) ->
1129
          ((function
1130
            | `Assoc xs ->
1131
                let rec loop xs (arg0 as _state) =
1132
                  match xs with
1133
                  | ("ref_name",x)::xs ->
1134
                      loop xs ((fun x  -> vhdl_name_t_of_yojson x) x)
1135
                  | [] ->
1136
                      arg0 >>=
1137
                        ((fun arg0  ->
1138
                            Result.Ok (RefConstraint { ref_name = arg0 })))
1139
                  | _::xs -> loop xs _state  in
1140
                loop xs (Result.Error "Vhdl_ast.vhdl_constraint_t.ref_name")
1141
            | _ -> Result.Error "Vhdl_ast.vhdl_constraint_t")) arg0
1142
      | `List ((`String "RANGE_CONSTRAINT")::arg0::[]) ->
1143
          ((function
1144
            | `Assoc xs ->
1145
                let rec loop xs (arg0 as _state) =
1146
                  match xs with
1147
                  | ("range",x)::xs ->
1148
                      loop xs
1149
                        ((fun x  -> vhdl_discrete_range_t_of_yojson x) x)
1150
                  | [] ->
1151
                      arg0 >>=
1152
                        ((fun arg0  ->
1153
                            Result.Ok (RangeConstraint { range = arg0 })))
1154
                  | _::xs -> loop xs _state  in
1155
                loop xs (Result.Error "Vhdl_ast.vhdl_constraint_t.range")
1156
            | _ -> Result.Error "Vhdl_ast.vhdl_constraint_t")) arg0
1157
      | `List ((`String "INDEX_CONSTRAINT")::arg0::[]) ->
1158
          ((function
1159
            | `Assoc xs ->
1160
                let rec loop xs (arg0 as _state) =
1161
                  match xs with
1162
                  | ("ranges",x)::xs ->
1163
                      loop xs
1164
                        ((function
1165
                          | `List xs ->
1166
                              map_bind
1167
                                (fun x  -> vhdl_discrete_range_t_of_yojson x)
1168
                                [] xs
1169
                          | _ ->
1170
                              Result.Error
1171
                                "Vhdl_ast.vhdl_constraint_t.ranges") x)
1172
                  | [] ->
1173
                      arg0 >>=
1174
                        ((fun arg0  ->
1175
                            Result.Ok (IndexConstraint { ranges = arg0 })))
1176
                  | _::xs -> loop xs _state  in
1177
                loop xs (Result.Error "Vhdl_ast.vhdl_constraint_t.ranges")
1178
            | _ -> Result.Error "Vhdl_ast.vhdl_constraint_t")) arg0
1179
      | `List ((`String "ARRAY_CONSTRAINT")::arg0::[]) ->
1180
          ((function
1181
            | `Assoc xs ->
1182
                let rec loop xs ((arg0,arg1) as _state) =
1183
                  match xs with
1184
                  | ("ranges",x)::xs ->
1185
                      loop xs
1186
                        (((function
1187
                           | `List xs ->
1188
                               map_bind
1189
                                 (fun x  -> vhdl_discrete_range_t_of_yojson x)
1190
                                 [] xs
1191
                           | _ ->
1192
                               Result.Error
1193
                                 "Vhdl_ast.vhdl_constraint_t.ranges") x),
1194
                          arg1)
1195
                  | ("sub",x)::xs ->
1196
                      loop xs
1197
                        (arg0, ((fun x  -> vhdl_constraint_t_of_yojson x) x))
1198
                  | [] ->
1199
                      arg1 >>=
1200
                        ((fun arg1  ->
1201
                            arg0 >>=
1202
                              (fun arg0  ->
1203
                                 Result.Ok
1204
                                   (ArrayConstraint
1205
                                      { ranges = arg0; sub = arg1 }))))
1206
                  | _::xs -> loop xs _state  in
1207
                loop xs
1208
                  ((Result.Error "Vhdl_ast.vhdl_constraint_t.ranges"),
1209
                    (Result.Error "Vhdl_ast.vhdl_constraint_t.sub"))
1210
            | _ -> Result.Error "Vhdl_ast.vhdl_constraint_t")) arg0
1211
      | `List ((`String "RecordConstraint")::[]) ->
1212
          Result.Ok RecordConstraint
1213
      | `List ((`String "NoConstraint")::[]) -> Result.Ok NoConstraint
1214
      | _ -> Result.Error "Vhdl_ast.vhdl_constraint_t")
1215
  [@ocaml.warning "-A"])
1216

    
1217
and (vhdl_definition_t_to_yojson : vhdl_definition_t -> Yojson.Safe.json) =
1218
  ((let open! Ppx_deriving_yojson_runtime in
1219
      function
1220
      | Type arg0 ->
1221
          `List
1222
            [`String "TYPE_DECLARATION";
1223
            (let fields = []  in
1224
             let fields =
1225
               ("definition",
1226
                 ((fun x  -> vhdl_type_t_to_yojson x) arg0.definition))
1227
               :: fields  in
1228
             let fields =
1229
               ("name", ((fun x  -> vhdl_name_t_to_yojson x) arg0.name)) ::
1230
               fields  in
1231
             `Assoc fields)]
1232
      | Subtype arg0 ->
1233
          `List
1234
            [`String "SUBTYPE_DECLARATION";
1235
            (let fields = []  in
1236
             let fields =
1237
               ("typ",
1238
                 ((fun x  -> vhdl_subtype_indication_t_to_yojson x) arg0.typ))
1239
               :: fields  in
1240
             let fields =
1241
               ("name", ((fun x  -> vhdl_name_t_to_yojson x) arg0.name)) ::
1242
               fields  in
1243
             `Assoc fields)])
1244
  [@ocaml.warning "-A"])
1245

    
1246
and (vhdl_definition_t_of_yojson :
1247
      Yojson.Safe.json ->
1248
        vhdl_definition_t Ppx_deriving_yojson_runtime.error_or)
1249
  =
1250
  ((let open! Ppx_deriving_yojson_runtime in
1251
      function
1252
      | `List ((`String "TYPE_DECLARATION")::arg0::[]) ->
1253
          ((function
1254
            | `Assoc xs ->
1255
                let rec loop xs ((arg0,arg1) as _state) =
1256
                  match xs with
1257
                  | ("name",x)::xs ->
1258
                      loop xs (((fun x  -> vhdl_name_t_of_yojson x) x), arg1)
1259
                  | ("definition",x)::xs ->
1260
                      loop xs (arg0, ((fun x  -> vhdl_type_t_of_yojson x) x))
1261
                  | [] ->
1262
                      arg1 >>=
1263
                        ((fun arg1  ->
1264
                            arg0 >>=
1265
                              (fun arg0  ->
1266
                                 Result.Ok
1267
                                   (Type { name = arg0; definition = arg1 }))))
1268
                  | _::xs -> loop xs _state  in
1269
                loop xs
1270
                  ((Result.Error "Vhdl_ast.vhdl_definition_t.name"),
1271
                    (Result.Error "Vhdl_ast.vhdl_definition_t.definition"))
1272
            | _ -> Result.Error "Vhdl_ast.vhdl_definition_t")) arg0
1273
      | `List ((`String "SUBTYPE_DECLARATION")::arg0::[]) ->
1274
          ((function
1275
            | `Assoc xs ->
1276
                let rec loop xs ((arg0,arg1) as _state) =
1277
                  match xs with
1278
                  | ("name",x)::xs ->
1279
                      loop xs (((fun x  -> vhdl_name_t_of_yojson x) x), arg1)
1280
                  | ("typ",x)::xs ->
1281
                      loop xs
1282
                        (arg0,
1283
                          ((fun x  -> vhdl_subtype_indication_t_of_yojson x)
1284
                             x))
1285
                  | [] ->
1286
                      arg1 >>=
1287
                        ((fun arg1  ->
1288
                            arg0 >>=
1289
                              (fun arg0  ->
1290
                                 Result.Ok
1291
                                   (Subtype { name = arg0; typ = arg1 }))))
1292
                  | _::xs -> loop xs _state  in
1293
                loop xs
1294
                  ((Result.Error "Vhdl_ast.vhdl_definition_t.name"),
1295
                    (Result.Error "Vhdl_ast.vhdl_definition_t.typ"))
1296
            | _ -> Result.Error "Vhdl_ast.vhdl_definition_t")) arg0
1297
      | _ -> Result.Error "Vhdl_ast.vhdl_definition_t")
1298
  [@ocaml.warning "-A"])
1299

    
1300
and (vhdl_expr_t_to_yojson : vhdl_expr_t -> Yojson.Safe.json) =
1301
  ((let open! Ppx_deriving_yojson_runtime in
1302
      function
1303
      | Call arg0 ->
1304
          `List [`String "CALL"; ((fun x  -> vhdl_name_t_to_yojson x)) arg0]
1305
      | Cst arg0 ->
1306
          `List
1307
            [`String "CONSTANT_VALUE";
1308
            ((fun x  -> vhdl_cst_val_t_to_yojson x)) arg0]
1309
      | Op arg0 ->
1310
          `List
1311
            [`String "EXPRESSION";
1312
            (let fields = []  in
1313
             let fields =
1314
               if arg0.args = []
1315
               then fields
1316
               else
1317
                 ("args",
1318
                   (((fun x  ->
1319
                        `List
1320
                          (List.map (fun x  -> vhdl_expr_t_to_yojson x) x)))
1321
                      arg0.args))
1322
                 :: fields
1323
                in
1324
             let fields =
1325
               if arg0.id = ""
1326
               then fields
1327
               else
1328
                 ("id",
1329
                   (((fun (x : Ppx_deriving_runtime.string)  -> `String x))
1330
                      arg0.id))
1331
                 :: fields
1332
                in
1333
             `Assoc fields)]
1334
      | IsNull  -> `List [`String "IsNull"]
1335
      | Time arg0 ->
1336
          `List
1337
            [`String "Time";
1338
            (let fields = []  in
1339
             let fields =
1340
               if arg0.phy_unit = ""
1341
               then fields
1342
               else
1343
                 ("phy_unit",
1344
                   (((fun (x : Ppx_deriving_runtime.string)  -> `String x))
1345
                      arg0.phy_unit))
1346
                 :: fields
1347
                in
1348
             let fields =
1349
               ("value",
1350
                 ((fun (x : Ppx_deriving_runtime.int)  -> `Int x) arg0.value))
1351
               :: fields  in
1352
             `Assoc fields)]
1353
      | Sig arg0 ->
1354
          `List
1355
            [`String "Sig";
1356
            (let fields = []  in
1357
             let fields =
1358
               ("att",
1359
                 ((function
1360
                   | None  -> `Null
1361
                   | Some x ->
1362
                       ((fun x  -> vhdl_signal_attributes_t_to_yojson x)) x)
1363
                    arg0.att))
1364
               :: fields  in
1365
             let fields =
1366
               ("name", ((fun x  -> vhdl_name_t_to_yojson x) arg0.name)) ::
1367
               fields  in
1368
             `Assoc fields)]
1369
      | SuffixMod arg0 ->
1370
          `List
1371
            [`String "SuffixMod";
1372
            (let fields = []  in
1373
             let fields =
1374
               ("selection",
1375
                 ((fun x  -> vhdl_suffix_selection_t_to_yojson x)
1376
                    arg0.selection))
1377
               :: fields  in
1378
             let fields =
1379
               ("expr", ((fun x  -> vhdl_expr_t_to_yojson x) arg0.expr)) ::
1380
               fields  in
1381
             `Assoc fields)]
1382
      | Aggregate arg0 ->
1383
          `List
1384
            [`String "AGGREGATE";
1385
            (let fields = []  in
1386
             let fields =
1387
               ("elems",
1388
                 ((fun x  ->
1389
                     `List
1390
                       (List.map (fun x  -> vhdl_element_assoc_t_to_yojson x)
1391
                          x)) arg0.elems))
1392
               :: fields  in
1393
             `Assoc fields)]
1394
      | Others  -> `List [`String "OTHERS"])
1395
  [@ocaml.warning "-A"])
1396

    
1397
and (vhdl_expr_t_of_yojson :
1398
      Yojson.Safe.json -> vhdl_expr_t Ppx_deriving_yojson_runtime.error_or)
1399
  =
1400
  ((let open! Ppx_deriving_yojson_runtime in
1401
      function
1402
      | `List ((`String "CALL")::arg0::[]) ->
1403
          ((fun x  -> vhdl_name_t_of_yojson x) arg0) >>=
1404
            ((fun arg0  -> Result.Ok (Call arg0)))
1405
      | `List ((`String "CONSTANT_VALUE")::arg0::[]) ->
1406
          ((fun x  -> vhdl_cst_val_t_of_yojson x) arg0) >>=
1407
            ((fun arg0  -> Result.Ok (Cst arg0)))
1408
      | `List ((`String "EXPRESSION")::arg0::[]) ->
1409
          ((function
1410
            | `Assoc xs ->
1411
                let rec loop xs ((arg0,arg1) as _state) =
1412
                  match xs with
1413
                  | ("id",x)::xs ->
1414
                      loop xs
1415
                        (((function
1416
                           | `String x -> Result.Ok x
1417
                           | _ -> Result.Error "Vhdl_ast.vhdl_expr_t.id") x),
1418
                          arg1)
1419
                  | ("args",x)::xs ->
1420
                      loop xs
1421
                        (arg0,
1422
                          ((function
1423
                            | `List xs ->
1424
                                map_bind (fun x  -> vhdl_expr_t_of_yojson x)
1425
                                  [] xs
1426
                            | _ -> Result.Error "Vhdl_ast.vhdl_expr_t.args")
1427
                             x))
1428
                  | [] ->
1429
                      arg1 >>=
1430
                        ((fun arg1  ->
1431
                            arg0 >>=
1432
                              (fun arg0  ->
1433
                                 Result.Ok (Op { id = arg0; args = arg1 }))))
1434
                  | _::xs -> loop xs _state  in
1435
                loop xs ((Result.Ok ""), (Result.Ok []))
1436
            | _ -> Result.Error "Vhdl_ast.vhdl_expr_t")) arg0
1437
      | `List ((`String "IsNull")::[]) -> Result.Ok IsNull
1438
      | `List ((`String "Time")::arg0::[]) ->
1439
          ((function
1440
            | `Assoc xs ->
1441
                let rec loop xs ((arg0,arg1) as _state) =
1442
                  match xs with
1443
                  | ("value",x)::xs ->
1444
                      loop xs
1445
                        (((function
1446
                           | `Int x -> Result.Ok x
1447
                           | _ -> Result.Error "Vhdl_ast.vhdl_expr_t.value")
1448
                            x), arg1)
1449
                  | ("phy_unit",x)::xs ->
1450
                      loop xs
1451
                        (arg0,
1452
                          ((function
1453
                            | `String x -> Result.Ok x
1454
                            | _ ->
1455
                                Result.Error "Vhdl_ast.vhdl_expr_t.phy_unit")
1456
                             x))
1457
                  | [] ->
1458
                      arg1 >>=
1459
                        ((fun arg1  ->
1460
                            arg0 >>=
1461
                              (fun arg0  ->
1462
                                 Result.Ok
1463
                                   (Time { value = arg0; phy_unit = arg1 }))))
1464
                  | _::xs -> loop xs _state  in
1465
                loop xs
1466
                  ((Result.Error "Vhdl_ast.vhdl_expr_t.value"),
1467
                    (Result.Ok ""))
1468
            | _ -> Result.Error "Vhdl_ast.vhdl_expr_t")) arg0
1469
      | `List ((`String "Sig")::arg0::[]) ->
1470
          ((function
1471
            | `Assoc xs ->
1472
                let rec loop xs ((arg0,arg1) as _state) =
1473
                  match xs with
1474
                  | ("name",x)::xs ->
1475
                      loop xs (((fun x  -> vhdl_name_t_of_yojson x) x), arg1)
1476
                  | ("att",x)::xs ->
1477
                      loop xs
1478
                        (arg0,
1479
                          ((function
1480
                            | `Null -> Result.Ok None
1481
                            | x ->
1482
                                ((fun x  ->
1483
                                    vhdl_signal_attributes_t_of_yojson x) x)
1484
                                  >>= ((fun x  -> Result.Ok (Some x)))) x))
1485
                  | [] ->
1486
                      arg1 >>=
1487
                        ((fun arg1  ->
1488
                            arg0 >>=
1489
                              (fun arg0  ->
1490
                                 Result.Ok (Sig { name = arg0; att = arg1 }))))
1491
                  | _::xs -> loop xs _state  in
1492
                loop xs
1493
                  ((Result.Error "Vhdl_ast.vhdl_expr_t.name"),
1494
                    (Result.Error "Vhdl_ast.vhdl_expr_t.att"))
1495
            | _ -> Result.Error "Vhdl_ast.vhdl_expr_t")) arg0
1496
      | `List ((`String "SuffixMod")::arg0::[]) ->
1497
          ((function
1498
            | `Assoc xs ->
1499
                let rec loop xs ((arg0,arg1) as _state) =
1500
                  match xs with
1501
                  | ("expr",x)::xs ->
1502
                      loop xs (((fun x  -> vhdl_expr_t_of_yojson x) x), arg1)
1503
                  | ("selection",x)::xs ->
1504
                      loop xs
1505
                        (arg0,
1506
                          ((fun x  -> vhdl_suffix_selection_t_of_yojson x) x))
1507
                  | [] ->
1508
                      arg1 >>=
1509
                        ((fun arg1  ->
1510
                            arg0 >>=
1511
                              (fun arg0  ->
1512
                                 Result.Ok
1513
                                   (SuffixMod
1514
                                      { expr = arg0; selection = arg1 }))))
1515
                  | _::xs -> loop xs _state  in
1516
                loop xs
1517
                  ((Result.Error "Vhdl_ast.vhdl_expr_t.expr"),
1518
                    (Result.Error "Vhdl_ast.vhdl_expr_t.selection"))
1519
            | _ -> Result.Error "Vhdl_ast.vhdl_expr_t")) arg0
1520
      | `List ((`String "AGGREGATE")::arg0::[]) ->
1521
          ((function
1522
            | `Assoc xs ->
1523
                let rec loop xs (arg0 as _state) =
1524
                  match xs with
1525
                  | ("elems",x)::xs ->
1526
                      loop xs
1527
                        ((function
1528
                          | `List xs ->
1529
                              map_bind
1530
                                (fun x  -> vhdl_element_assoc_t_of_yojson x)
1531
                                [] xs
1532
                          | _ -> Result.Error "Vhdl_ast.vhdl_expr_t.elems") x)
1533
                  | [] ->
1534
                      arg0 >>=
1535
                        ((fun arg0  -> Result.Ok (Aggregate { elems = arg0 })))
1536
                  | _::xs -> loop xs _state  in
1537
                loop xs (Result.Error "Vhdl_ast.vhdl_expr_t.elems")
1538
            | _ -> Result.Error "Vhdl_ast.vhdl_expr_t")) arg0
1539
      | `List ((`String "OTHERS")::[]) -> Result.Ok Others
1540
      | _ -> Result.Error "Vhdl_ast.vhdl_expr_t")
1541
  [@ocaml.warning "-A"])
1542

    
1543
and (vhdl_name_t_to_yojson : vhdl_name_t -> Yojson.Safe.json) =
1544
  ((let open! Ppx_deriving_yojson_runtime in
1545
      function
1546
      | Simple arg0 ->
1547
          `List
1548
            [`String "SIMPLE_NAME";
1549
            ((fun (x : Ppx_deriving_runtime.string)  -> `String x)) arg0]
1550
      | Identifier arg0 ->
1551
          `List
1552
            [`String "IDENTIFIER";
1553
            ((fun (x : Ppx_deriving_runtime.string)  -> `String x)) arg0]
1554
      | Selected arg0 ->
1555
          `List
1556
            [`String "SELECTED_NAME";
1557
            ((fun x  ->
1558
                `List (List.map (fun x  -> vhdl_name_t_to_yojson x) x))) arg0]
1559
      | Index arg0 ->
1560
          `List
1561
            [`String "INDEXED_NAME";
1562
            (let fields = []  in
1563
             let fields =
1564
               ("exprs",
1565
                 ((fun x  ->
1566
                     `List (List.map (fun x  -> vhdl_expr_t_to_yojson x) x))
1567
                    arg0.exprs))
1568
               :: fields  in
1569
             let fields =
1570
               ("id", ((fun x  -> vhdl_name_t_to_yojson x) arg0.id)) ::
1571
               fields  in
1572
             `Assoc fields)]
1573
      | Slice arg0 ->
1574
          `List
1575
            [`String "SLICE_NAME";
1576
            (let fields = []  in
1577
             let fields =
1578
               ("range",
1579
                 ((fun x  -> vhdl_discrete_range_t_to_yojson x) arg0.range))
1580
               :: fields  in
1581
             let fields =
1582
               ("id", ((fun x  -> vhdl_name_t_to_yojson x) arg0.id)) ::
1583
               fields  in
1584
             `Assoc fields)]
1585
      | Attribute arg0 ->
1586
          `List
1587
            [`String "ATTRIBUTE_NAME";
1588
            (let fields = []  in
1589
             let fields =
1590
               if arg0.expr = IsNull
1591
               then fields
1592
               else
1593
                 ("expr", (((fun x  -> vhdl_expr_t_to_yojson x)) arg0.expr))
1594
                 :: fields
1595
                in
1596
             let fields =
1597
               ("designator",
1598
                 ((fun x  -> vhdl_name_t_to_yojson x) arg0.designator))
1599
               :: fields  in
1600
             let fields =
1601
               ("id", ((fun x  -> vhdl_name_t_to_yojson x) arg0.id)) ::
1602
               fields  in
1603
             `Assoc fields)]
1604
      | Function arg0 ->
1605
          `List
1606
            [`String "FUNCTION_CALL";
1607
            (let fields = []  in
1608
             let fields =
1609
               ("assoc_list",
1610
                 ((fun x  ->
1611
                     `List
1612
                       (List.map (fun x  -> vhdl_assoc_element_t_to_yojson x)
1613
                          x)) arg0.assoc_list))
1614
               :: fields  in
1615
             let fields =
1616
               ("id", ((fun x  -> vhdl_name_t_to_yojson x) arg0.id)) ::
1617
               fields  in
1618
             `Assoc fields)]
1619
      | NoName  -> `List [`String "NoName"])
1620
  [@ocaml.warning "-A"])
1621

    
1622
and (vhdl_name_t_of_yojson :
1623
      Yojson.Safe.json -> vhdl_name_t Ppx_deriving_yojson_runtime.error_or)
1624
  =
1625
  ((let open! Ppx_deriving_yojson_runtime in
1626
      function
1627
      | `List ((`String "SIMPLE_NAME")::arg0::[]) ->
1628
          ((function
1629
            | `String x -> Result.Ok x
1630
            | _ -> Result.Error "Vhdl_ast.vhdl_name_t") arg0) >>=
1631
            ((fun arg0  -> Result.Ok (Simple arg0)))
1632
      | `List ((`String "IDENTIFIER")::arg0::[]) ->
1633
          ((function
1634
            | `String x -> Result.Ok x
1635
            | _ -> Result.Error "Vhdl_ast.vhdl_name_t") arg0) >>=
1636
            ((fun arg0  -> Result.Ok (Identifier arg0)))
1637
      | `List ((`String "SELECTED_NAME")::arg0::[]) ->
1638
          ((function
1639
            | `List xs -> map_bind (fun x  -> vhdl_name_t_of_yojson x) [] xs
1640
            | _ -> Result.Error "Vhdl_ast.vhdl_name_t") arg0) >>=
1641
            ((fun arg0  -> Result.Ok (Selected arg0)))
1642
      | `List ((`String "INDEXED_NAME")::arg0::[]) ->
1643
          ((function
1644
            | `Assoc xs ->
1645
                let rec loop xs ((arg0,arg1) as _state) =
1646
                  match xs with
1647
                  | ("id",x)::xs ->
1648
                      loop xs (((fun x  -> vhdl_name_t_of_yojson x) x), arg1)
1649
                  | ("exprs",x)::xs ->
1650
                      loop xs
1651
                        (arg0,
1652
                          ((function
1653
                            | `List xs ->
1654
                                map_bind (fun x  -> vhdl_expr_t_of_yojson x)
1655
                                  [] xs
1656
                            | _ -> Result.Error "Vhdl_ast.vhdl_name_t.exprs")
1657
                             x))
1658
                  | [] ->
1659
                      arg1 >>=
1660
                        ((fun arg1  ->
1661
                            arg0 >>=
1662
                              (fun arg0  ->
1663
                                 Result.Ok
1664
                                   (Index { id = arg0; exprs = arg1 }))))
1665
                  | _::xs -> loop xs _state  in
1666
                loop xs
1667
                  ((Result.Error "Vhdl_ast.vhdl_name_t.id"),
1668
                    (Result.Error "Vhdl_ast.vhdl_name_t.exprs"))
1669
            | _ -> Result.Error "Vhdl_ast.vhdl_name_t")) arg0
1670
      | `List ((`String "SLICE_NAME")::arg0::[]) ->
1671
          ((function
1672
            | `Assoc xs ->
1673
                let rec loop xs ((arg0,arg1) as _state) =
1674
                  match xs with
1675
                  | ("id",x)::xs ->
1676
                      loop xs (((fun x  -> vhdl_name_t_of_yojson x) x), arg1)
1677
                  | ("range",x)::xs ->
1678
                      loop xs
1679
                        (arg0,
1680
                          ((fun x  -> vhdl_discrete_range_t_of_yojson x) x))
1681
                  | [] ->
1682
                      arg1 >>=
1683
                        ((fun arg1  ->
1684
                            arg0 >>=
1685
                              (fun arg0  ->
1686
                                 Result.Ok
1687
                                   (Slice { id = arg0; range = arg1 }))))
1688
                  | _::xs -> loop xs _state  in
1689
                loop xs
1690
                  ((Result.Error "Vhdl_ast.vhdl_name_t.id"),
1691
                    (Result.Error "Vhdl_ast.vhdl_name_t.range"))
1692
            | _ -> Result.Error "Vhdl_ast.vhdl_name_t")) arg0
1693
      | `List ((`String "ATTRIBUTE_NAME")::arg0::[]) ->
1694
          ((function
1695
            | `Assoc xs ->
1696
                let rec loop xs ((arg0,arg1,arg2) as _state) =
1697
                  match xs with
1698
                  | ("id",x)::xs ->
1699
                      loop xs
1700
                        (((fun x  -> vhdl_name_t_of_yojson x) x), arg1, arg2)
1701
                  | ("designator",x)::xs ->
1702
                      loop xs
1703
                        (arg0, ((fun x  -> vhdl_name_t_of_yojson x) x), arg2)
1704
                  | ("expr",x)::xs ->
1705
                      loop xs
1706
                        (arg0, arg1, ((fun x  -> vhdl_expr_t_of_yojson x) x))
1707
                  | [] ->
1708
                      arg2 >>=
1709
                        ((fun arg2  ->
1710
                            arg1 >>=
1711
                              (fun arg1  ->
1712
                                 arg0 >>=
1713
                                   (fun arg0  ->
1714
                                      Result.Ok
1715
                                        (Attribute
1716
                                           {
1717
                                             id = arg0;
1718
                                             designator = arg1;
1719
                                             expr = arg2
1720
                                           })))))
1721
                  | _::xs -> loop xs _state  in
1722
                loop xs
1723
                  ((Result.Error "Vhdl_ast.vhdl_name_t.id"),
1724
                    (Result.Error "Vhdl_ast.vhdl_name_t.designator"),
1725
                    (Result.Ok IsNull))
1726
            | _ -> Result.Error "Vhdl_ast.vhdl_name_t")) arg0
1727
      | `List ((`String "FUNCTION_CALL")::arg0::[]) ->
1728
          ((function
1729
            | `Assoc xs ->
1730
                let rec loop xs ((arg0,arg1) as _state) =
1731
                  match xs with
1732
                  | ("id",x)::xs ->
1733
                      loop xs (((fun x  -> vhdl_name_t_of_yojson x) x), arg1)
1734
                  | ("assoc_list",x)::xs ->
1735
                      loop xs
1736
                        (arg0,
1737
                          ((function
1738
                            | `List xs ->
1739
                                map_bind
1740
                                  (fun x  -> vhdl_assoc_element_t_of_yojson x)
1741
                                  [] xs
1742
                            | _ ->
1743
                                Result.Error
1744
                                  "Vhdl_ast.vhdl_name_t.assoc_list") x))
1745
                  | [] ->
1746
                      arg1 >>=
1747
                        ((fun arg1  ->
1748
                            arg0 >>=
1749
                              (fun arg0  ->
1750
                                 Result.Ok
1751
                                   (Function { id = arg0; assoc_list = arg1 }))))
1752
                  | _::xs -> loop xs _state  in
1753
                loop xs
1754
                  ((Result.Error "Vhdl_ast.vhdl_name_t.id"),
1755
                    (Result.Error "Vhdl_ast.vhdl_name_t.assoc_list"))
1756
            | _ -> Result.Error "Vhdl_ast.vhdl_name_t")) arg0
1757
      | `List ((`String "NoName")::[]) -> Result.Ok NoName
1758
      | _ -> Result.Error "Vhdl_ast.vhdl_name_t")
1759
  [@ocaml.warning "-A"])
1760

    
1761
and (vhdl_assoc_element_t_to_yojson :
1762
      vhdl_assoc_element_t -> Yojson.Safe.json)
1763
  =
1764
  ((let open! Ppx_deriving_yojson_runtime in
1765
      fun x  ->
1766
        let fields = []  in
1767
        let fields =
1768
          if x.actual_expr = (Some IsNull)
1769
          then fields
1770
          else
1771
            ("actual_expr",
1772
              (((function
1773
                 | None  -> `Null
1774
                 | Some x -> ((fun x  -> vhdl_expr_t_to_yojson x)) x))
1775
                 x.actual_expr))
1776
            :: fields
1777
           in
1778
        let fields =
1779
          if x.actual_designator = (Some NoName)
1780
          then fields
1781
          else
1782
            ("actual_designator",
1783
              (((function
1784
                 | None  -> `Null
1785
                 | Some x -> ((fun x  -> vhdl_name_t_to_yojson x)) x))
1786
                 x.actual_designator))
1787
            :: fields
1788
           in
1789
        let fields =
1790
          if x.actual_name = (Some NoName)
1791
          then fields
1792
          else
1793
            ("actual_name",
1794
              (((function
1795
                 | None  -> `Null
1796
                 | Some x -> ((fun x  -> vhdl_name_t_to_yojson x)) x))
1797
                 x.actual_name))
1798
            :: fields
1799
           in
1800
        let fields =
1801
          if x.formal_arg = (Some NoName)
1802
          then fields
1803
          else
1804
            ("formal_arg",
1805
              (((function
1806
                 | None  -> `Null
1807
                 | Some x -> ((fun x  -> vhdl_name_t_to_yojson x)) x))
1808
                 x.formal_arg))
1809
            :: fields
1810
           in
1811
        let fields =
1812
          if x.formal_name = (Some NoName)
1813
          then fields
1814
          else
1815
            ("formal_name",
1816
              (((function
1817
                 | None  -> `Null
1818
                 | Some x -> ((fun x  -> vhdl_name_t_to_yojson x)) x))
1819
                 x.formal_name))
1820
            :: fields
1821
           in
1822
        `Assoc fields)
1823
  [@ocaml.warning "-A"])
1824

    
1825
and (vhdl_assoc_element_t_of_yojson :
1826
      Yojson.Safe.json ->
1827
        vhdl_assoc_element_t Ppx_deriving_yojson_runtime.error_or)
1828
  =
1829
  ((let open! Ppx_deriving_yojson_runtime in
1830
      function
1831
      | `Assoc xs ->
1832
          let rec loop xs ((arg0,arg1,arg2,arg3,arg4) as _state) =
1833
            match xs with
1834
            | ("formal_name",x)::xs ->
1835
                loop xs
1836
                  (((function
1837
                     | `Null -> Result.Ok None
1838
                     | x ->
1839
                         ((fun x  -> vhdl_name_t_of_yojson x) x) >>=
1840
                           ((fun x  -> Result.Ok (Some x)))) x), arg1, arg2,
1841
                    arg3, arg4)
1842
            | ("formal_arg",x)::xs ->
1843
                loop xs
1844
                  (arg0,
1845
                    ((function
1846
                      | `Null -> Result.Ok None
1847
                      | x ->
1848
                          ((fun x  -> vhdl_name_t_of_yojson x) x) >>=
1849
                            ((fun x  -> Result.Ok (Some x)))) x), arg2, arg3,
1850
                    arg4)
1851
            | ("actual_name",x)::xs ->
1852
                loop xs
1853
                  (arg0, arg1,
1854
                    ((function
1855
                      | `Null -> Result.Ok None
1856
                      | x ->
1857
                          ((fun x  -> vhdl_name_t_of_yojson x) x) >>=
1858
                            ((fun x  -> Result.Ok (Some x)))) x), arg3, arg4)
1859
            | ("actual_designator",x)::xs ->
1860
                loop xs
1861
                  (arg0, arg1, arg2,
1862
                    ((function
1863
                      | `Null -> Result.Ok None
1864
                      | x ->
1865
                          ((fun x  -> vhdl_name_t_of_yojson x) x) >>=
1866
                            ((fun x  -> Result.Ok (Some x)))) x), arg4)
1867
            | ("actual_expr",x)::xs ->
1868
                loop xs
1869
                  (arg0, arg1, arg2, arg3,
1870
                    ((function
1871
                      | `Null -> Result.Ok None
1872
                      | x ->
1873
                          ((fun x  -> vhdl_expr_t_of_yojson x) x) >>=
1874
                            ((fun x  -> Result.Ok (Some x)))) x))
1875
            | [] ->
1876
                arg4 >>=
1877
                  ((fun arg4  ->
1878
                      arg3 >>=
1879
                        (fun arg3  ->
1880
                           arg2 >>=
1881
                             (fun arg2  ->
1882
                                arg1 >>=
1883
                                  (fun arg1  ->
1884
                                     arg0 >>=
1885
                                       (fun arg0  ->
1886
                                          Result.Ok
1887
                                            {
1888
                                              formal_name = arg0;
1889
                                              formal_arg = arg1;
1890
                                              actual_name = arg2;
1891
                                              actual_designator = arg3;
1892
                                              actual_expr = arg4
1893
                                            }))))))
1894
            | _::xs -> loop xs _state  in
1895
          loop xs
1896
            ((Result.Ok (Some NoName)), (Result.Ok (Some NoName)),
1897
              (Result.Ok (Some NoName)), (Result.Ok (Some NoName)),
1898
              (Result.Ok (Some IsNull)))
1899
      | _ -> Result.Error "Vhdl_ast.vhdl_assoc_element_t")
1900
  [@ocaml.warning "-A"])
1901

    
1902
and (vhdl_element_assoc_t_to_yojson :
1903
      vhdl_element_assoc_t -> Yojson.Safe.json)
1904
  =
1905
  ((let open! Ppx_deriving_yojson_runtime in
1906
      fun x  ->
1907
        let fields = []  in
1908
        let fields = ("expr", ((fun x  -> vhdl_expr_t_to_yojson x) x.expr))
1909
          :: fields  in
1910
        let fields =
1911
          ("choices",
1912
            ((fun x  ->
1913
                `List (List.map (fun x  -> vhdl_expr_t_to_yojson x) x))
1914
               x.choices))
1915
          :: fields  in
1916
        `Assoc fields)
1917
  [@ocaml.warning "-A"])
1918

    
1919
and (vhdl_element_assoc_t_of_yojson :
1920
      Yojson.Safe.json ->
1921
        vhdl_element_assoc_t Ppx_deriving_yojson_runtime.error_or)
1922
  =
1923
  ((let open! Ppx_deriving_yojson_runtime in
1924
      function
1925
      | `Assoc xs ->
1926
          let rec loop xs ((arg0,arg1) as _state) =
1927
            match xs with
1928
            | ("choices",x)::xs ->
1929
                loop xs
1930
                  (((function
1931
                     | `List xs ->
1932
                         map_bind (fun x  -> vhdl_expr_t_of_yojson x) [] xs
1933
                     | _ ->
1934
                         Result.Error "Vhdl_ast.vhdl_element_assoc_t.choices")
1935
                      x), arg1)
1936
            | ("expr",x)::xs ->
1937
                loop xs (arg0, ((fun x  -> vhdl_expr_t_of_yojson x) x))
1938
            | [] ->
1939
                arg1 >>=
1940
                  ((fun arg1  ->
1941
                      arg0 >>=
1942
                        (fun arg0  ->
1943
                           Result.Ok { choices = arg0; expr = arg1 })))
1944
            | _::xs -> loop xs _state  in
1945
          loop xs
1946
            ((Result.Error "Vhdl_ast.vhdl_element_assoc_t.choices"),
1947
              (Result.Error "Vhdl_ast.vhdl_element_assoc_t.expr"))
1948
      | _ -> Result.Error "Vhdl_ast.vhdl_element_assoc_t")
1949
  [@ocaml.warning "-A"])
1950

    
1951
and (vhdl_array_attributes_t_to_yojson :
1952
      vhdl_array_attributes_t -> Yojson.Safe.json)
1953
  =
1954
  ((let open! Ppx_deriving_yojson_runtime in
1955
      function
1956
      | AAttInt arg0 ->
1957
          `List
1958
            [`String "AAttInt";
1959
            (let fields = []  in
1960
             let fields =
1961
               ("arg",
1962
                 ((fun (x : Ppx_deriving_runtime.int)  -> `Int x) arg0.arg))
1963
               :: fields  in
1964
             let fields =
1965
               ("id",
1966
                 ((fun (x : Ppx_deriving_runtime.string)  -> `String x)
1967
                    arg0.id))
1968
               :: fields  in
1969
             `Assoc fields)]
1970
      | AAttAscending  -> `List [`String "AAttAscending"])
1971
  [@ocaml.warning "-A"])
1972

    
1973
and (vhdl_array_attributes_t_of_yojson :
1974
      Yojson.Safe.json ->
1975
        vhdl_array_attributes_t Ppx_deriving_yojson_runtime.error_or)
1976
  =
1977
  ((let open! Ppx_deriving_yojson_runtime in
1978
      function
1979
      | `List ((`String "AAttInt")::arg0::[]) ->
1980
          ((function
1981
            | `Assoc xs ->
1982
                let rec loop xs ((arg0,arg1) as _state) =
1983
                  match xs with
1984
                  | ("id",x)::xs ->
1985
                      loop xs
1986
                        (((function
1987
                           | `String x -> Result.Ok x
1988
                           | _ ->
1989
                               Result.Error
1990
                                 "Vhdl_ast.vhdl_array_attributes_t.id") x),
1991
                          arg1)
1992
                  | ("arg",x)::xs ->
1993
                      loop xs
1994
                        (arg0,
1995
                          ((function
1996
                            | `Int x -> Result.Ok x
1997
                            | _ ->
1998
                                Result.Error
1999
                                  "Vhdl_ast.vhdl_array_attributes_t.arg") x))
2000
                  | [] ->
2001
                      arg1 >>=
2002
                        ((fun arg1  ->
2003
                            arg0 >>=
2004
                              (fun arg0  ->
2005
                                 Result.Ok
2006
                                   (AAttInt { id = arg0; arg = arg1 }))))
2007
                  | _::xs -> loop xs _state  in
2008
                loop xs
2009
                  ((Result.Error "Vhdl_ast.vhdl_array_attributes_t.id"),
2010
                    (Result.Error "Vhdl_ast.vhdl_array_attributes_t.arg"))
2011
            | _ -> Result.Error "Vhdl_ast.vhdl_array_attributes_t")) arg0
2012
      | `List ((`String "AAttAscending")::[]) -> Result.Ok AAttAscending
2013
      | _ -> Result.Error "Vhdl_ast.vhdl_array_attributes_t")
2014
  [@ocaml.warning "-A"])
2015

    
2016
and (vhdl_signal_attributes_t_to_yojson :
2017
      vhdl_signal_attributes_t -> Yojson.Safe.json)
2018
  =
2019
  ((let open! Ppx_deriving_yojson_runtime in
2020
      function
2021
      | SigAtt arg0 ->
2022
          `List
2023
            [`String "SigAtt";
2024
            ((fun (x : Ppx_deriving_runtime.string)  -> `String x)) arg0])
2025
  [@ocaml.warning "-A"])
2026

    
2027
and (vhdl_signal_attributes_t_of_yojson :
2028
      Yojson.Safe.json ->
2029
        vhdl_signal_attributes_t Ppx_deriving_yojson_runtime.error_or)
2030
  =
2031
  ((let open! Ppx_deriving_yojson_runtime in
2032
      function
2033
      | `List ((`String "SigAtt")::arg0::[]) ->
2034
          ((function
2035
            | `String x -> Result.Ok x
2036
            | _ -> Result.Error "Vhdl_ast.vhdl_signal_attributes_t") arg0)
2037
            >>= ((fun arg0  -> Result.Ok (SigAtt arg0)))
2038
      | _ -> Result.Error "Vhdl_ast.vhdl_signal_attributes_t")
2039
  [@ocaml.warning "-A"])
2040

    
2041
and (vhdl_string_attributes_t_to_yojson :
2042
      vhdl_string_attributes_t -> Yojson.Safe.json)
2043
  =
2044
  ((let open! Ppx_deriving_yojson_runtime in
2045
      function
2046
      | StringAtt arg0 ->
2047
          `List
2048
            [`String "StringAtt";
2049
            ((fun (x : Ppx_deriving_runtime.string)  -> `String x)) arg0])
2050
  [@ocaml.warning "-A"])
2051

    
2052
and (vhdl_string_attributes_t_of_yojson :
2053
      Yojson.Safe.json ->
2054
        vhdl_string_attributes_t Ppx_deriving_yojson_runtime.error_or)
2055
  =
2056
  ((let open! Ppx_deriving_yojson_runtime in
2057
      function
2058
      | `List ((`String "StringAtt")::arg0::[]) ->
2059
          ((function
2060
            | `String x -> Result.Ok x
2061
            | _ -> Result.Error "Vhdl_ast.vhdl_string_attributes_t") arg0)
2062
            >>= ((fun arg0  -> Result.Ok (StringAtt arg0)))
2063
      | _ -> Result.Error "Vhdl_ast.vhdl_string_attributes_t")
2064
  [@ocaml.warning "-A"])
2065

    
2066
and (vhdl_suffix_selection_t_to_yojson :
2067
      vhdl_suffix_selection_t -> Yojson.Safe.json)
2068
  =
2069
  ((let open! Ppx_deriving_yojson_runtime in
2070
      function
2071
      | Idx arg0 ->
2072
          `List
2073
            [`String "Idx";
2074
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg0]
2075
      | SuffixRange (arg0,arg1) ->
2076
          `List
2077
            [`String "SuffixRange";
2078
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg0;
2079
            ((fun (x : Ppx_deriving_runtime.int)  -> `Int x)) arg1])
2080
  [@ocaml.warning "-A"])
2081

    
2082
and (vhdl_suffix_selection_t_of_yojson :
2083
      Yojson.Safe.json ->
2084
        vhdl_suffix_selection_t Ppx_deriving_yojson_runtime.error_or)
2085
  =
2086
  ((let open! Ppx_deriving_yojson_runtime in
2087
      function
2088
      | `List ((`String "Idx")::arg0::[]) ->
2089
          ((function
2090
            | `Int x -> Result.Ok x
2091
            | _ -> Result.Error "Vhdl_ast.vhdl_suffix_selection_t") arg0) >>=
2092
            ((fun arg0  -> Result.Ok (Idx arg0)))
2093
      | `List ((`String "SuffixRange")::arg0::arg1::[]) ->
2094
          ((function
2095
            | `Int x -> Result.Ok x
2096
            | _ -> Result.Error "Vhdl_ast.vhdl_suffix_selection_t") arg1) >>=
2097
            ((fun arg1  ->
2098
                ((function
2099
                  | `Int x -> Result.Ok x
2100
                  | _ -> Result.Error "Vhdl_ast.vhdl_suffix_selection_t")
2101
                   arg0)
2102
                  >>= (fun arg0  -> Result.Ok (SuffixRange (arg0, arg1)))))
2103
      | _ -> Result.Error "Vhdl_ast.vhdl_suffix_selection_t")
2104
  [@ocaml.warning "-A"])
2105

    
2106
type 'basetype vhdl_type_attributes_t =
2107
  | TAttNoArg of {
2108
  id: string } 
2109
  | TAttIntArg of {
2110
  id: string ;
2111
  arg: int } 
2112
  | TAttValArg of {
2113
  id: string ;
2114
  arg: 'basetype } 
2115
  | TAttStringArg of {
2116
  id: string ;
2117
  arg: string } 
2118

    
2119
let rec pp_vhdl_type_attributes_t
2120
  =
2121
  ((let open! Ppx_deriving_runtime in
2122
      fun poly_basetype  ->
2123
        fun fmt  ->
2124
          function
2125
          | TAttNoArg { id = aid } ->
2126
              (Format.fprintf fmt "@[<2>TAttNoArg {@,";
2127
               (Format.fprintf fmt "@[%s =@ " "id";
2128
                (Format.fprintf fmt "%S") aid;
2129
                Format.fprintf fmt "@]");
2130
               Format.fprintf fmt "@]}")
2131
          | TAttIntArg { id = aid; arg = aarg } ->
2132
              (Format.fprintf fmt "@[<2>TAttIntArg {@,";
2133
               ((Format.fprintf fmt "@[%s =@ " "id";
2134
                 (Format.fprintf fmt "%S") aid;
2135
                 Format.fprintf fmt "@]");
2136
                Format.fprintf fmt ";@ ";
2137
                Format.fprintf fmt "@[%s =@ " "arg";
2138
                (Format.fprintf fmt "%d") aarg;
2139
                Format.fprintf fmt "@]");
2140
               Format.fprintf fmt "@]}")
2141
          | TAttValArg { id = aid; arg = aarg } ->
2142
              (Format.fprintf fmt "@[<2>TAttValArg {@,";
2143
               ((Format.fprintf fmt "@[%s =@ " "id";
2144
                 (Format.fprintf fmt "%S") aid;
2145
                 Format.fprintf fmt "@]");
2146
                Format.fprintf fmt ";@ ";
2147
                Format.fprintf fmt "@[%s =@ " "arg";
2148
                (poly_basetype fmt) aarg;
2149
                Format.fprintf fmt "@]");
2150
               Format.fprintf fmt "@]}")
2151
          | TAttStringArg { id = aid; arg = aarg } ->
2152
              (Format.fprintf fmt "@[<2>TAttStringArg {@,";
2153
               ((Format.fprintf fmt "@[%s =@ " "id";
2154
                 (Format.fprintf fmt "%S") aid;
2155
                 Format.fprintf fmt "@]");
2156
                Format.fprintf fmt ";@ ";
2157
                Format.fprintf fmt "@[%s =@ " "arg";
2158
                (Format.fprintf fmt "%S") aarg;
2159
                Format.fprintf fmt "@]");
2160
               Format.fprintf fmt "@]}"))
2161
  [@ocaml.warning "-A"])
2162

    
2163
and show_vhdl_type_attributes_t  =
2164
  fun poly_basetype  ->
2165
    fun x  ->
2166
      Format.asprintf "%a" (pp_vhdl_type_attributes_t poly_basetype) x
2167

    
2168
let rec vhdl_type_attributes_t_to_yojson :
2169
  'basetype .
2170
    ('basetype -> Yojson.Safe.json) ->
2171
      'basetype vhdl_type_attributes_t -> Yojson.Safe.json
2172
  =
2173
  fun poly_basetype  ->
2174
    ((let open! Ppx_deriving_yojson_runtime in
2175
        function
2176
        | TAttNoArg arg0 ->
2177
            `List
2178
              [`String "TAttNoArg";
2179
              (let fields = []  in
2180
               let fields =
2181
                 ("id",
2182
                   ((fun (x : Ppx_deriving_runtime.string)  -> `String x)
2183
                      arg0.id))
2184
                 :: fields  in
2185
               `Assoc fields)]
2186
        | TAttIntArg arg0 ->
2187
            `List
2188
              [`String "TAttIntArg";
2189
              (let fields = []  in
2190
               let fields =
2191
                 ("arg",
2192
                   ((fun (x : Ppx_deriving_runtime.int)  -> `Int x) arg0.arg))
2193
                 :: fields  in
2194
               let fields =
2195
                 ("id",
2196
                   ((fun (x : Ppx_deriving_runtime.string)  -> `String x)
2197
                      arg0.id))
2198
                 :: fields  in
2199
               `Assoc fields)]
2200
        | TAttValArg arg0 ->
2201
            `List
2202
              [`String "TAttValArg";
2203
              (let fields = []  in
2204
               let fields =
2205
                 ("arg", ((poly_basetype : _ -> Yojson.Safe.json) arg0.arg))
2206
                 :: fields  in
2207
               let fields =
2208
                 ("id",
2209
                   ((fun (x : Ppx_deriving_runtime.string)  -> `String x)
2210
                      arg0.id))
2211
                 :: fields  in
2212
               `Assoc fields)]
2213
        | TAttStringArg arg0 ->
2214
            `List
2215
              [`String "TAttStringArg";
2216
              (let fields = []  in
2217
               let fields =
2218
                 ("arg",
2219
                   ((fun (x : Ppx_deriving_runtime.string)  -> `String x)
2220
                      arg0.arg))
2221
                 :: fields  in
2222
               let fields =
2223
                 ("id",
2224
                   ((fun (x : Ppx_deriving_runtime.string)  -> `String x)
2225
                      arg0.id))
2226
                 :: fields  in
2227
               `Assoc fields)])
2228
    [@ocaml.warning "-A"])
2229

    
2230
and vhdl_type_attributes_t_of_yojson :
2231
  'basetype .
2232
    (Yojson.Safe.json -> 'basetype Ppx_deriving_yojson_runtime.error_or) ->
2233
      Yojson.Safe.json ->
2234
        'basetype vhdl_type_attributes_t Ppx_deriving_yojson_runtime.error_or
2235
  =
2236
  fun poly_basetype  ->
2237
    ((let open! Ppx_deriving_yojson_runtime in
2238
        function
2239
        | `List ((`String "TAttNoArg")::arg0::[]) ->
2240
            ((function
2241
              | `Assoc xs ->
2242
                  let rec loop xs (arg0 as _state) =
2243
                    match xs with
2244
                    | ("id",x)::xs ->
2245
                        loop xs
2246
                          ((function
2247
                            | `String x -> Result.Ok x
2248
                            | _ ->
2249
                                Result.Error
2250
                                  "Vhdl_ast.vhdl_type_attributes_t.id") x)
2251
                    | [] ->
2252
                        arg0 >>=
2253
                          ((fun arg0  -> Result.Ok (TAttNoArg { id = arg0 })))
2254
                    | _::xs -> loop xs _state  in
2255
                  loop xs (Result.Error "Vhdl_ast.vhdl_type_attributes_t.id")
2256
              | _ -> Result.Error "Vhdl_ast.vhdl_type_attributes_t")) arg0
2257
        | `List ((`String "TAttIntArg")::arg0::[]) ->
2258
            ((function
2259
              | `Assoc xs ->
2260
                  let rec loop xs ((arg0,arg1) as _state) =
2261
                    match xs with
2262
                    | ("id",x)::xs ->
2263
                        loop xs
2264
                          (((function
2265
                             | `String x -> Result.Ok x
2266
                             | _ ->
2267
                                 Result.Error
2268
                                   "Vhdl_ast.vhdl_type_attributes_t.id") x),
2269
                            arg1)
2270
                    | ("arg",x)::xs ->
2271
                        loop xs
2272
                          (arg0,
2273
                            ((function
2274
                              | `Int x -> Result.Ok x
2275
                              | _ ->
2276
                                  Result.Error
2277
                                    "Vhdl_ast.vhdl_type_attributes_t.arg") x))
2278
                    | [] ->
2279
                        arg1 >>=
2280
                          ((fun arg1  ->
2281
                              arg0 >>=
2282
                                (fun arg0  ->
2283
                                   Result.Ok
2284
                                     (TAttIntArg { id = arg0; arg = arg1 }))))
2285
                    | _::xs -> loop xs _state  in
2286
                  loop xs
2287
                    ((Result.Error "Vhdl_ast.vhdl_type_attributes_t.id"),
2288
                      (Result.Error "Vhdl_ast.vhdl_type_attributes_t.arg"))
2289
              | _ -> Result.Error "Vhdl_ast.vhdl_type_attributes_t")) arg0
2290
        | `List ((`String "TAttValArg")::arg0::[]) ->
2291
            ((function
2292
              | `Assoc xs ->
2293
                  let rec loop xs ((arg0,arg1) as _state) =
2294
                    match xs with
2295
                    | ("id",x)::xs ->
2296
                        loop xs
2297
                          (((function
2298
                             | `String x -> Result.Ok x
2299
                             | _ ->
2300
                                 Result.Error
2301
                                   "Vhdl_ast.vhdl_type_attributes_t.id") x),
2302
                            arg1)
2303
                    | ("arg",x)::xs ->
2304
                        loop xs
2305
                          (arg0,
2306
                            ((poly_basetype : Yojson.Safe.json -> _ error_or)
2307
                               x))
2308
                    | [] ->
2309
                        arg1 >>=
2310
                          ((fun arg1  ->
2311
                              arg0 >>=
2312
                                (fun arg0  ->
2313
                                   Result.Ok
2314
                                     (TAttValArg { id = arg0; arg = arg1 }))))
2315
                    | _::xs -> loop xs _state  in
2316
                  loop xs
2317
                    ((Result.Error "Vhdl_ast.vhdl_type_attributes_t.id"),
2318
                      (Result.Error "Vhdl_ast.vhdl_type_attributes_t.arg"))
2319
              | _ -> Result.Error "Vhdl_ast.vhdl_type_attributes_t")) arg0
2320
        | `List ((`String "TAttStringArg")::arg0::[]) ->
2321
            ((function
2322
              | `Assoc xs ->
2323
                  let rec loop xs ((arg0,arg1) as _state) =
2324
                    match xs with
2325
                    | ("id",x)::xs ->
2326
                        loop xs
2327
                          (((function
2328
                             | `String x -> Result.Ok x
2329
                             | _ ->
2330
                                 Result.Error
2331
                                   "Vhdl_ast.vhdl_type_attributes_t.id") x),
2332
                            arg1)
2333
                    | ("arg",x)::xs ->
2334
                        loop xs
2335
                          (arg0,
2336
                            ((function
2337
                              | `String x -> Result.Ok x
2338
                              | _ ->
2339
                                  Result.Error
2340
                                    "Vhdl_ast.vhdl_type_attributes_t.arg") x))
2341
                    | [] ->
2342
                        arg1 >>=
2343
                          ((fun arg1  ->
2344
                              arg0 >>=
2345
                                (fun arg0  ->
2346
                                   Result.Ok
2347
                                     (TAttStringArg { id = arg0; arg = arg1 }))))
2348
                    | _::xs -> loop xs _state  in
2349
                  loop xs
2350
                    ((Result.Error "Vhdl_ast.vhdl_type_attributes_t.id"),
2351
                      (Result.Error "Vhdl_ast.vhdl_type_attributes_t.arg"))
2352
              | _ -> Result.Error "Vhdl_ast.vhdl_type_attributes_t")) arg0
2353
        | _ -> Result.Error "Vhdl_ast.vhdl_type_attributes_t")
2354
    [@ocaml.warning "-A"])
2355

    
2356
let typ_att_noarg = ["base"; "left"; "right"; "high"; "low"] 
2357
let typ_att_intarg = ["pos"; "val"; "succ"; "pred"; "leftof"; "rightof"] 
2358
let typ_att_valarg = ["image"] 
2359
let typ_att_stringarg = ["value"] 
2360
let array_att_intarg =
2361
  ["left"; "right"; "high"; "low"; "range"; "reverse_range"; "length"] 
2362
type vhdl_parameter_t =
2363
  {
2364
  names: vhdl_name_t list ;
2365
  mode: string list [@default []];
2366
  typ: vhdl_subtype_indication_t ;
2367
  init_val: vhdl_cst_val_t option [@default Some (CstInt 0)]}
2368

    
2369
let rec pp_vhdl_parameter_t :
2370
  Format.formatter -> vhdl_parameter_t -> Ppx_deriving_runtime.unit =
2371
  let __2 () = pp_vhdl_cst_val_t
2372
  
2373
  and __1 () = pp_vhdl_subtype_indication_t
2374
  
2375
  and __0 () = pp_vhdl_name_t
2376
   in
2377
  ((let open! Ppx_deriving_runtime in
2378
      fun fmt  ->
2379
        fun x  ->
2380
          Format.fprintf fmt "@[<2>{ ";
2381
          ((((Format.fprintf fmt "@[%s =@ " "names";
2382
              ((fun x  ->
2383
                  Format.fprintf fmt "@[<2>[";
2384
                  ignore
2385
                    (List.fold_left
2386
                       (fun sep  ->
2387
                          fun x  ->
2388
                            if sep then Format.fprintf fmt ";@ ";
2389
                            ((__0 ()) fmt) x;
2390
                            true) false x);
2391
                  Format.fprintf fmt "@,]@]")) x.names;
2392
              Format.fprintf fmt "@]");
2393
             Format.fprintf fmt ";@ ";
2394
             Format.fprintf fmt "@[%s =@ " "mode";
2395
             ((fun x  ->
2396
                 Format.fprintf fmt "@[<2>[";
2397
                 ignore
2398
                   (List.fold_left
2399
                      (fun sep  ->
2400
                         fun x  ->
2401
                           if sep then Format.fprintf fmt ";@ ";
2402
                           (Format.fprintf fmt "%S") x;
2403
                           true) false x);
2404
                 Format.fprintf fmt "@,]@]")) x.mode;
2405
             Format.fprintf fmt "@]");
2406
            Format.fprintf fmt ";@ ";
2407
            Format.fprintf fmt "@[%s =@ " "typ";
2408
            ((__1 ()) fmt) x.typ;
2409
            Format.fprintf fmt "@]");
2410
           Format.fprintf fmt ";@ ";
2411
           Format.fprintf fmt "@[%s =@ " "init_val";
2412
           ((function
2413
             | None  -> Format.pp_print_string fmt "None"
2414
             | Some x ->
2415
                 (Format.pp_print_string fmt "(Some ";
2416
                  ((__2 ()) fmt) x;
2417
                  Format.pp_print_string fmt ")"))) x.init_val;
2418
           Format.fprintf fmt "@]");
2419
          Format.fprintf fmt "@ }@]")
2420
    [@ocaml.warning "-A"])
2421

    
2422
and show_vhdl_parameter_t : vhdl_parameter_t -> Ppx_deriving_runtime.string =
2423
  fun x  -> Format.asprintf "%a" pp_vhdl_parameter_t x
2424

    
2425
let rec (vhdl_parameter_t_to_yojson : vhdl_parameter_t -> Yojson.Safe.json) =
2426
  ((let open! Ppx_deriving_yojson_runtime in
2427
      fun x  ->
2428
        let fields = []  in
2429
        let fields =
2430
          if x.init_val = (Some (CstInt 0))
2431
          then fields
2432
          else
2433
            ("init_val",
2434
              (((function
2435
                 | None  -> `Null
2436
                 | Some x -> ((fun x  -> vhdl_cst_val_t_to_yojson x)) x))
2437
                 x.init_val))
2438
            :: fields
2439
           in
2440
        let fields =
2441
          ("typ", ((fun x  -> vhdl_subtype_indication_t_to_yojson x) x.typ))
2442
          :: fields  in
2443
        let fields =
2444
          if x.mode = []
2445
          then fields
2446
          else
2447
            ("mode",
2448
              (((fun x  ->
2449
                   `List
2450
                     (List.map
2451
                        (fun (x : Ppx_deriving_runtime.string)  -> `String x)
2452
                        x))) x.mode))
2453
            :: fields
2454
           in
2455
        let fields =
2456
          ("names",
2457
            ((fun x  ->
2458
                `List (List.map (fun x  -> vhdl_name_t_to_yojson x) x))
2459
               x.names))
2460
          :: fields  in
2461
        `Assoc fields)
2462
  [@ocaml.warning "-A"])
2463

    
2464
and (vhdl_parameter_t_of_yojson :
2465
      Yojson.Safe.json ->
2466
        vhdl_parameter_t Ppx_deriving_yojson_runtime.error_or)
2467
  =
2468
  ((let open! Ppx_deriving_yojson_runtime in
2469
      function
2470
      | `Assoc xs ->
2471
          let rec loop xs ((arg0,arg1,arg2,arg3) as _state) =
2472
            match xs with
2473
            | ("names",x)::xs ->
2474
                loop xs
2475
                  (((function
2476
                     | `List xs ->
2477
                         map_bind (fun x  -> vhdl_name_t_of_yojson x) [] xs
2478
                     | _ -> Result.Error "Vhdl_ast.vhdl_parameter_t.names") x),
2479
                    arg1, arg2, arg3)
2480
            | ("mode",x)::xs ->
2481
                loop xs
2482
                  (arg0,
2483
                    ((function
2484
                      | `List xs ->
2485
                          map_bind
2486
                            (function
2487
                             | `String x -> Result.Ok x
2488
                             | _ ->
2489
                                 Result.Error
2490
                                   "Vhdl_ast.vhdl_parameter_t.mode") [] xs
2491
                      | _ -> Result.Error "Vhdl_ast.vhdl_parameter_t.mode") x),
2492
                    arg2, arg3)
2493
            | ("typ",x)::xs ->
2494
                loop xs
2495
                  (arg0, arg1,
2496
                    ((fun x  -> vhdl_subtype_indication_t_of_yojson x) x),
2497
                    arg3)
2498
            | ("init_val",x)::xs ->
2499
                loop xs
2500
                  (arg0, arg1, arg2,
2501
                    ((function
2502
                      | `Null -> Result.Ok None
2503
                      | x ->
2504
                          ((fun x  -> vhdl_cst_val_t_of_yojson x) x) >>=
2505
                            ((fun x  -> Result.Ok (Some x)))) x))
2506
            | [] ->
2507
                arg3 >>=
2508
                  ((fun arg3  ->
2509
                      arg2 >>=
2510
                        (fun arg2  ->
2511
                           arg1 >>=
2512
                             (fun arg1  ->
2513
                                arg0 >>=
2514
                                  (fun arg0  ->
2515
                                     Result.Ok
2516
                                       {
2517
                                         names = arg0;
2518
                                         mode = arg1;
2519
                                         typ = arg2;
2520
                                         init_val = arg3
2521
                                       })))))
2522
            | _::xs -> loop xs _state  in
2523
          loop xs
2524
            ((Result.Error "Vhdl_ast.vhdl_parameter_t.names"),
2525
              (Result.Ok []), (Result.Error "Vhdl_ast.vhdl_parameter_t.typ"),
2526
              (Result.Ok (Some (CstInt 0))))
2527
      | _ -> Result.Error "Vhdl_ast.vhdl_parameter_t")
2528
  [@ocaml.warning "-A"])
2529

    
2530
type vhdl_subprogram_spec_t =
2531
  {
2532
  name: string [@default ""];
2533
  typeMark: vhdl_name_t [@default NoName];
2534
  parameters: vhdl_parameter_t list ;
2535
  isPure: bool [@default false]}
2536

    
2537
let rec pp_vhdl_subprogram_spec_t :
2538
  Format.formatter -> vhdl_subprogram_spec_t -> Ppx_deriving_runtime.unit =
2539
  let __1 () = pp_vhdl_parameter_t
2540
  
2541
  and __0 () = pp_vhdl_name_t
2542
   in
2543
  ((let open! Ppx_deriving_runtime in
2544
      fun fmt  ->
2545
        fun x  ->
2546
          Format.fprintf fmt "@[<2>{ ";
2547
          ((((Format.fprintf fmt "@[%s =@ " "name";
2548
              (Format.fprintf fmt "%S") x.name;
2549
              Format.fprintf fmt "@]");
2550
             Format.fprintf fmt ";@ ";
2551
             Format.fprintf fmt "@[%s =@ " "typeMark";
2552
             ((__0 ()) fmt) x.typeMark;
2553
             Format.fprintf fmt "@]");
2554
            Format.fprintf fmt ";@ ";
2555
            Format.fprintf fmt "@[%s =@ " "parameters";
2556
            ((fun x  ->
2557
                Format.fprintf fmt "@[<2>[";
2558
                ignore
2559
                  (List.fold_left
2560
                     (fun sep  ->
2561
                        fun x  ->
2562
                          if sep then Format.fprintf fmt ";@ ";
2563
                          ((__1 ()) fmt) x;
2564
                          true) false x);
2565
                Format.fprintf fmt "@,]@]")) x.parameters;
2566
            Format.fprintf fmt "@]");
2567
           Format.fprintf fmt ";@ ";
2568
           Format.fprintf fmt "@[%s =@ " "isPure";
2569
           (Format.fprintf fmt "%B") x.isPure;
2570
           Format.fprintf fmt "@]");
2571
          Format.fprintf fmt "@ }@]")
2572
    [@ocaml.warning "-A"])
2573

    
2574
and show_vhdl_subprogram_spec_t :
2575
  vhdl_subprogram_spec_t -> Ppx_deriving_runtime.string =
2576
  fun x  -> Format.asprintf "%a" pp_vhdl_subprogram_spec_t x
2577

    
2578
let rec (vhdl_subprogram_spec_t_to_yojson :
2579
          vhdl_subprogram_spec_t -> Yojson.Safe.json)
2580
  =
2581
  ((let open! Ppx_deriving_yojson_runtime in
2582
      fun x  ->
2583
        let fields = []  in
2584
        let fields =
2585
          if x.isPure = false
2586
          then fields
2587
          else
2588
            ("isPure",
2589
              (((fun (x : Ppx_deriving_runtime.bool)  -> `Bool x)) x.isPure))
2590
            :: fields
2591
           in
2592
        let fields =
2593
          ("parameters",
2594
            ((fun x  ->
2595
                `List (List.map (fun x  -> vhdl_parameter_t_to_yojson x) x))
2596
               x.parameters))
2597
          :: fields  in
2598
        let fields =
2599
          if x.typeMark = NoName
2600
          then fields
2601
          else
2602
            ("typeMark", (((fun x  -> vhdl_name_t_to_yojson x)) x.typeMark))
2603
            :: fields
2604
           in
2605
        let fields =
2606
          if x.name = ""
2607
          then fields
2608
          else
2609
            ("name",
2610
              (((fun (x : Ppx_deriving_runtime.string)  -> `String x)) x.name))
2611
            :: fields
2612
           in
2613
        `Assoc fields)
2614
  [@ocaml.warning "-A"])
2615

    
2616
and (vhdl_subprogram_spec_t_of_yojson :
2617
      Yojson.Safe.json ->
2618
        vhdl_subprogram_spec_t Ppx_deriving_yojson_runtime.error_or)
2619
  =
2620
  ((let open! Ppx_deriving_yojson_runtime in
2621
      function
2622
      | `Assoc xs ->
2623
          let rec loop xs ((arg0,arg1,arg2,arg3) as _state) =
2624
            match xs with
2625
            | ("name",x)::xs ->
2626
                loop xs
2627
                  (((function
2628
                     | `String x -> Result.Ok x
2629
                     | _ ->
2630
                         Result.Error "Vhdl_ast.vhdl_subprogram_spec_t.name")
2631
                      x), arg1, arg2, arg3)
2632
            | ("typeMark",x)::xs ->
2633
                loop xs
2634
                  (arg0, ((fun x  -> vhdl_name_t_of_yojson x) x), arg2, arg3)
2635
            | ("parameters",x)::xs ->
2636
                loop xs
2637
                  (arg0, arg1,
2638
                    ((function
2639
                      | `List xs ->
2640
                          map_bind (fun x  -> vhdl_parameter_t_of_yojson x)
2641
                            [] xs
2642
                      | _ ->
2643
                          Result.Error
2644
                            "Vhdl_ast.vhdl_subprogram_spec_t.parameters") x),
2645
                    arg3)
2646
            | ("isPure",x)::xs ->
2647
                loop xs
2648
                  (arg0, arg1, arg2,
2649
                    ((function
2650
                      | `Bool x -> Result.Ok x
2651
                      | _ ->
2652
                          Result.Error
2653
                            "Vhdl_ast.vhdl_subprogram_spec_t.isPure") x))
2654
            | [] ->
2655
                arg3 >>=
2656
                  ((fun arg3  ->
2657
                      arg2 >>=
2658
                        (fun arg2  ->
2659
                           arg1 >>=
2660
                             (fun arg1  ->
2661
                                arg0 >>=
2662
                                  (fun arg0  ->
2663
                                     Result.Ok
2664
                                       {
2665
                                         name = arg0;
2666
                                         typeMark = arg1;
2667
                                         parameters = arg2;
2668
                                         isPure = arg3
2669
                                       })))))
2670
            | _::xs -> loop xs _state  in
2671
          loop xs
2672
            ((Result.Ok ""), (Result.Ok NoName),
2673
              (Result.Error "Vhdl_ast.vhdl_subprogram_spec_t.parameters"),
2674
              (Result.Ok false))
2675
      | _ -> Result.Error "Vhdl_ast.vhdl_subprogram_spec_t")
2676
  [@ocaml.warning "-A"])
2677

    
2678
let arith_funs = ["+"; "-"; "*"; "/"; "mod"; "rem"; "abs"; "**"; "&"] 
2679
let bool_funs = ["and"; "or"; "nand"; "nor"; "xor"; "not"] 
2680
let rel_funs =
2681
  ["<";
2682
  ">";
2683
  "<=";
2684
  ">=";
2685
  "/=";
2686
  "=";
2687
  "?=";
2688
  "?/=";
2689
  "?<";
2690
  "?<=";
2691
  "?>";
2692
  "?>=";
2693
  "??"] 
2694
let shift_funs = ["sll"; "srl"; "sla"; "sra"; "rol"; "ror"] 
2695
type vhdl_sequential_stmt_t =
2696
  | VarAssign of
2697
  {
2698
  label: vhdl_name_t [@default NoName];
2699
  lhs: vhdl_name_t ;
2700
  rhs: vhdl_expr_t } [@name "VARIABLE_ASSIGNMENT_STATEMENT"]
2701
  | SigSeqAssign of
2702
  {
2703
  label: vhdl_name_t [@default NoName];
2704
  lhs: vhdl_name_t ;
2705
  rhs: vhdl_expr_t list } [@name "SIGNAL_ASSIGNMENT_STATEMENT"]
2706
  | If of
2707
  {
2708
  label: vhdl_name_t [@default NoName];
2709
  if_cases: vhdl_if_case_t list ;
2710
  default: vhdl_sequential_stmt_t list [@default []]} [@name "IF_STATEMENT"]
2711
  | Case of
2712
  {
2713
  label: vhdl_name_t [@default NoName];
2714
  guard: vhdl_expr_t ;
2715
  branches: vhdl_case_item_t list } [@name "CASE_STATEMENT_TREE"]
2716
  | Exit of
2717
  {
2718
  label: vhdl_name_t [@default NoName];
2719
  loop_label: string option [@default Some ""];
2720
  condition: vhdl_expr_t option [@default Some IsNull]}
2721
  [@name "EXIT_STATEMENT"]
2722
  | Assert of
2723
  {
2724
  label: vhdl_name_t [@default NoName];
2725
  cond: vhdl_expr_t ;
2726
  report: vhdl_expr_t [@default IsNull];
2727
  severity: vhdl_expr_t [@default IsNull]} [@name "ASSERTION_STATEMENT"]
2728
  | Wait [@name "WAIT_STATEMENT"]
2729
  | Null of {
2730
  label: vhdl_name_t [@default NoName]} [@name "NULL_STATEMENT"]
2731
  | Return of {
2732
  label: vhdl_name_t [@default NoName]} [@name "RETURN_STATEMENT"]
2733
and vhdl_if_case_t =
2734
  {
2735
  if_cond: vhdl_expr_t ;
2736
  if_block: vhdl_sequential_stmt_t list }
2737
and vhdl_case_item_t =
2738
  {
2739
  when_cond: vhdl_expr_t list ;
2740
  when_stmt: vhdl_sequential_stmt_t list }
2741

    
2742
let rec pp_vhdl_sequential_stmt_t :
2743
  Format.formatter -> vhdl_sequential_stmt_t -> Ppx_deriving_runtime.unit =
2744
  let __19 () = pp_vhdl_name_t
2745
  
2746
  and __18 () = pp_vhdl_name_t
2747
  
2748
  and __17 () = pp_vhdl_expr_t
2749
  
2750
  and __16 () = pp_vhdl_expr_t
2751
  
2752
  and __15 () = pp_vhdl_expr_t
2753
  
2754
  and __14 () = pp_vhdl_name_t
2755
  
2756
  and __13 () = pp_vhdl_expr_t
2757
  
2758
  and __12 () = pp_vhdl_name_t
2759
  
2760
  and __11 () = pp_vhdl_case_item_t
2761
  
2762
  and __10 () = pp_vhdl_expr_t
2763
  
2764
  and __9 () = pp_vhdl_name_t
2765
  
2766
  and __8 () = pp_vhdl_sequential_stmt_t
2767
  
2768
  and __7 () = pp_vhdl_if_case_t
2769
  
2770
  and __6 () = pp_vhdl_name_t
2771
  
2772
  and __5 () = pp_vhdl_expr_t
2773
  
2774
  and __4 () = pp_vhdl_name_t
2775
  
2776
  and __3 () = pp_vhdl_name_t
2777
  
2778
  and __2 () = pp_vhdl_expr_t
2779
  
2780
  and __1 () = pp_vhdl_name_t
2781
  
2782
  and __0 () = pp_vhdl_name_t
2783
   in
2784
  ((let open! Ppx_deriving_runtime in
2785
      fun fmt  ->
2786
        function
2787
        | VarAssign { label = alabel; lhs = alhs; rhs = arhs } ->
2788
            (Format.fprintf fmt "@[<2>VarAssign {@,";
2789
             (((Format.fprintf fmt "@[%s =@ " "label";
2790
                ((__0 ()) fmt) alabel;
2791
                Format.fprintf fmt "@]");
2792
               Format.fprintf fmt ";@ ";
2793
               Format.fprintf fmt "@[%s =@ " "lhs";
2794
               ((__1 ()) fmt) alhs;
2795
               Format.fprintf fmt "@]");
2796
              Format.fprintf fmt ";@ ";
2797
              Format.fprintf fmt "@[%s =@ " "rhs";
2798
              ((__2 ()) fmt) arhs;
2799
              Format.fprintf fmt "@]");
2800
             Format.fprintf fmt "@]}")
2801
        | SigSeqAssign { label = alabel; lhs = alhs; rhs = arhs } ->
2802
            (Format.fprintf fmt "@[<2>SigSeqAssign {@,";
2803
             (((Format.fprintf fmt "@[%s =@ " "label";
2804
                ((__3 ()) fmt) alabel;
2805
                Format.fprintf fmt "@]");
2806
               Format.fprintf fmt ";@ ";
2807
               Format.fprintf fmt "@[%s =@ " "lhs";
2808
               ((__4 ()) fmt) alhs;
2809
               Format.fprintf fmt "@]");
2810
              Format.fprintf fmt ";@ ";
2811
              Format.fprintf fmt "@[%s =@ " "rhs";
2812
              ((fun x  ->
2813
                  Format.fprintf fmt "@[<2>[";
2814
                  ignore
2815
                    (List.fold_left
2816
                       (fun sep  ->
2817
                          fun x  ->
2818
                            if sep then Format.fprintf fmt ";@ ";
2819
                            ((__5 ()) fmt) x;
2820
                            true) false x);
2821
                  Format.fprintf fmt "@,]@]")) arhs;
2822
              Format.fprintf fmt "@]");
2823
             Format.fprintf fmt "@]}")
2824
        | If { label = alabel; if_cases = aif_cases; default = adefault } ->
2825
            (Format.fprintf fmt "@[<2>If {@,";
2826
             (((Format.fprintf fmt "@[%s =@ " "label";
2827
                ((__6 ()) fmt) alabel;
2828
                Format.fprintf fmt "@]");
2829
               Format.fprintf fmt ";@ ";
2830
               Format.fprintf fmt "@[%s =@ " "if_cases";
2831
               ((fun x  ->
2832
                   Format.fprintf fmt "@[<2>[";
2833
                   ignore
2834
                     (List.fold_left
2835
                        (fun sep  ->
2836
                           fun x  ->
2837
                             if sep then Format.fprintf fmt ";@ ";
2838
                             ((__7 ()) fmt) x;
2839
                             true) false x);
2840
                   Format.fprintf fmt "@,]@]")) aif_cases;
2841
               Format.fprintf fmt "@]");
2842
              Format.fprintf fmt ";@ ";
2843
              Format.fprintf fmt "@[%s =@ " "default";
2844
              ((fun x  ->
2845
                  Format.fprintf fmt "@[<2>[";
2846
                  ignore
2847
                    (List.fold_left
2848
                       (fun sep  ->
2849
                          fun x  ->
2850
                            if sep then Format.fprintf fmt ";@ ";
2851
                            ((__8 ()) fmt) x;
2852
                            true) false x);
2853
                  Format.fprintf fmt "@,]@]")) adefault;
2854
              Format.fprintf fmt "@]");
2855
             Format.fprintf fmt "@]}")
2856
        | Case { label = alabel; guard = aguard; branches = abranches } ->
2857
            (Format.fprintf fmt "@[<2>Case {@,";
2858
             (((Format.fprintf fmt "@[%s =@ " "label";
2859
                ((__9 ()) fmt) alabel;
2860
                Format.fprintf fmt "@]");
2861
               Format.fprintf fmt ";@ ";
2862
               Format.fprintf fmt "@[%s =@ " "guard";
2863
               ((__10 ()) fmt) aguard;
2864
               Format.fprintf fmt "@]");
2865
              Format.fprintf fmt ";@ ";
2866
              Format.fprintf fmt "@[%s =@ " "branches";
2867
              ((fun x  ->
2868
                  Format.fprintf fmt "@[<2>[";
2869
                  ignore
2870
                    (List.fold_left
2871
                       (fun sep  ->
2872
                          fun x  ->
2873
                            if sep then Format.fprintf fmt ";@ ";
2874
                            ((__11 ()) fmt) x;
2875
                            true) false x);
2876
                  Format.fprintf fmt "@,]@]")) abranches;
2877
              Format.fprintf fmt "@]");
2878
             Format.fprintf fmt "@]}")
2879
        | Exit
2880
            { label = alabel; loop_label = aloop_label;
2881
              condition = acondition }
2882
            ->
2883
            (Format.fprintf fmt "@[<2>Exit {@,";
2884
             (((Format.fprintf fmt "@[%s =@ " "label";
2885
                ((__12 ()) fmt) alabel;
2886
                Format.fprintf fmt "@]");
2887
               Format.fprintf fmt ";@ ";
2888
               Format.fprintf fmt "@[%s =@ " "loop_label";
2889
               ((function
2890
                 | None  -> Format.pp_print_string fmt "None"
2891
                 | Some x ->
2892
                     (Format.pp_print_string fmt "(Some ";
2893
                      (Format.fprintf fmt "%S") x;
2894
                      Format.pp_print_string fmt ")"))) aloop_label;
2895
               Format.fprintf fmt "@]");
2896
              Format.fprintf fmt ";@ ";
2897
              Format.fprintf fmt "@[%s =@ " "condition";
2898
              ((function
2899
                | None  -> Format.pp_print_string fmt "None"
2900
                | Some x ->
2901
                    (Format.pp_print_string fmt "(Some ";
2902
                     ((__13 ()) fmt) x;
2903
                     Format.pp_print_string fmt ")"))) acondition;
2904
              Format.fprintf fmt "@]");
2905
             Format.fprintf fmt "@]}")
2906
        | Assert
2907
            { label = alabel; cond = acond; report = areport;
2908
              severity = aseverity }
2909
            ->
2910
            (Format.fprintf fmt "@[<2>Assert {@,";
2911
             ((((Format.fprintf fmt "@[%s =@ " "label";
2912
                 ((__14 ()) fmt) alabel;
2913
                 Format.fprintf fmt "@]");
2914
                Format.fprintf fmt ";@ ";
2915
                Format.fprintf fmt "@[%s =@ " "cond";
2916
                ((__15 ()) fmt) acond;
2917
                Format.fprintf fmt "@]");
2918
               Format.fprintf fmt ";@ ";
2919
               Format.fprintf fmt "@[%s =@ " "report";
2920
               ((__16 ()) fmt) areport;
2921
               Format.fprintf fmt "@]");
2922
              Format.fprintf fmt ";@ ";
2923
              Format.fprintf fmt "@[%s =@ " "severity";
2924
              ((__17 ()) fmt) aseverity;
2925
              Format.fprintf fmt "@]");
2926
             Format.fprintf fmt "@]}")
2927
        | Wait  -> Format.pp_print_string fmt "Wait"
2928
        | Null { label = alabel } ->
2929
            (Format.fprintf fmt "@[<2>Null {@,";
2930
             (Format.fprintf fmt "@[%s =@ " "label";
2931
              ((__18 ()) fmt) alabel;
2932
              Format.fprintf fmt "@]");
2933
             Format.fprintf fmt "@]}")
2934
        | Return { label = alabel } ->
2935
            (Format.fprintf fmt "@[<2>Return {@,";
2936
             (Format.fprintf fmt "@[%s =@ " "label";
2937
              ((__19 ()) fmt) alabel;
2938
              Format.fprintf fmt "@]");
2939
             Format.fprintf fmt "@]}"))
2940
    [@ocaml.warning "-A"])
2941

    
2942
and show_vhdl_sequential_stmt_t :
2943
  vhdl_sequential_stmt_t -> Ppx_deriving_runtime.string =
2944
  fun x  -> Format.asprintf "%a" pp_vhdl_sequential_stmt_t x
2945

    
2946
and pp_vhdl_if_case_t :
2947
  Format.formatter -> vhdl_if_case_t -> Ppx_deriving_runtime.unit =
2948
  let __1 () = pp_vhdl_sequential_stmt_t
2949
  
2950
  and __0 () = pp_vhdl_expr_t
2951
   in
2952
  ((let open! Ppx_deriving_runtime in
2953
      fun fmt  ->
2954
        fun x  ->
2955
          Format.fprintf fmt "@[<2>{ ";
2956
          ((Format.fprintf fmt "@[%s =@ " "if_cond";
2957
            ((__0 ()) fmt) x.if_cond;
2958
            Format.fprintf fmt "@]");
2959
           Format.fprintf fmt ";@ ";
2960
           Format.fprintf fmt "@[%s =@ " "if_block";
2961
           ((fun x  ->
2962
               Format.fprintf fmt "@[<2>[";
2963
               ignore
2964
                 (List.fold_left
2965
                    (fun sep  ->
2966
                       fun x  ->
2967
                         if sep then Format.fprintf fmt ";@ ";
2968
                         ((__1 ()) fmt) x;
2969
                         true) false x);
2970
               Format.fprintf fmt "@,]@]")) x.if_block;
2971
           Format.fprintf fmt "@]");
2972
          Format.fprintf fmt "@ }@]")
2973
    [@ocaml.warning "-A"])
2974

    
2975
and show_vhdl_if_case_t : vhdl_if_case_t -> Ppx_deriving_runtime.string =
2976
  fun x  -> Format.asprintf "%a" pp_vhdl_if_case_t x
2977

    
2978
and pp_vhdl_case_item_t :
2979
  Format.formatter -> vhdl_case_item_t -> Ppx_deriving_runtime.unit =
2980
  let __1 () = pp_vhdl_sequential_stmt_t
2981
  
2982
  and __0 () = pp_vhdl_expr_t
2983
   in
2984
  ((let open! Ppx_deriving_runtime in
2985
      fun fmt  ->
2986
        fun x  ->
2987
          Format.fprintf fmt "@[<2>{ ";
2988
          ((Format.fprintf fmt "@[%s =@ " "when_cond";
2989
            ((fun x  ->
2990
                Format.fprintf fmt "@[<2>[";
2991
                ignore
2992
                  (List.fold_left
2993
                     (fun sep  ->
2994
                        fun x  ->
2995
                          if sep then Format.fprintf fmt ";@ ";
2996
                          ((__0 ()) fmt) x;
2997
                          true) false x);
2998
                Format.fprintf fmt "@,]@]")) x.when_cond;
2999
            Format.fprintf fmt "@]");
3000
           Format.fprintf fmt ";@ ";
3001
           Format.fprintf fmt "@[%s =@ " "when_stmt";
3002
           ((fun x  ->
3003
               Format.fprintf fmt "@[<2>[";
3004
               ignore
3005
                 (List.fold_left
3006
                    (fun sep  ->
3007
                       fun x  ->
3008
                         if sep then Format.fprintf fmt ";@ ";
3009
                         ((__1 ()) fmt) x;
3010
                         true) false x);
3011
               Format.fprintf fmt "@,]@]")) x.when_stmt;
3012
           Format.fprintf fmt "@]");
3013
          Format.fprintf fmt "@ }@]")
3014
    [@ocaml.warning "-A"])
3015

    
3016
and show_vhdl_case_item_t : vhdl_case_item_t -> Ppx_deriving_runtime.string =
3017
  fun x  -> Format.asprintf "%a" pp_vhdl_case_item_t x
3018

    
3019
let rec (vhdl_sequential_stmt_t_to_yojson :
3020
          vhdl_sequential_stmt_t -> Yojson.Safe.json)
3021
  =
3022
  ((let open! Ppx_deriving_yojson_runtime in
3023
      function
3024
      | VarAssign arg0 ->
3025
          `List
3026
            [`String "VARIABLE_ASSIGNMENT_STATEMENT";
3027
            (let fields = []  in
3028
             let fields =
3029
               ("rhs", ((fun x  -> vhdl_expr_t_to_yojson x) arg0.rhs)) ::
3030
               fields  in
3031
             let fields =
3032
               ("lhs", ((fun x  -> vhdl_name_t_to_yojson x) arg0.lhs)) ::
3033
               fields  in
3034
             let fields =
3035
               if arg0.label = NoName
3036
               then fields
3037
               else
3038
                 ("label",
3039
                   (((fun x  -> vhdl_name_t_to_yojson x)) arg0.label))
3040
                 :: fields
3041
                in
3042
             `Assoc fields)]
3043
      | SigSeqAssign arg0 ->
3044
          `List
3045
            [`String "SIGNAL_ASSIGNMENT_STATEMENT";
3046
            (let fields = []  in
3047
             let fields =
3048
               ("rhs",
3049
                 ((fun x  ->
3050
                     `List (List.map (fun x  -> vhdl_expr_t_to_yojson x) x))
3051
                    arg0.rhs))
3052
               :: fields  in
3053
             let fields =
3054
               ("lhs", ((fun x  -> vhdl_name_t_to_yojson x) arg0.lhs)) ::
3055
               fields  in
3056
             let fields =
3057
               if arg0.label = NoName
3058
               then fields
3059
               else
3060
                 ("label",
3061
                   (((fun x  -> vhdl_name_t_to_yojson x)) arg0.label))
3062
                 :: fields
3063
                in
3064
             `Assoc fields)]
3065
      | If arg0 ->
3066
          `List
3067
            [`String "IF_STATEMENT";
3068
            (let fields = []  in
3069
             let fields =
3070
               if arg0.default = []
3071
               then fields
3072
               else
3073
                 ("default",
3074
                   (((fun x  ->
3075
                        `List
3076
                          (List.map
3077
                             (fun x  -> vhdl_sequential_stmt_t_to_yojson x) x)))
3078
                      arg0.default))
3079
                 :: fields
3080
                in
3081
             let fields =
3082
               ("if_cases",
3083
                 ((fun x  ->
3084
                     `List
3085
                       (List.map (fun x  -> vhdl_if_case_t_to_yojson x) x))
3086
                    arg0.if_cases))
3087
               :: fields  in
3088
             let fields =
3089
               if arg0.label = NoName
3090
               then fields
3091
               else
3092
                 ("label",
3093
                   (((fun x  -> vhdl_name_t_to_yojson x)) arg0.label))
3094
                 :: fields
3095
                in
3096
             `Assoc fields)]
3097
      | Case arg0 ->
3098
          `List
3099
            [`String "CASE_STATEMENT_TREE";
3100
            (let fields = []  in
3101
             let fields =
3102
               ("branches",
3103
                 ((fun x  ->
3104
                     `List
3105
                       (List.map (fun x  -> vhdl_case_item_t_to_yojson x) x))
3106
                    arg0.branches))
3107
               :: fields  in
3108
             let fields =
3109
               ("guard", ((fun x  -> vhdl_expr_t_to_yojson x) arg0.guard)) ::
3110
               fields  in
3111
             let fields =
3112
               if arg0.label = NoName
3113
               then fields
3114
               else
3115
                 ("label",
3116
                   (((fun x  -> vhdl_name_t_to_yojson x)) arg0.label))
3117
                 :: fields
3118
                in
3119
             `Assoc fields)]
3120
      | Exit arg0 ->
3121
          `List
3122
            [`String "EXIT_STATEMENT";
3123
            (let fields = []  in
3124
             let fields =
3125
               if arg0.condition = (Some IsNull)
3126
               then fields
3127
               else
3128
                 ("condition",
3129
                   (((function
3130
                      | None  -> `Null
3131
                      | Some x -> ((fun x  -> vhdl_expr_t_to_yojson x)) x))
3132
                      arg0.condition))
3133
                 :: fields
3134
                in
3135
             let fields =
3136
               if arg0.loop_label = (Some "")
3137
               then fields
3138
               else
3139
                 ("loop_label",
3140
                   (((function
3141
                      | None  -> `Null
3142
                      | Some x ->
3143
                          ((fun (x : Ppx_deriving_runtime.string)  ->
3144
                              `String x)) x)) arg0.loop_label))
3145
                 :: fields
3146
                in
3147
             let fields =
3148
               if arg0.label = NoName
3149
               then fields
3150
               else
3151
                 ("label",
3152
                   (((fun x  -> vhdl_name_t_to_yojson x)) arg0.label))
3153
                 :: fields
3154
                in
3155
             `Assoc fields)]
3156
      | Assert arg0 ->
3157
          `List
3158
            [`String "ASSERTION_STATEMENT";
3159
            (let fields = []  in
3160
             let fields =
3161
               if arg0.severity = IsNull
3162
               then fields
3163
               else
3164
                 ("severity",
3165
                   (((fun x  -> vhdl_expr_t_to_yojson x)) arg0.severity))
3166
                 :: fields
3167
                in
3168
             let fields =
3169
               if arg0.report = IsNull
3170
               then fields
3171
               else
3172
                 ("report",
3173
                   (((fun x  -> vhdl_expr_t_to_yojson x)) arg0.report))
3174
                 :: fields
3175
                in
3176
             let fields =
3177
               ("cond", ((fun x  -> vhdl_expr_t_to_yojson x) arg0.cond)) ::
3178
               fields  in
3179
             let fields =
3180
               if arg0.label = NoName
3181
               then fields
3182
               else
3183
                 ("label",
3184
                   (((fun x  -> vhdl_name_t_to_yojson x)) arg0.label))
3185
                 :: fields
3186
                in
3187
             `Assoc fields)]
3188
      | Wait  -> `List [`String "WAIT_STATEMENT"]
3189
      | Null arg0 ->
3190
          `List
3191
            [`String "NULL_STATEMENT";
3192
            (let fields = []  in
3193
             let fields =
3194
               if arg0.label = NoName
3195
               then fields
3196
               else
3197
                 ("label",
3198
                   (((fun x  -> vhdl_name_t_to_yojson x)) arg0.label))
3199
                 :: fields
3200
                in
3201
             `Assoc fields)]
3202
      | Return arg0 ->
3203
          `List
3204
            [`String "RETURN_STATEMENT";
3205
            (let fields = []  in
3206
             let fields =
3207
               if arg0.label = NoName
3208
               then fields
3209
               else
3210
                 ("label",
3211
                   (((fun x  -> vhdl_name_t_to_yojson x)) arg0.label))
3212
                 :: fields
3213
                in
3214
             `Assoc fields)])
3215
  [@ocaml.warning "-A"])
3216

    
3217
and (vhdl_sequential_stmt_t_of_yojson :
3218
      Yojson.Safe.json ->
3219
        vhdl_sequential_stmt_t Ppx_deriving_yojson_runtime.error_or)
3220
  =
3221
  ((let open! Ppx_deriving_yojson_runtime in
3222
      function
3223
      | `List ((`String "VARIABLE_ASSIGNMENT_STATEMENT")::arg0::[]) ->
3224
          ((function
3225
            | `Assoc xs ->
3226
                let rec loop xs ((arg0,arg1,arg2) as _state) =
3227
                  match xs with
3228
                  | ("label",x)::xs ->
3229
                      loop xs
3230
                        (((fun x  -> vhdl_name_t_of_yojson x) x), arg1, arg2)
3231
                  | ("lhs",x)::xs ->
3232
                      loop xs
3233
                        (arg0, ((fun x  -> vhdl_name_t_of_yojson x) x), arg2)
3234
                  | ("rhs",x)::xs ->
3235
                      loop xs
3236
                        (arg0, arg1, ((fun x  -> vhdl_expr_t_of_yojson x) x))
3237
                  | [] ->
3238
                      arg2 >>=
3239
                        ((fun arg2  ->
3240
                            arg1 >>=
3241
                              (fun arg1  ->
3242
                                 arg0 >>=
3243
                                   (fun arg0  ->
3244
                                      Result.Ok
3245
                                        (VarAssign
3246
                                           {
3247
                                             label = arg0;
3248
                                             lhs = arg1;
3249
                                             rhs = arg2
3250
                                           })))))
3251
                  | _::xs -> loop xs _state  in
3252
                loop xs
3253
                  ((Result.Ok NoName),
3254
                    (Result.Error "Vhdl_ast.vhdl_sequential_stmt_t.lhs"),
3255
                    (Result.Error "Vhdl_ast.vhdl_sequential_stmt_t.rhs"))
3256
            | _ -> Result.Error "Vhdl_ast.vhdl_sequential_stmt_t")) arg0
3257
      | `List ((`String "SIGNAL_ASSIGNMENT_STATEMENT")::arg0::[]) ->
3258
          ((function
3259
            | `Assoc xs ->
3260
                let rec loop xs ((arg0,arg1,arg2) as _state) =
3261
                  match xs with
3262
                  | ("label",x)::xs ->
3263
                      loop xs
3264
                        (((fun x  -> vhdl_name_t_of_yojson x) x), arg1, arg2)
3265
                  | ("lhs",x)::xs ->
3266
                      loop xs
3267
                        (arg0, ((fun x  -> vhdl_name_t_of_yojson x) x), arg2)
3268
                  | ("rhs",x)::xs ->
3269
                      loop xs
3270
                        (arg0, arg1,
3271
                          ((function
3272
                            | `List xs ->
3273
                                map_bind (fun x  -> vhdl_expr_t_of_yojson x)
3274
                                  [] xs
3275
                            | _ ->
3276
                                Result.Error
3277
                                  "Vhdl_ast.vhdl_sequential_stmt_t.rhs") x))
3278
                  | [] ->
3279
                      arg2 >>=
3280
                        ((fun arg2  ->
3281
                            arg1 >>=
3282
                              (fun arg1  ->
3283
                                 arg0 >>=
3284
                                   (fun arg0  ->
3285
                                      Result.Ok
3286
                                        (SigSeqAssign
3287
                                           {
3288
                                             label = arg0;
3289
                                             lhs = arg1;
3290
                                             rhs = arg2
3291
                                           })))))
3292
                  | _::xs -> loop xs _state  in
3293
                loop xs
3294
                  ((Result.Ok NoName),
3295
                    (Result.Error "Vhdl_ast.vhdl_sequential_stmt_t.lhs"),
3296
                    (Result.Error "Vhdl_ast.vhdl_sequential_stmt_t.rhs"))
3297
            | _ -> Result.Error "Vhdl_ast.vhdl_sequential_stmt_t")) arg0
3298
      | `List ((`String "IF_STATEMENT")::arg0::[]) ->
3299
          ((function
3300
            | `Assoc xs ->
3301
                let rec loop xs ((arg0,arg1,arg2) as _state) =
3302
                  match xs with
3303
                  | ("label",x)::xs ->
3304
                      loop xs
3305
                        (((fun x  -> vhdl_name_t_of_yojson x) x), arg1, arg2)
3306
                  | ("if_cases",x)::xs ->
3307
                      loop xs
3308
                        (arg0,
3309
                          ((function
3310
                            | `List xs ->
3311
                                map_bind
3312
                                  (fun x  -> vhdl_if_case_t_of_yojson x) []
3313
                                  xs
3314
                            | _ ->
3315
                                Result.Error
3316
                                  "Vhdl_ast.vhdl_sequential_stmt_t.if_cases")
3317
                             x), arg2)
3318
                  | ("default",x)::xs ->
3319
                      loop xs
3320
                        (arg0, arg1,
3321
                          ((function
3322
                            | `List xs ->
3323
                                map_bind
3324
                                  (fun x  ->
3325
                                     vhdl_sequential_stmt_t_of_yojson x) []
3326
                                  xs