## lustrec / src / tools / importer / vhdl_to_lustre.ml @ d4175560

History | View | Annotate | Download (21.8 KB)

1 |
open Vhdl_ast_deriving |
---|---|

2 |
open Lustre_types |

3 |
open Utils |

4 | |

5 |
let _ = fun (_ : vhdl_cst_val_t) -> () |

6 |
let _ = fun (_ : vhdl_type_t) -> () |

7 |
let _ = fun (_ : vhdl_subtype_indication_t) -> () |

8 |
let _ = fun (_ : vhdl_discrete_range_t) -> () |

9 |
let _ = fun (_ : vhdl_constraint_t) -> () |

10 |
let _ = fun (_ : vhdl_definition_t) -> () |

11 |
let _ = fun (_ : vhdl_expr_t) -> () |

12 |
let _ = fun (_ : vhdl_name_t) -> () |

13 |
let _ = fun (_ : vhdl_assoc_element_t) -> () |

14 |
let _ = fun (_ : vhdl_element_assoc_t) -> () |

15 |
let _ = fun (_ : vhdl_array_attributes_t) -> () |

16 |
let _ = fun (_ : vhdl_signal_attributes_t) -> () |

17 |
let _ = fun (_ : vhdl_string_attributes_t) -> () |

18 |
let _ = fun (_ : vhdl_suffix_selection_t) -> () |

