1
|
open Mini_vhdl_ast
|
2
|
open Vhdl_ast
|
3
|
open Vhdl_ast_pp
|
4
|
|
5
|
let rec pp_mini_vhdl_component_t :
|
6
|
Format.formatter -> mini_vhdl_component_t -> Ppx_deriving_runtime.unit =
|
7
|
let __6 () = pp_vhdl_concurrent_stmt_t
|
8
|
|
9
|
and __5 () = pp_vhdl_definition_t
|
10
|
|
11
|
and __4 () = pp_vhdl_declaration_t
|
12
|
|
13
|
and __3 () = pp_vhdl_load_t
|
14
|
|
15
|
and __2 () = pp_vhdl_port_t
|
16
|
|
17
|
and __1 () = pp_vhdl_port_t
|
18
|
|
19
|
and __0 () = pp_vhdl_name_t
|
20
|
in
|
21
|
((let open! Ppx_deriving_runtime in
|
22
|
fun fmt ->
|
23
|
fun x ->
|
24
|
Format.fprintf fmt "@[<v 2>component ";
|
25
|
(match x.names with
|
26
|
| [] -> ()
|
27
|
| _ ->
|
28
|
((fun x ->
|
29
|
ignore
|
30
|
(List.fold_left
|
31
|
(fun sep ->
|
32
|
fun x ->
|
33
|
if sep then Format.fprintf fmt "__";
|
34
|
((__0 ()) fmt) x;
|
35
|
true) false x))) x.names);
|
36
|
Format.fprintf fmt " is";
|
37
|
(match x.generics with
|
38
|
| [] -> ()
|
39
|
| _ ->
|
40
|
Format.fprintf fmt "@;generics (@[";
|
41
|
((fun x ->
|
42
|
ignore
|
43
|
(List.fold_left
|
44
|
(fun sep ->
|
45
|
fun x ->
|
46
|
if sep then Format.fprintf fmt ",@ ";
|
47
|
((__1 ()) fmt) x;
|
48
|
true) false x))) x.generics;
|
49
|
Format.fprintf fmt "@]);");
|
50
|
(match x.ports with
|
51
|
| [] -> ()
|
52
|
| _ ->
|
53
|
Format.fprintf fmt "@;ports (@[";
|
54
|
((fun x ->
|
55
|
ignore
|
56
|
(List.fold_left
|
57
|
(fun sep ->
|
58
|
fun x ->
|
59
|
if sep then Format.fprintf fmt ",@ ";
|
60
|
((__2 ()) fmt) x;
|
61
|
true) false x))) x.ports;
|
62
|
Format.fprintf fmt "@]);");
|
63
|
(match x.contexts with
|
64
|
| [] -> ()
|
65
|
| _ ->
|
66
|
Format.fprintf fmt "@;";
|
67
|
((fun x ->
|
68
|
ignore
|
69
|
(List.fold_left
|
70
|
(fun sep ->
|
71
|
fun x ->
|
72
|
if sep then Format.fprintf fmt ";@;";
|
73
|
((__3 ()) fmt) x;
|
74
|
true) false x))) x.contexts);
|
75
|
(match x.declarations with
|
76
|
| [] -> ()
|
77
|
| _ ->
|
78
|
Format.fprintf fmt "@;";
|
79
|
((fun x ->
|
80
|
ignore
|
81
|
(List.fold_left
|
82
|
(fun sep ->
|
83
|
fun x ->
|
84
|
if sep then Format.fprintf fmt "@;";
|
85
|
((__4 ()) fmt) x;
|
86
|
Format.fprintf fmt ";";
|
87
|
true) false x))) x.declarations);
|
88
|
(match x.definitions with
|
89
|
| [] -> ()
|
90
|
| _ ->
|
91
|
Format.fprintf fmt "@;";
|
92
|
((fun x ->
|
93
|
ignore
|
94
|
(List.fold_left
|
95
|
(fun sep ->
|
96
|
fun x ->
|
97
|
if sep then Format.fprintf fmt "@;";
|
98
|
((__5 ()) fmt) x;
|
99
|
Format.fprintf fmt ";";
|
100
|
true) false x))) x.definitions);
|
101
|
Format.fprintf fmt "@]@;@[<v 2>begin";
|
102
|
(match x.body with
|
103
|
| [] -> ()
|
104
|
| _ ->
|
105
|
Format.fprintf fmt "@;";
|
106
|
((fun x ->
|
107
|
ignore
|
108
|
(List.fold_left
|
109
|
(fun sep ->
|
110
|
fun x ->
|
111
|
if sep then Format.fprintf fmt "@;";
|
112
|
((__6 ()) fmt) x;
|
113
|
true) false x))) x.body);
|
114
|
Format.fprintf fmt "@]@;end;")
|
115
|
[@ocaml.warning "-A"])
|
116
|
|
117
|
and show_mini_vhdl_component_t :
|
118
|
mini_vhdl_component_t -> Ppx_deriving_runtime.string =
|
119
|
fun x -> Format.asprintf "%a" pp_mini_vhdl_component_t x
|
120
|
|
121
|
let rec pp_mini_vhdl_design_file_t :
|
122
|
Format.formatter -> mini_vhdl_design_file_t -> Ppx_deriving_runtime.unit =
|
123
|
let __1 () = pp_vhdl_package_t
|
124
|
|
125
|
and __0 () = pp_mini_vhdl_component_t
|
126
|
in
|
127
|
((let open! Ppx_deriving_runtime in
|
128
|
fun fmt ->
|
129
|
fun x ->
|
130
|
Format.fprintf fmt "@[<v>";
|
131
|
((fun x ->
|
132
|
ignore
|
133
|
(List.fold_left
|
134
|
(fun sep ->
|
135
|
fun x ->
|
136
|
if sep then Format.fprintf fmt "@;";
|
137
|
((__0 ()) fmt) x;
|
138
|
true) false x))) x.components;
|
139
|
((fun x ->
|
140
|
ignore
|
141
|
(List.fold_left
|
142
|
(fun sep ->
|
143
|
fun x ->
|
144
|
if sep then Format.fprintf fmt "@;";
|
145
|
Format.fprintf fmt "package ";
|
146
|
((__1 ()) fmt) x;
|
147
|
true) false x))) x.packages;
|
148
|
Format.fprintf fmt "@]")
|
149
|
[@ocaml.warning "-A"])
|
150
|
|
151
|
and show_mini_vhdl_design_file_t :
|
152
|
mini_vhdl_design_file_t -> Ppx_deriving_runtime.string =
|
153
|
fun x -> Format.asprintf "%a" pp_mini_vhdl_design_file_t x
|