19 |
let _ = fun (_ : 'basetype vhdl_type_attributes_t) -> () |

20 |
let _ = fun (_ : vhdl_parameter_t) -> () |

21 |
let _ = fun (_ : vhdl_subprogram_spec_t) -> () |

22 |
let _ = fun (_ : vhdl_sequential_stmt_t) -> () |

23 |
let _ = fun (_ : vhdl_if_case_t) -> () |

24 |
let _ = fun (_ : vhdl_case_item_t) -> () |

25 |
let _ = fun (_ : vhdl_declaration_t) -> () |

26 |
let _ = fun (_ : vhdl_signal_selection_t) -> () |

27 |
let _ = fun (_ : vhdl_signal_condition_t) -> () |

28 |
let _ = fun (_ : vhdl_conditional_signal_t) -> () |

29 |
let _ = fun (_ : vhdl_process_t) -> () |

30 |
let _ = fun (_ : vhdl_selected_signal_t) -> () |

31 |
let _ = fun (_ : vhdl_port_mode_t) -> () |

32 |
let _ = fun (_ : vhdl_concurrent_stmt_t) -> () |

33 |
let _ = fun (_ : vhdl_port_t) -> () |

34 |
let _ = fun (_ : vhdl_entity_t) -> () |

35 |
let _ = fun (_ : vhdl_package_t) -> () |

36 |
let _ = fun (_ : vhdl_load_t) -> () |

37 |
let _ = fun (_ : vhdl_architecture_t) -> () |

38 |
let _ = fun (_ : vhdl_configuration_t) -> () |

39 |
let _ = fun (_ : vhdl_library_unit_t) -> () |

40 |
let _ = fun (_ : vhdl_design_unit_t) -> () |

41 |
let _ = fun (_ : vhdl_design_file_t) -> () |

42 |
let _ = fun (_ : vhdl_file_t) -> () |

43 | |

44 |
class virtual vhdl_to_lustre_map = |

45 |
object (self) |

46 |
method virtual string : string -> string |

47 |
method virtual list : 'a . ('a -> 'a) -> 'a list -> 'a list |

48 |
method virtual unit : unit -> unit |

49 |
method virtual bool : bool -> bool |

50 |
method virtual option : 'a . ('a -> 'a) -> 'a option -> 'a option |

51 |
method virtual int : int -> int |

52 |
method virtual vhdl_name_t : vhdl_name_t -> vhdl_name_t |

53 |
method virtual vhdl_definition_t : vhdl_definition_t -> vhdl_definition_t |

54 |
method virtual vhdl_port_t : vhdl_port_t -> vhdl_port_t |

55 |
method virtual vhdl_expr_t : vhdl_expr_t -> vhdl_expr_t |

56 |
method virtual vhdl_port_mode_t : vhdl_port_mode_t -> vhdl_port_mode_t |

57 |
method virtual vhdl_subtype_indication_t : vhdl_subtype_indication_t -> vhdl_subtype_indication_t |

58 |
method virtual vhdl_conditional_signal_t : vhdl_conditional_signal_t -> vhdl_conditional_signal_t |

59 |
method virtual vhdl_process_t : vhdl_process_t -> vhdl_process_t |

60 |
method virtual vhdl_selected_signal_t : vhdl_selected_signal_t -> vhdl_selected_signal_t |

61 |
method virtual vhdl_signal_selection_t : vhdl_signal_selection_t -> vhdl_signal_selection_t |

62 |
method virtual vhdl_suffix_selection_t : vhdl_suffix_selection_t -> vhdl_suffix_selection_t |

63 |
method virtual vhdl_declaration_t : vhdl_declaration_t -> vhdl_declaration_t |

64 |
method virtual vhdl_sequential_stmt_t : vhdl_sequential_stmt_t -> vhdl_sequential_stmt_t |

65 |
method virtual vhdl_signal_condition_t : vhdl_signal_condition_t -> vhdl_signal_condition_t |

66 |
method virtual vhdl_cst_val_t : vhdl_cst_val_t -> vhdl_cst_val_t |

67 |
method virtual vhdl_subprogram_spec_t : vhdl_subprogram_spec_t -> vhdl_subprogram_spec_t |

68 |
method virtual vhdl_discrete_range_t : vhdl_discrete_range_t -> vhdl_discrete_range_t |

69 |
method virtual vhdl_parameter_t : vhdl_parameter_t -> vhdl_parameter_t |

70 |
method virtual vhdl_concurrent_stmt_t : vhdl_concurrent_stmt_t -> vhdl_concurrent_stmt_t |

71 |
method virtual vhdl_declaration_t : vhdl_declaration_t -> vhdl_declaration_t |

72 |
method virtual vhdl_architecture_t : vhdl_architecture_t -> vhdl_architecture_t |

73 |
method virtual vhdl_configuration_t : vhdl_configuration_t -> vhdl_configuration_t |

74 |
method virtual vhdl_entity_t : vhdl_entity_t -> vhdl_entity_t |

75 |
method virtual vhdl_package_t : vhdl_package_t -> vhdl_package_t |

76 |
method virtual vhdl_library_unit_t : vhdl_library_unit_t -> vhdl_library_unit_t |

77 |
method virtual vhdl_load_t : vhdl_load_t -> vhdl_load_t |

78 |
method virtual vhdl_design_unit_t : vhdl_design_unit_t -> vhdl_design_unit_t |

79 |
method virtual vhdl_design_file_t : vhdl_design_file_t -> vhdl_design_file_t |

80 | |

81 |
method vhdl_cst_val_t : vhdl_cst_val_t -> vhdl_cst_val_t = |

82 |
fun x -> |

83 |
match x with |

84 |
| CstInt a -> let a = self#int a in CstInt a |

85 |
| CstStdLogic a -> let a = self#string a in CstStdLogic a |

86 |
| CstLiteral a -> let a = self#string a in CstLiteral a |

87 | |

88 |
method vhdl_type_t : vhdl_type_t -> vhdl_type_t= |

89 |
fun x -> |

90 |
match x with |

91 |
| Base a -> let a = self#string a in Base a |

92 |
| Range (a,b,c) -> |

93 |
let a = self#option self#string a in |

94 |
let b = self#int b in let c = self#int c in Range (a, b, c) |

95 |
| Bit_vector (a,b) -> |

96 |
let a = self#int a in let b = self#int b in Bit_vector (a, b) |

97 |
| Array (a,b,c) -> |

98 |
let a = self#int a in |

99 |
let b = self#int b in |

100 |
let c = self#vhdl_type_t c in Array (a, b, c) |

101 |
| Enumerated a -> let a = self#list self#string a in Enumerated a |

102 |
| Void -> Void |

103 |
method vhdl_subtype_indication_t : |

104 |
vhdl_subtype_indication_t -> vhdl_subtype_indication_t= |

105 |
fun { name; functionName; const } -> |

106 |
let name = self#vhdl_name_t name in |

107 |
let functionName = self#vhdl_name_t functionName in |

108 |
let const = self#vhdl_constraint_t const in |

109 |
{ name; functionName; const } |

110 |
method vhdl_discrete_range_t : |

111 |
vhdl_discrete_range_t -> vhdl_discrete_range_t= |

112 |
fun x -> |

113 |
match x with |

114 |
| SubDiscreteRange a -> |

115 |
let a = self#vhdl_subtype_indication_t a in SubDiscreteRange a |

116 |
| NamedRange a -> let a = self#vhdl_name_t a in NamedRange a |

117 |
| DirectedRange { direction; from; _to } -> |

118 |
let direction = self#string direction in |

119 |
let from = self#vhdl_expr_t from in |

120 |
let _to = self#vhdl_expr_t _to in |

121 |
DirectedRange { direction; from; _to } |

122 | |

123 |
method vhdl_constraint_t : vhdl_constraint_t -> vhdl_constraint_t= |

124 |
fun x -> |

125 |
match x with |

126 |
| RefConstraint { ref_name } -> |

127 |
let ref_name = self#vhdl_name_t ref_name in |

128 |
RefConstraint { ref_name } |

129 |
| RangeConstraint { range } -> |

130 |
let range = self#vhdl_discrete_range_t range in |

131 |
RangeConstraint { range } |

132 |
| IndexConstraint { ranges } -> |

133 |
let ranges = self#list self#vhdl_discrete_range_t ranges in |

134 |
IndexConstraint { ranges } |

135 |
| ArrayConstraint { ranges; sub } -> |

136 |
let ranges = self#list self#vhdl_discrete_range_t ranges in |

137 |
let sub = self#vhdl_constraint_t sub in |

138 |
ArrayConstraint { ranges; sub } |

139 |
| RecordConstraint -> RecordConstraint |

140 |
| NoConstraint -> NoConstraint |

141 | |

142 |
method vhdl_definition_t : vhdl_definition_t -> vhdl_definition_t= |

143 |
fun x -> |

144 |
match x with |

145 |
| Type { name; definition } -> |

146 |
let name = self#vhdl_name_t name in |

147 |
let definition = self#vhdl_type_t definition in |

148 |
Type { name; definition } |

149 |
| Subtype { name; typ } -> |

150 |
let name = self#vhdl_name_t name in |

151 |
let typ = self#vhdl_subtype_indication_t typ in |

152 |
Subtype { name; typ } |

153 |
method vhdl_expr_t : vhdl_expr_t -> vhdl_expr_t= |

154 |
fun x -> |

155 |
match x with |

156 |
| Call a -> let a = self#vhdl_name_t a in Call a |

157 |
| Cst a -> let a = self#vhdl_cst_val_t a in Cst a |

158 |
| Op { id; args } -> |

159 |
let id = self#string id in |

160 |
let args = self#list self#vhdl_expr_t args in Op { id; args } |

161 |
| IsNull -> IsNull |

162 |
| Time { value; phy_unit } -> |

163 |
let value = self#int value in |

164 |
let phy_unit = self#string phy_unit in Time { value; phy_unit } |

165 |
| Sig { name; att } -> |

166 |
let name = self#vhdl_name_t name in |

167 |
let att = self#option self#vhdl_signal_attributes_t att in |

168 |
Sig { name; att } |

169 |
| SuffixMod { expr; selection } -> |

170 |
let expr = self#vhdl_expr_t expr in |

171 |
let selection = self#vhdl_suffix_selection_t selection in |

172 |
SuffixMod { expr; selection } |

173 |
| Aggregate { elems } -> |

174 |
let elems = self#list self#vhdl_element_assoc_t elems in |

175 |
Aggregate { elems } |

176 |
| Others -> Others |

177 |
method vhdl_name_t : vhdl_name_t -> vhdl_name_t= |

178 |
fun x -> |

179 |
match x with |

180 |
| Simple a -> let a = self#string a in Simple a |

181 |
| Identifier a -> let a = self#string a in Identifier a |

182 |
| Selected a -> let a = self#list self#vhdl_name_t a in Selected a |

183 |
| Index { id; exprs } -> |

184 |
let id = self#vhdl_name_t id in |

185 |
let exprs = self#list self#vhdl_expr_t exprs in |

186 |
Index { id; exprs } |

187 |
| Slice { id; range } -> |

188 |
let id = self#vhdl_name_t id in |

189 |
let range = self#vhdl_discrete_range_t range in |

190 |
Slice { id; range } |

191 |
| Attribute { id; designator; expr } -> |

192 |
let id = self#vhdl_name_t id in |

193 |
let designator = self#vhdl_name_t designator in |

194 |
let expr = self#vhdl_expr_t expr in |

195 |
Attribute { id; designator; expr } |

196 |
| Function { id; assoc_list } -> |

197 |
let id = self#vhdl_name_t id in |

198 |
let assoc_list = self#list self#vhdl_assoc_element_t assoc_list |

199 |
in |

200 |
Function { id; assoc_list } |

201 |
| NoName -> NoName |

202 |
method vhdl_assoc_element_t : |

203 |
vhdl_assoc_element_t -> vhdl_assoc_element_t= |

204 |
fun |

205 |
{ formal_name; formal_arg; actual_name; actual_designator; |

206 |
actual_expr } |

207 |
-> |

208 |
let formal_name = self#option self#vhdl_name_t formal_name in |

209 |
let formal_arg = self#option self#vhdl_name_t formal_arg in |

210 |
let actual_name = self#option self#vhdl_name_t actual_name in |

211 |
let actual_designator = |

212 |
self#option self#vhdl_name_t actual_designator in |

213 |
let actual_expr = self#option self#vhdl_expr_t actual_expr in |

214 |
{ |

215 |
formal_name; |

216 |
formal_arg; |

217 |
actual_name; |

218 |
actual_designator; |

219 |
actual_expr |

220 |
} |

221 |
method vhdl_element_assoc_t : |

222 |
vhdl_element_assoc_t -> vhdl_element_assoc_t= |

223 |
fun { choices; expr } -> |

224 |
let choices = self#list self#vhdl_expr_t choices in |

225 |
let expr = self#vhdl_expr_t expr in { choices; expr } |

226 |
method vhdl_array_attributes_t : |

227 |
vhdl_array_attributes_t -> vhdl_array_attributes_t= |

228 |
fun x -> |

229 |
match x with |

230 |
| AAttInt { id; arg } -> |

231 |
let id = self#string id in |

232 |
let arg = self#int arg in AAttInt { id; arg } |

233 |
| AAttAscending -> AAttAscending |

234 |
method vhdl_signal_attributes_t : |

235 |
vhdl_signal_attributes_t -> vhdl_signal_attributes_t= |

236 |
fun x -> match x with | SigAtt a -> let a = self#string a in SigAtt a |

237 |
method vhdl_string_attributes_t : |

238 |
vhdl_string_attributes_t -> vhdl_string_attributes_t= |

239 |
fun x -> |

240 |
match x with | StringAtt a -> let a = self#string a in StringAtt a |

241 |
method vhdl_suffix_selection_t : vhdl_suffix_selection_t -> vhdl_suffix_selection_t= |

242 |
fun x -> |

243 |
match x with |

244 |
| Idx a -> let a = self#int a in Idx a |

245 |
| SuffixRange (a,b) -> |

246 |
let a = self#int a in let b = self#int b in SuffixRange (a, b) |

247 | |

248 |
method vhdl_type_attributes_t : |

249 |
'a . |

250 |
('a -> 'a) -> 'a vhdl_type_attributes_t -> 'a vhdl_type_attributes_t= |

251 |
fun _basetype -> |

252 |
fun x -> |

253 |
match x with |

254 |
| TAttNoArg { id } -> let id = self#string id in TAttNoArg { id } |

255 |
| TAttIntArg { id; arg } -> |

256 |
let id = self#string id in |

257 |
let arg = self#int arg in TAttIntArg { id; arg } |

258 |
| TAttValArg { id; arg } -> |

259 |
let id = self#string id in |

260 |
let arg = _basetype arg in TAttValArg { id; arg } |

261 |
| TAttStringArg { id; arg } -> |

262 |
let id = self#string id in |

263 |
let arg = self#string arg in TAttStringArg { id; arg } |

264 | |

265 |
method vhdl_parameter_t : vhdl_parameter_t -> vhdl_parameter_t= |

266 |
fun { names; mode; typ; init_val } -> |

267 |
let names = self#list self#vhdl_name_t names in |

268 |
let mode = self#list self#string mode in |

269 |
let typ = self#vhdl_subtype_indication_t typ in |

270 |
let init_val = self#option self#vhdl_cst_val_t init_val in |

271 |
{ names; mode; typ; init_val } |

272 | |

273 |
method vhdl_subprogram_spec_t : |

274 |
vhdl_subprogram_spec_t -> vhdl_subprogram_spec_t= |

275 |
fun { name; typeMark; parameters; isPure } -> |

276 |
let name = self#string name in |

277 |
let typeMark = self#vhdl_name_t typeMark in |

278 |
let parameters = self#list self#vhdl_parameter_t parameters in |

279 |
let isPure = self#bool isPure in |

280 |
{ name; typeMark; parameters; isPure } |

281 | |

282 |
method vhdl_sequential_stmt_t : |

283 |
vhdl_sequential_stmt_t -> vhdl_sequential_stmt_t= |

284 |
fun x -> |

285 |
match x with |

286 |
| VarAssign { label; lhs; rhs } -> |

287 |
let label = self#vhdl_name_t label in |

288 |
let lhs = self#vhdl_name_t lhs in |

289 |
let rhs = self#vhdl_expr_t rhs in VarAssign { label; lhs; rhs } |

290 |
| SigSeqAssign { label; lhs; rhs } -> |

291 |
let label = self#vhdl_name_t label in |

292 |
let lhs = self#vhdl_name_t lhs in |

293 |
let rhs = self#list self#vhdl_expr_t rhs in |

294 |
SigSeqAssign { label; lhs; rhs } |

295 |
| If { label; if_cases; default } -> |

296 |
let label = self#vhdl_name_t label in |

297 |
let if_cases = self#list self#vhdl_if_case_t if_cases in |

298 |
let default = self#list self#vhdl_sequential_stmt_t default in |

299 |
If { label; if_cases; default } |

300 |
| Case { label; guard; branches } -> |

301 |
let label = self#vhdl_name_t label in |

302 |
let guard = self#vhdl_expr_t guard in |

303 |
let branches = self#list self#vhdl_case_item_t branches in |

304 |
Case { label; guard; branches } |

305 |
| Exit { label; loop_label; condition } -> |

306 |
let label = self#vhdl_name_t label in |

307 |
let loop_label = self#option self#string loop_label in |

308 |
let condition = self#option self#vhdl_expr_t condition in |

309 |
Exit { label; loop_label; condition } |

310 |
| Assert { label; cond; report; severity } -> |

311 |
let label = self#vhdl_name_t label in |

312 |
let cond = self#vhdl_expr_t cond in |

313 |
let report = self#vhdl_expr_t report in |

314 |
let severity = self#vhdl_expr_t severity in |

315 |
Assert { label; cond; report; severity } |

316 |
| Wait -> Wait |

317 |
| Null { label } -> |

318 |
let label = self#vhdl_name_t label in Null { label } |

319 |
| Return { label } -> |

320 |
let label = self#vhdl_name_t label in Return { label } |

321 |
method vhdl_if_case_t : vhdl_if_case_t -> vhdl_if_case_t= |

322 |
fun { if_cond; if_block } -> |

323 |
let if_cond = self#vhdl_expr_t if_cond in |

324 |
let if_block = self#list self#vhdl_sequential_stmt_t if_block in |

325 |
{ if_cond; if_block } |

326 |
method vhdl_case_item_t : vhdl_case_item_t -> vhdl_case_item_t= |

327 |
fun { when_cond; when_stmt } -> |

328 |
let when_cond = self#list self#vhdl_expr_t when_cond in |

329 |
let when_stmt = self#list self#vhdl_sequential_stmt_t when_stmt in |

330 |
{ when_cond; when_stmt } |

331 | |

332 |
method vhdl_declaration_t : vhdl_declaration_t -> vhdl_declaration_t= |

333 |
fun x -> |

334 |
match x with |

335 |
| VarDecl { names; typ; init_val } -> |

336 |
let names = self#list self#vhdl_name_t names in |

337 |
let typ = self#vhdl_subtype_indication_t typ in |

338 |
let init_val = self#vhdl_expr_t init_val in |

339 |
VarDecl { names; typ; init_val } |

340 |
| CstDecl { names; typ; init_val } -> |

341 |
let names = self#list self#vhdl_name_t names in |

342 |
let typ = self#vhdl_subtype_indication_t typ in |

343 |
let init_val = self#vhdl_expr_t init_val in |

344 |
CstDecl { names; typ; init_val } |

345 |
| SigDecl { names; typ; init_val } -> |

346 |
let names = self#list self#vhdl_name_t names in |

347 |
let typ = self#vhdl_subtype_indication_t typ in |

348 |
let init_val = self#vhdl_expr_t init_val in |

349 |
SigDecl { names; typ; init_val } |

350 |
| Subprogram { name; kind; spec; decl_part; stmts } -> |

351 |
let name = self#vhdl_name_t name in |

352 |
let kind = self#string kind in |

353 |
let spec = self#vhdl_subprogram_spec_t spec in |

354 |
let decl_part = self#list self#vhdl_declaration_t decl_part in |

355 |
let stmts = self#list self#vhdl_sequential_stmt_t stmts in |

356 |
Subprogram { name; kind; spec; decl_part; stmts } |

357 | |

358 |
method vhdl_signal_condition_t : vhdl_signal_condition_t -> vhdl_signal_condition_t= |

359 |
fun { expr; cond } -> |

360 |
let expr = self#list self#vhdl_expr_t expr in |

361 |
let cond = self#vhdl_expr_t cond in { expr; cond } |

362 | |

363 |
method vhdl_signal_selection_t : vhdl_signal_selection_t -> vhdl_signal_selection_t= |

364 |
fun { expr; when_sel } -> |

365 |
let expr = self#vhdl_expr_t expr in |

366 |
let when_sel = self#list self#vhdl_expr_t when_sel in |

367 |
{ expr; when_sel } |

368 | |

369 |
method vhdl_conditional_signal_t : |

370 |
vhdl_conditional_signal_t -> vhdl_conditional_signal_t= |

371 |
fun { postponed; label; lhs; rhs; cond; delay } -> |

372 |
let postponed = self#bool postponed in |

373 |
let label = self#vhdl_name_t label in |

374 |
let lhs = self#vhdl_name_t lhs in |

375 |
let rhs = self#list self#vhdl_signal_condition_t rhs in |

376 |
let cond = self#vhdl_expr_t cond in |

377 |
let delay = self#vhdl_expr_t delay in |

378 |
{ postponed; label; lhs; rhs; cond; delay } |

379 | |

380 | |

381 |
method vhdl_process_t : vhdl_process_t -> vhdl_process_t= |

382 |
fun { id; declarations; active_sigs; body } -> |

383 |
let id = self#vhdl_name_t id in |

384 |
let declarations = |

385 |
self#option (self#list self#vhdl_declaration_t) declarations in |

386 |
let active_sigs = self#list self#vhdl_name_t active_sigs in |

387 |
let body = self#list self#vhdl_sequential_stmt_t body in |

388 |
{ id; declarations; active_sigs; body } |

389 | |

390 |
method vhdl_selected_signal_t : vhdl_selected_signal_t -> vhdl_selected_signal_t= |

391 |
fun { postponed; label; lhs; sel; branches; delay } -> |

392 |
let postponed = self#bool postponed in |

393 |
let label = self#vhdl_name_t label in |

394 |
let lhs = self#vhdl_name_t lhs in |

395 |
let sel = self#vhdl_expr_t sel in |

396 |
let branches = self#list self#vhdl_signal_selection_t branches in |

397 |
let delay = self#option self#vhdl_expr_t delay in |

398 |
{ postponed; label; lhs; sel; branches; delay } |

399 | |

400 |
method vhdl_port_mode_t : vhdl_port_mode_t -> vhdl_port_mode_t= |

401 |
fun x -> x |

402 | |

403 |
method vhdl_concurrent_stmt_t : |

404 |
vhdl_concurrent_stmt_t -> vhdl_concurrent_stmt_t= |

405 |
fun x -> |

406 |
match x with |

407 |
| SigAssign a -> let a = self#vhdl_conditional_signal_t a in SigAssign a |

408 |
| Process a -> let a = self#vhdl_process_t a in Process a |

409 |
| SelectedSig a -> let a = self#vhdl_selected_signal_t a in SelectedSig a |

410 | |

411 |
method vhdl_port_t : vhdl_port_t -> vhdl_port_t= |

412 |
fun { names; mode; typ; expr } -> |

413 |
let names = self#list self#vhdl_name_t names in |

414 |
let mode = self#vhdl_port_mode_t mode in |

415 |
let typ = self#vhdl_subtype_indication_t typ in |

416 |
let expr = self#vhdl_expr_t expr in { names; mode; typ; expr } |

417 | |

418 |
method vhdl_entity_t : vhdl_entity_t -> vhdl_entity_t= |

419 |
fun { name; generics; ports; declaration; stmts } -> |

420 |
let name = self#vhdl_name_t name in |

421 |
let generics = self#list self#vhdl_port_t generics in |

422 |
let ports = self#list self#vhdl_port_t ports in |

423 |
let declaration = self#list self#vhdl_declaration_t declaration in |

424 |
let stmts = self#list self#vhdl_concurrent_stmt_t stmts in |

425 |
{ name; generics; ports; declaration; stmts } |

426 | |

427 |
method vhdl_package_t : vhdl_package_t -> vhdl_package_t= |

428 |
fun { name; shared_defs } -> |

429 |
let name = self#vhdl_name_t name in |

430 |
let shared_defs = self#list self#vhdl_definition_t shared_defs in |

431 |
{ name; shared_defs } |

432 | |

433 |
method vhdl_load_t : vhdl_load_t -> vhdl_load_t= |

434 |
fun x -> |

435 |
match x with |

436 |
| Library a -> let a = self#list self#vhdl_name_t a in Library a |

437 |
| Use a -> let a = self#list self#vhdl_name_t a in Use a |

438 | |

439 |
method vhdl_architecture_t : vhdl_architecture_t -> vhdl_architecture_t= |

440 |
fun { name; entity; declarations; body } -> |

441 |
let name = self#vhdl_name_t name in |

442 |
let entity = self#vhdl_name_t entity in |

443 |
let declarations = self#list self#vhdl_declaration_t declarations in |

444 |
let body = self#list self#vhdl_concurrent_stmt_t body in |

445 |
{ name; entity; declarations; body } |

446 | |

447 |
method vhdl_configuration_t : |

448 |
vhdl_configuration_t -> vhdl_configuration_t= self#unit |

449 | |

450 |
method vhdl_library_unit_t : vhdl_library_unit_t -> vhdl_library_unit_t= |

451 |
fun x -> |

452 |
match x with |

453 |
| Package a -> let a = self#vhdl_package_t a in Package a |

454 |
| Entities a -> let a = self#vhdl_entity_t a in Entities a |

455 |
| Architecture a -> |

456 |
let a = self#vhdl_architecture_t a in Architecture a |

457 |
| Configuration a -> |

458 |
let a = self#vhdl_configuration_t a in Configuration a |

459 | |

460 |
method vhdl_design_unit_t : vhdl_design_unit_t -> vhdl_design_unit_t= |

461 |
fun { contexts; library } -> |

462 |
let contexts = self#list self#vhdl_load_t contexts in |

463 |
let library = self#vhdl_library_unit_t library in |

464 |
{ contexts; library } |

465 | |

466 |
method vhdl_design_file_t : vhdl_design_file_t -> vhdl_design_file_t= |

467 |
fun { design_units } -> |

468 |
let design_units = self#list self#vhdl_design_unit_t design_units in |

469 |
{ design_units } |

470 | |

471 |
method vhdl_file_t : vhdl_file_t -> vhdl_file_t= |

472 |
fun { design_file } -> |

473 |
let design_file = self#vhdl_design_file_t design_file in |

474 |
{ design_file } |

475 |
end |