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 "%d") a0;

25

 CstStdLogic a0 >

26

(Format.fprintf fmt "%S") a0;

27

 CstLiteral a0 >

28

(Format.fprintf fmt "%s") a0;)

29

[@ocaml.warning "A"])

30


31

and show_vhdl_cst_val_t : vhdl_cst_val_t > Ppx_deriving_runtime.string =

32

fun x > Format.asprintf "%a" pp_vhdl_cst_val_t x

33


34

let rec (vhdl_cst_val_t_to_yojson : vhdl_cst_val_t > Yojson.Safe.json) =

35

((let open! Ppx_deriving_yojson_runtime in

36

function

37

 CstInt arg0 >

38

`List

39

[`String "CstInt";

40

((fun (x : Ppx_deriving_runtime.int) > `Int x)) arg0]

41

 CstStdLogic arg0 >

42

`List

43

[`String "CstStdLogic";

44

((fun (x : Ppx_deriving_runtime.string) > `String x)) arg0]

45

 CstLiteral arg0 >

46

`List

47

[`String "CST_LITERAL";

48

((fun (x : Ppx_deriving_runtime.string) > `String x)) arg0])

49

[@ocaml.warning "A"])

50


51

and (vhdl_cst_val_t_of_yojson :

52

Yojson.Safe.json > vhdl_cst_val_t Ppx_deriving_yojson_runtime.error_or)

53

=

54

((let open! Ppx_deriving_yojson_runtime in

55

function

56

 `List ((`String "CstInt")::arg0::[]) >

57

((function

58

 `Int x > Result.Ok x

59

 _ > Result.Error "Vhdl_ast.vhdl_cst_val_t") arg0) >>=

60

((fun arg0 > Result.Ok (CstInt arg0)))

61

 `List ((`String "CstStdLogic")::arg0::[]) >

62

((function

63

 `String x > Result.Ok x

64

 _ > Result.Error "Vhdl_ast.vhdl_cst_val_t") arg0) >>=

65

((fun arg0 > Result.Ok (CstStdLogic arg0)))

66

 `List ((`String "CST_LITERAL")::arg0::[]) >

67

((function

68

 `String x > Result.Ok x

69

 _ > Result.Error "Vhdl_ast.vhdl_cst_val_t") arg0) >>=

70

((fun arg0 > Result.Ok (CstLiteral arg0)))

71

 _ > Result.Error "Vhdl_ast.vhdl_cst_val_t")

72

[@ocaml.warning "A"])

73


74

type vhdl_type_t =

75

 Base of string

76

 Range of string option * int * int

77

 Bit_vector of int * int

78

 Array of

79

{

80

indexes: vhdl_name_t list [@default []];

81

const: vhdl_constraint_t option [@default None];

82

definition: vhdl_subtype_indication_t } [@name "ARRAY_TYPE_DEFINITION"]

83

 Record of vhdl_element_declaration_t list

84

[@name "RECORD_TYPE_DEFINITION"]

85

 Enumerated of vhdl_name_t list [@name "ENUMERATION_TYPE_DEFINITION"]

86

 Void

87

and vhdl_element_declaration_t =

88

{

89

names: vhdl_name_t list ;

90

definition: vhdl_subtype_indication_t }

91

and vhdl_subtype_indication_t =

92

{

93

name: vhdl_name_t [@default NoName];

94

functionName: vhdl_name_t [@default NoName];

95

const: vhdl_constraint_t [@default NoConstraint]}

96

and vhdl_discrete_range_t =

97

 SubDiscreteRange of vhdl_subtype_indication_t

98

[@name "SUB_DISCRETE_RANGE"]

99

 NamedRange of vhdl_name_t [@name "NAMED_RANGE"]

100

 DirectedRange of

101

{

102

direction: string ;

103

from: vhdl_expr_t ;

104

_to: vhdl_expr_t } [@name "RANGE_WITH_DIRECTION"]

105

and vhdl_constraint_t =

106

 RefConstraint of {

107

ref_name: vhdl_name_t }

108

 RangeConstraint of {

109

range: vhdl_discrete_range_t } [@name "RANGE_CONSTRAINT"]

110

 IndexConstraint of {

111

ranges: vhdl_discrete_range_t list } [@name "INDEX_CONSTRAINT"]

112

 ArrayConstraint of

113

{

114

ranges: vhdl_discrete_range_t list ;

115

sub: vhdl_constraint_t } [@name "ARRAY_CONSTRAINT"]

116

 RecordConstraint

117

 NoConstraint

118

and vhdl_definition_t =

119

 Type of {

120

name: vhdl_name_t ;

121

definition: vhdl_type_t } [@name "TYPE_DECLARATION"]

122

 Subtype of {

123

name: vhdl_name_t ;

124

typ: vhdl_subtype_indication_t } [@name "SUBTYPE_DECLARATION"]

125

and vhdl_expr_t =

126

 Call of vhdl_name_t [@name "CALL"]

127

 Cst of

128

{

129

value: vhdl_cst_val_t ;

130

unit_name: vhdl_name_t option [@default None]} [@name "CONSTANT_VALUE"]

131

 Op of {

132

id: string [@default ""];

133

args: vhdl_expr_t list [@default []]} [@name "EXPRESSION"]

134

 IsNull [@name "IsNull"]

135

 Time of {

136

value: int ;

137

phy_unit: string [@default ""]}

138

 Sig of {

139

name: vhdl_name_t ;

140

att: vhdl_signal_attributes_t option }

141

 SuffixMod of {

142

expr: vhdl_expr_t ;

143

selection: vhdl_suffix_selection_t }

144

 Aggregate of {

145

elems: vhdl_element_assoc_t list } [@name "AGGREGATE"]

146

 Others [@name "OTHERS"]

147

and vhdl_name_t =

148

 Simple of string [@name "SIMPLE_NAME"]

149

 Identifier of string [@name "IDENTIFIER"]

150

 Selected of vhdl_name_t list [@name "SELECTED_NAME"]

151

 Index of {

152

id: vhdl_name_t ;

153

exprs: vhdl_expr_t list } [@name "INDEXED_NAME"]

154

 Slice of {

155

id: vhdl_name_t ;

156

range: vhdl_discrete_range_t } [@name "SLICE_NAME"]

157

 Attribute of

158

{

159

id: vhdl_name_t ;

160

designator: vhdl_name_t ;

161

expr: vhdl_expr_t [@default IsNull]} [@name "ATTRIBUTE_NAME"]

162

 Function of {

163

id: vhdl_name_t ;

164

assoc_list: vhdl_assoc_element_t list } [@name "FUNCTION_CALL"]

165

 NoName

166

and vhdl_assoc_element_t =

167

{

168

formal_name: vhdl_name_t option [@default None];

169

formal_arg: vhdl_name_t option [@default None];

170

actual_name: vhdl_name_t option [@default None];

171

actual_designator: vhdl_name_t option [@default None];

172

actual_expr: vhdl_expr_t option [@default None]}

173

and vhdl_element_assoc_t = {

174

choices: vhdl_expr_t list [@default []];

175

expr: vhdl_expr_t }

176

and vhdl_array_attributes_t =

177

 AAttInt of {

178

id: string ;

179

arg: int }

180

 AAttAscending

181

and vhdl_signal_attributes_t =

182

 SigAtt of string

183

and vhdl_string_attributes_t =

184

 StringAtt of string

185

and vhdl_suffix_selection_t =

186

 Idx of int

187

 SuffixRange of int * int

188


189

let rec pp_vhdl_type_t :

190

Format.formatter > vhdl_type_t > Ppx_deriving_runtime.unit =

191

let __4 () = pp_vhdl_name_t

192


193

and __3 () = pp_vhdl_element_declaration_t

194


195

and __2 () = pp_vhdl_subtype_indication_t

196


197

and __1 () = pp_vhdl_constraint_t

198


199

and __0 () = pp_vhdl_name_t

200

in

201

((let open! Ppx_deriving_runtime in

202

fun fmt >

203

function

204

 Base a0 >

205

(Format.fprintf fmt "%s") a0;

206

 Range (a0,a1,a2) >

207

((

208

(Format.fprintf fmt "%d") a1);

209

((function

210

 None > Format.pp_print_string fmt ""

211

 Some x >

212

(Format.fprintf fmt "%s") x;

213

)) a0;

214

(Format.fprintf fmt "%d") a2);

215

 Bit_vector (a0,a1) >

216

(Format.fprintf fmt "array (%d,%d) of bit") a0 a1;

217

 Array

218

{ indexes = aindexes; const = aconst; definition = adefinition }

219

>

220

Format.fprintf fmt "array";

221

(match aindexes with

222

 [] > Format.fprintf fmt "";

223

 _ >

224

((fun x >

225

ignore

226

(List.fold_left

227

(fun sep >

228

fun x >

229

if sep then Format.fprintf fmt ",@ ";

230

((__0 ()) fmt) x;

231

true) false x)) aindexes));

232

(function

233

 None > Format.pp_print_string fmt ""

234

 Some x >

235

((__1 ()) fmt) x) aconst;

236

Format.fprintf fmt " of ";

237

((__2 ()) fmt) adefinition;

238

 Record a0 >

239

Format.fprintf fmt "@[<v 2>record@;";

240

(fun x >

241

ignore

242

(List.fold_left

243

(fun sep >

244

fun x >

245

if sep then Format.fprintf fmt ";@;";

246

((__3 ()) fmt) x;

247

true) false x);

248

Format.fprintf fmt "@]@;end record") a0;

249

 Enumerated a0 >

250

(Format.fprintf fmt "(";

251

((fun x >

252

ignore

253

(List.fold_left

254

(fun sep >

255

fun x >

256

if sep then Format.fprintf fmt ",@ ";

257

((__4 ()) fmt) x;

258

true) false x))) a0;

259

Format.fprintf fmt ")");

260

 Void > Format.pp_print_string fmt "")

261

[@ocaml.warning "A"])

262


263

and show_vhdl_type_t : vhdl_type_t > Ppx_deriving_runtime.string =

264

fun x > Format.asprintf "%a" pp_vhdl_type_t x

265


266

and pp_vhdl_element_declaration_t :

267

Format.formatter > vhdl_element_declaration_t > Ppx_deriving_runtime.unit

268

=

269

let __1 () = pp_vhdl_subtype_indication_t

270


271

and __0 () = pp_vhdl_name_t

272

in

273

((let open! Ppx_deriving_runtime in

274

fun fmt >

275

fun x >

276

(fun x >

277

ignore

278

(List.fold_left

279

(fun sep >

280

fun x >

281

if sep then Format.fprintf fmt ",@ ";

282

((__0 ()) fmt) x;

283

true) false x)) x.names;

284

Format.fprintf fmt ":@ ";

285

((__1 ()) fmt) x.definition)

286

[@ocaml.warning "A"])

287


288

and show_vhdl_element_declaration_t :

289

vhdl_element_declaration_t > Ppx_deriving_runtime.string =

290

fun x > Format.asprintf "%a" pp_vhdl_element_declaration_t x

291


292

and pp_vhdl_subtype_indication_t :

293

Format.formatter > vhdl_subtype_indication_t > Ppx_deriving_runtime.unit

294

=

295

let __2 () = pp_vhdl_constraint_t

296


297

and __1 () = pp_vhdl_name_t

298


299

and __0 () = pp_vhdl_name_t

300

in

301

((let open! Ppx_deriving_runtime in

302

fun fmt >

303

fun x >

304

((__0 ()) fmt) x.name;

305

((__1 ()) fmt) x.functionName;

306

(match x.const with

307

 NoConstraint > Format.fprintf fmt "";

308

 _ > Format.fprintf fmt " ";

309

((__2 ()) fmt) x.const))

310

[@ocaml.warning "A"])

311


312

and show_vhdl_subtype_indication_t :

313

vhdl_subtype_indication_t > Ppx_deriving_runtime.string =

314

fun x > Format.asprintf "%a" pp_vhdl_subtype_indication_t x

315


316

and pp_vhdl_discrete_range_t :

317

Format.formatter > vhdl_discrete_range_t > Ppx_deriving_runtime.unit =

318

let __3 () = pp_vhdl_expr_t

319


320

and __2 () = pp_vhdl_expr_t

321


322

and __1 () = pp_vhdl_name_t

323


324

and __0 () = pp_vhdl_subtype_indication_t

325

in

326

((let open! Ppx_deriving_runtime in

327

fun fmt >

328

function

329

 SubDiscreteRange a0 >

330

((__0 ()) fmt) a0;

331

 NamedRange a0 >

332

((__1 ()) fmt) a0;

333

 DirectedRange { direction = adirection; from = afrom; _to = a_to }

334

>

335

((__2 ()) fmt) afrom;

336

(Format.fprintf fmt " %s ") adirection;

337

((__3 ()) fmt) a_to;

338

)

339

[@ocaml.warning "A"])

340


341

and show_vhdl_discrete_range_t :

342

vhdl_discrete_range_t > Ppx_deriving_runtime.string =

343

fun x > Format.asprintf "%a" pp_vhdl_discrete_range_t x

344


345

(* TODO Adapt for: ArrayConstraint, RecordConstraint *)

346

and pp_vhdl_constraint_t :

347

Format.formatter > vhdl_constraint_t > Ppx_deriving_runtime.unit =

348

let __4 () = pp_vhdl_constraint_t

349


350

and __3 () = pp_vhdl_discrete_range_t

351


352

and __2 () = pp_vhdl_discrete_range_t

353


354

and __1 () = pp_vhdl_discrete_range_t

355


356

and __0 () = pp_vhdl_name_t

357

in

358

((let open! Ppx_deriving_runtime in

359

fun fmt >

360

function

361

 RefConstraint { ref_name = aref_name } >

362

(Format.fprintf fmt "(";

363

((__0 ()) fmt) aref_name;

364

Format.fprintf fmt ")");

365

 RangeConstraint { range = arange } >

366

(Format.fprintf fmt "(";

367

((__1 ()) fmt) arange;

368

Format.fprintf fmt ")");

369

 IndexConstraint { ranges = aranges } >

370

Format.fprintf fmt "(";

371

((fun x >

372

ignore

373

(List.fold_left

374

(fun sep >

375

fun x >

376

if sep then Format.fprintf fmt ", ";

377

((__2 ()) fmt) x;

378

true) false x))) aranges;

379

Format.fprintf fmt ")";

380

 ArrayConstraint { ranges = aranges; sub = asub } >

381

(Format.fprintf fmt "@[<2>ArrayConstraint {@,";

382

((Format.fprintf fmt "@[%s =@ " "ranges";

383

((fun x >

384

Format.fprintf fmt "@[<2>[";

385

ignore

386

(List.fold_left

387

(fun sep >

388

fun x >

389

if sep then Format.fprintf fmt ";@ ";

390

((__3 ()) fmt) x;

391

true) false x);

392

Format.fprintf fmt "@,]@]")) aranges;

393

Format.fprintf fmt "@]");

394

Format.fprintf fmt ";@ ";

395

Format.fprintf fmt "@[%s =@ " "sub";

396

((__4 ()) fmt) asub;

397

Format.fprintf fmt "@]");

398

Format.fprintf fmt "@]}")

399

 RecordConstraint > Format.pp_print_string fmt ""

400

 NoConstraint > Format.pp_print_string fmt "")

401

[@ocaml.warning "A"])

402


403

and show_vhdl_constraint_t : vhdl_constraint_t > Ppx_deriving_runtime.string

404

= fun x > Format.asprintf "%a" pp_vhdl_constraint_t x

405


406

and pp_vhdl_definition_t :

407

Format.formatter > vhdl_definition_t > Ppx_deriving_runtime.unit =

408

let __3 () = pp_vhdl_subtype_indication_t

409


410

and __2 () = pp_vhdl_name_t

411


412

and __1 () = pp_vhdl_type_t

413


414

and __0 () = pp_vhdl_name_t

415

in

416

((let open! Ppx_deriving_runtime in

417

fun fmt >

418

function

419

 Type { name = aname; definition = adefinition } >

420

Format.fprintf fmt "type ";

421

((__0 ()) fmt) aname;

422

Format.fprintf fmt " is ";

423

((__1 ()) fmt) adefinition;

424

 Subtype { name = aname; typ = atyp } >

425

Format.fprintf fmt "subtype ";

426

((__2 ()) fmt) aname;

427

Format.fprintf fmt " is ";

428

((__3 ()) fmt) atyp;

429

)

430

[@ocaml.warning "A"])

431


432

and show_vhdl_definition_t : vhdl_definition_t > Ppx_deriving_runtime.string

433

= fun x > Format.asprintf "%a" pp_vhdl_definition_t x

434


435

(* TODO adapt for Op, Time, Sig, suffixMod, Aggregate *)

436

and pp_vhdl_expr_t :

437

Format.formatter > vhdl_expr_t > Ppx_deriving_runtime.unit =

438

let __8 () = pp_vhdl_element_assoc_t

439


440

and __7 () = pp_vhdl_suffix_selection_t

441


442

and __6 () = pp_vhdl_expr_t

443


444

and __5 () = pp_vhdl_signal_attributes_t

445


446

and __4 () = pp_vhdl_name_t

447


448

and __3 () = pp_vhdl_expr_t

449


450

and __2 () = pp_vhdl_name_t

451


452

and __1 () = pp_vhdl_cst_val_t

453


454

and __0 () = pp_vhdl_name_t

455

in

456

((let open! Ppx_deriving_runtime in

457

fun fmt >

458

function

459

 Call a0 >

460

((__0 ()) fmt) a0;

461

 Cst { value = avalue; unit_name = aunit_name } >

462

((__1 ()) fmt) avalue;

463

(function

464

 None > Format.pp_print_string fmt ""

465

 Some x >

466

Format.fprintf fmt " ";

467

((__2 ()) fmt) x) aunit_name;

468

 Op { id = aid; args = aargs } >

469

(match aargs with

470

 [] > (Format.fprintf fmt "%s") aid;

471

 hd::[] >

472

(Format.fprintf fmt "%s") aid;

473

((__3 ()) fmt) hd

474

 hd::(hd2::[]) >

475

((__3 ()) fmt) hd;

476

(Format.fprintf fmt " %s ") aid;

477

((__3 ()) fmt) hd2

478

 _ >

479

(Format.fprintf fmt "@[<2>Op {@,";

480

((Format.fprintf fmt "@[%s =@ " "id";

481

(Format.fprintf fmt "%S") aid;

482

Format.fprintf fmt "@]");

483

Format.fprintf fmt ";@ ";

484

Format.fprintf fmt "@[%s =@ " "args";

485

((fun x >

486

Format.fprintf fmt "@[<2>[";

487

ignore

488

(List.fold_left

489

(fun sep >

490

fun x >

491

if sep then Format.fprintf fmt ";@ ";

492

((__3 ()) fmt) x;

493

true) false x);

494

Format.fprintf fmt "@,]@]")) aargs;

495

Format.fprintf fmt "@]");

496

Format.fprintf fmt "@]}"))

497

 IsNull > Format.pp_print_string fmt ""

498

 Time { value = avalue; phy_unit = aphy_unit } >

499

(Format.fprintf fmt "@[<2>Time {@,";

500

((Format.fprintf fmt "@[%s =@ " "value";

501

(Format.fprintf fmt "%d") avalue;

502

Format.fprintf fmt "@]");

503

Format.fprintf fmt ";@ ";

504

Format.fprintf fmt "@[%s =@ " "phy_unit";

505

(Format.fprintf fmt "%S") aphy_unit;

506

Format.fprintf fmt "@]");

507

Format.fprintf fmt "@]}")

508

 Sig { name = aname; att = aatt } >

509

(Format.fprintf fmt "@[<2>Sig {@,";

510

((Format.fprintf fmt "@[%s =@ " "name";

511

((__4 ()) fmt) aname;

512

Format.fprintf fmt "@]");

513

Format.fprintf fmt ";@ ";

514

Format.fprintf fmt "@[%s =@ " "att";

515

((function

516

 None > Format.pp_print_string fmt "None"

517

 Some x >

518

(Format.pp_print_string fmt "(Some ";

519

((__5 ()) fmt) x;

520

Format.pp_print_string fmt ")"))) aatt;

521

Format.fprintf fmt "@]");

522

Format.fprintf fmt "@]}")

523

 SuffixMod { expr = aexpr; selection = aselection } >

524

(Format.fprintf fmt "@[<2>SuffixMod {@,";

525

((Format.fprintf fmt "@[%s =@ " "expr";

526

((__6 ()) fmt) aexpr;

527

Format.fprintf fmt "@]");

528

Format.fprintf fmt ";@ ";

529

Format.fprintf fmt "@[%s =@ " "selection";

530

((__7 ()) fmt) aselection;

531

Format.fprintf fmt "@]");

532

Format.fprintf fmt "@]}")

533

 Aggregate { elems = aelems } >

534

(Format.fprintf fmt "@[<2>Aggregate {@,";

535

(Format.fprintf fmt "@[%s =@ " "elems";

536

((fun x >

537

Format.fprintf fmt "@[<2>[";

538

ignore

539

(List.fold_left

540

(fun sep >

541

fun x >

542

if sep then Format.fprintf fmt ";@ ";

543

((__8 ()) fmt) x;

544

true) false x);

545

Format.fprintf fmt "@,]@]")) aelems;

546

Format.fprintf fmt "@]");

547

Format.fprintf fmt "@]}")

548

 Others > Format.pp_print_string fmt "others")

549

[@ocaml.warning "A"])

550


551

and show_vhdl_expr_t : vhdl_expr_t > Ppx_deriving_runtime.string =

552

fun x > Format.asprintf "%a" pp_vhdl_expr_t x

553


554

and pp_vhdl_name_t :

555

Format.formatter > vhdl_name_t > Ppx_deriving_runtime.unit =

556

let __9 () = pp_vhdl_assoc_element_t

557


558

and __8 () = pp_vhdl_name_t

559


560

and __7 () = pp_vhdl_expr_t

561


562

and __6 () = pp_vhdl_name_t

563


564

and __5 () = pp_vhdl_name_t

565


566

and __4 () = pp_vhdl_discrete_range_t

567


568

and __3 () = pp_vhdl_name_t

569


570

and __2 () = pp_vhdl_expr_t

571


572

and __1 () = pp_vhdl_name_t

573


574

and __0 () = pp_vhdl_name_t

575

in

576

((let open! Ppx_deriving_runtime in

577

fun fmt >

578

function

579

 Simple a0 >

580

(Format.fprintf fmt "%s") a0;

581

 Identifier a0 >

582

(Format.fprintf fmt "%s") a0;

583

 Selected a0 >

584

((fun x >

585

ignore

586

(List.fold_left

587

(fun sep >

588

fun x >

589

if sep then Format.fprintf fmt ".";

590

((__0 ()) fmt) x;

591

true) false x);) a0;)

592

 Index { id = aid; exprs = aexprs } >

593

((__1 ()) fmt) aid;

594

Format.fprintf fmt "(";

595

(fun x >

596

ignore

597

(List.fold_left

598

(fun sep >

599

fun x >

600

if sep then Format.fprintf fmt ",@ ";

601

((__2 ()) fmt) x;

602

true

603

) false x);

604

) aexprs;

605

Format.fprintf fmt ")";

606

 Slice { id = aid; range = arange } >

607

((__3 ()) fmt) aid;

608

Format.fprintf fmt "(";

609

((__4 ()) fmt) arange;

610

Format.fprintf fmt ")";

611

 Attribute { id = aid; designator = adesignator; expr = aexpr } >

612

((__5 ()) fmt) aid;

613

Format.fprintf fmt "\'";

614

((__6 ()) fmt) adesignator;

615

(match aexpr with

616

 IsNull > Format.fprintf fmt "";

617

 _ >

618

Format.fprintf fmt "(";

619

((__7 ()) fmt) aexpr;

620

Format.fprintf fmt ")")

621

 Function { id = aid; assoc_list = aassoc_list } >

622

(((__8 ()) fmt) aid;

623

Format.fprintf fmt "(";

624

((fun x >

625

Format.fprintf fmt "@[";

626

ignore

627

(List.fold_left

628

(fun sep >

629

fun x >

630

if sep then Format.fprintf fmt ";@ ";

631

((__9 ()) fmt) x;

632

true) false x);

633

Format.fprintf fmt "@]")) aassoc_list;

634

Format.fprintf fmt ")";)

635

 NoName > Format.pp_print_string fmt "")

636

[@ocaml.warning "A"])

637


638

and show_vhdl_name_t : vhdl_name_t > Ppx_deriving_runtime.string =

639

fun x > Format.asprintf "%a" pp_vhdl_name_t x

640


641

and pp_vhdl_assoc_element_t :

642

Format.formatter > vhdl_assoc_element_t > Ppx_deriving_runtime.unit =

643

let __4 () = pp_vhdl_expr_t

644


645

and __3 () = pp_vhdl_name_t

646


647

and __2 () = pp_vhdl_name_t

648


649

and __1 () = pp_vhdl_name_t

650


651

and __0 () = pp_vhdl_name_t

652

in

653

((let open! Ppx_deriving_runtime in

654

fun fmt >

655

fun x >

656

(match x.formal_name with

657

 None > Format.pp_print_string fmt ""

658

 Some NoName > Format.pp_print_string fmt ""

659

 Some a >

660

(((__0 ()) fmt) a;

661

(match x.formal_arg with

662

 None > ()

663

 Some b > Format.fprintf fmt "(";

664

((__1 ()) fmt) b;

665

Format.fprintf fmt ")");

666

Format.fprintf fmt " => "));

667

(match x.actual_name with

668

 None > Format.pp_print_string fmt ""

669

 Some a >

670

(((__2 ()) fmt) a;

671

(match x.actual_designator with

672

 None > ()

673

 Some NoName > Format.pp_print_string fmt ""

674

 Some b > (Format.fprintf fmt "(";

675

((__3 ()) fmt) b;

676

Format.fprintf fmt ")"));

677

(match x.actual_expr with

678

 None > ()

679

 Some IsNull > Format.pp_print_string fmt ""

680

 Some c > (Format.fprintf fmt "(";

681

((__4 ()) fmt) c;

682

Format.fprintf fmt ")"))));)

683

[@ocaml.warning "A"])

684


685

and show_vhdl_assoc_element_t :

686

vhdl_assoc_element_t > Ppx_deriving_runtime.string =

687

fun x > Format.asprintf "%a" pp_vhdl_assoc_element_t x

688


689

and pp_vhdl_element_assoc_t :

690

Format.formatter > vhdl_element_assoc_t > Ppx_deriving_runtime.unit =

691

let __1 () = pp_vhdl_expr_t

692


693

and __0 () = pp_vhdl_expr_t

694

in

695

((let open! Ppx_deriving_runtime in

696

fun fmt >

697

fun x >

698

(match x.choices with

699

 [] > Format.fprintf fmt "";

700

 _ >

701

(((fun x >

702

Format.fprintf fmt "@[<2>[";

703

ignore

704

(List.fold_left

705

(fun sep >

706

fun x >

707

if sep then Format.fprintf fmt "@ ";

708

((__0 ()) fmt) x;

709

true) false x))) x.choices;

710

Format.fprintf fmt " => ";));

711

((__1 ()) fmt) x.expr)

712

[@ocaml.warning "A"])

713


714

and show_vhdl_element_assoc_t :

715

vhdl_element_assoc_t > Ppx_deriving_runtime.string =

716

fun x > Format.asprintf "%a" pp_vhdl_element_assoc_t x

717


718

(* TODO *)

719

and (pp_vhdl_array_attributes_t :

720

Format.formatter >

721

vhdl_array_attributes_t > Ppx_deriving_runtime.unit)

722

=

723

((let open! Ppx_deriving_runtime in

724

fun fmt >

725

function

726

 AAttInt { id = aid; arg = aarg } >

727

(Format.fprintf fmt "@[<2>AAttInt {@,";

728

((Format.fprintf fmt "@[%s =@ " "id";

729

(Format.fprintf fmt "%S") aid;

730

Format.fprintf fmt "@]");

731

Format.fprintf fmt ";@ ";

732

Format.fprintf fmt "@[%s =@ " "arg";

733

(Format.fprintf fmt "%d") aarg;

734

Format.fprintf fmt "@]");

735

Format.fprintf fmt "@]}")

736

 AAttAscending > Format.pp_print_string fmt "AAttAscending")

737

[@ocaml.warning "A"])

738


739

and show_vhdl_array_attributes_t :

740

vhdl_array_attributes_t > Ppx_deriving_runtime.string =

741

fun x > Format.asprintf "%a" pp_vhdl_array_attributes_t x

742


743

(* TODO *)

744

and (pp_vhdl_signal_attributes_t :

745

Format.formatter >

746

vhdl_signal_attributes_t > Ppx_deriving_runtime.unit)

747

=

748

((let open! Ppx_deriving_runtime in

749

fun fmt >

750

function

751

 SigAtt a0 >

752

(Format.fprintf fmt "(@[<2>SigAtt@ ";

753

(Format.fprintf fmt "%S") a0;

754

Format.fprintf fmt "@])"))

755

[@ocaml.warning "A"])

756


757

and show_vhdl_signal_attributes_t :

758

vhdl_signal_attributes_t > Ppx_deriving_runtime.string =

759

fun x > Format.asprintf "%a" pp_vhdl_signal_attributes_t x

760


761

(* TODO *)

762

and (pp_vhdl_string_attributes_t :

763

Format.formatter >

764

vhdl_string_attributes_t > Ppx_deriving_runtime.unit)

765

=

766

((let open! Ppx_deriving_runtime in

767

fun fmt >

768

function

769

 StringAtt a0 >

770

(Format.fprintf fmt "(@[<2>StringAtt@ ";

771

(Format.fprintf fmt "%S") a0;

772

Format.fprintf fmt "@])"))

773

[@ocaml.warning "A"])

774


775

and show_vhdl_string_attributes_t :

776

vhdl_string_attributes_t > Ppx_deriving_runtime.string =

777

fun x > Format.asprintf "%a" pp_vhdl_string_attributes_t x

778


779

(* TODO *)

780

and (pp_vhdl_suffix_selection_t :

781

Format.formatter >

782

vhdl_suffix_selection_t > Ppx_deriving_runtime.unit)

783

=

784

((let open! Ppx_deriving_runtime in

785

fun fmt >

786

function

787

 Idx a0 >

788

(Format.fprintf fmt "(@[<2>Idx@ ";

789

(Format.fprintf fmt "%d") a0;

790

Format.fprintf fmt "@])")

791

 SuffixRange (a0,a1) >

792

(Format.fprintf fmt "(@[<2>SuffixRange (@,";

793

((Format.fprintf fmt "%d") a0;

794

Format.fprintf fmt ",@ ";

795

(Format.fprintf fmt "%d") a1);

796

Format.fprintf fmt "@,))@]"))

797

[@ocaml.warning "A"])

798


799

and show_vhdl_suffix_selection_t :

800

vhdl_suffix_selection_t > Ppx_deriving_runtime.string =

801

fun x > Format.asprintf "%a" pp_vhdl_suffix_selection_t x

802


803

let rec (vhdl_type_t_to_yojson : vhdl_type_t > Yojson.Safe.json) =

804

((let open! Ppx_deriving_yojson_runtime in

805

function

806

 Base arg0 >

807

`List

808

[`String "Base";

809

((fun (x : Ppx_deriving_runtime.string) > `String x)) arg0]

810

 Range (arg0,arg1,arg2) >

811

`List

812

[`String "Range";

813

((function

814

 None > `Null

815

 Some x >

816

((fun (x : Ppx_deriving_runtime.string) > `String x)) x))

817

arg0;

818

((fun (x : Ppx_deriving_runtime.int) > `Int x)) arg1;

819

((fun (x : Ppx_deriving_runtime.int) > `Int x)) arg2]

820

 Bit_vector (arg0,arg1) >

821

`List

822

[`String "Bit_vector";

823

((fun (x : Ppx_deriving_runtime.int) > `Int x)) arg0;

824

((fun (x : Ppx_deriving_runtime.int) > `Int x)) arg1]

825

 Array arg0 >

826

`List

827

[`String "ARRAY_TYPE_DEFINITION";

828

(let fields = [] in

829

let fields =

830

("definition",

831

((fun x > vhdl_subtype_indication_t_to_yojson x)

832

arg0.definition))

833

:: fields in

834

let fields =

835

if arg0.const = None

836

then fields

837

else

838

("const",

839

(((function

840

 None > `Null

841

 Some x >

842

((fun x > vhdl_constraint_t_to_yojson x)) x))

843

arg0.const))

844

:: fields

845

in

846

let fields =

847

if arg0.indexes = []

848

then fields

849

else

850

("indexes",

851

(((fun x >

852

`List

853

(List.map (fun x > vhdl_name_t_to_yojson x) x)))

854

arg0.indexes))

855

:: fields

856

in

857

`Assoc fields)]

858

 Record arg0 >

859

`List

860

[`String "RECORD_TYPE_DEFINITION";

861

((fun x >

862

`List

863

(List.map

864

(fun x > vhdl_element_declaration_t_to_yojson x) x)))

865

arg0]

866

 Enumerated arg0 >

867

`List

868

[`String "ENUMERATION_TYPE_DEFINITION";

869

((fun x >

870

`List (List.map (fun x > vhdl_name_t_to_yojson x) x))) arg0]

871

 Void > `List [`String "Void"])

872

[@ocaml.warning "A"])

873


874

and (vhdl_type_t_of_yojson :

875

Yojson.Safe.json > vhdl_type_t Ppx_deriving_yojson_runtime.error_or)

876

=

877

((let open! Ppx_deriving_yojson_runtime in

878

function

879

 `List ((`String "Base")::arg0::[]) >

880

((function

881

 `String x > Result.Ok x

882

 _ > Result.Error "Vhdl_ast.vhdl_type_t") arg0) >>=

883

((fun arg0 > Result.Ok (Base arg0)))

884

 `List ((`String "Range")::arg0::arg1::arg2::[]) >

885

((function

886

 `Int x > Result.Ok x

887

 _ > Result.Error "Vhdl_ast.vhdl_type_t") arg2) >>=

888

((fun arg2 >

889

((function

890

 `Int x > Result.Ok x

891

 _ > Result.Error "Vhdl_ast.vhdl_type_t") arg1) >>=

892

(fun arg1 >

893

((function

894

 `Null > Result.Ok None

895

 x >

896

((function

897

 `String x > Result.Ok x

898

 _ > Result.Error "Vhdl_ast.vhdl_type_t") x)

899

>>= ((fun x > Result.Ok (Some x)))) arg0)

900

>>=

901

(fun arg0 > Result.Ok (Range (arg0, arg1, arg2))))))

902

 `List ((`String "Bit_vector")::arg0::arg1::[]) >

903

((function

904

 `Int x > Result.Ok x

905

 _ > Result.Error "Vhdl_ast.vhdl_type_t") arg1) >>=

906

((fun arg1 >

907

((function

908

 `Int x > Result.Ok x

909

 _ > Result.Error "Vhdl_ast.vhdl_type_t") arg0) >>=

910

(fun arg0 > Result.Ok (Bit_vector (arg0, arg1)))))

911

 `List ((`String "ARRAY_TYPE_DEFINITION")::arg0::[]) >

912

((function

913

 `Assoc xs >

914

let rec loop xs ((arg0,arg1,arg2) as _state) =

915

match xs with

916

 ("indexes",x)::xs >

917

loop xs

918

(((function

919

 `List xs >

920

map_bind (fun x > vhdl_name_t_of_yojson x)

921

[] xs

922

 _ > Result.Error "Vhdl_ast.vhdl_type_t.indexes")

923

x), arg1, arg2)

924

 ("const",x)::xs >

925

loop xs

926

(arg0,

927

((function

928

 `Null > Result.Ok None

929

 x >

930

((fun x > vhdl_constraint_t_of_yojson x) x)

931

>>= ((fun x > Result.Ok (Some x)))) x),

932

arg2)

933

 ("definition",x)::xs >

934

loop xs

935

(arg0, arg1,

936

((fun x > vhdl_subtype_indication_t_of_yojson x)

937

x))

938

 [] >

939

arg2 >>=

940

((fun arg2 >

941

arg1 >>=

942

(fun arg1 >

943

arg0 >>=

944

(fun arg0 >

945

Result.Ok

946

(Array

947

{

948

indexes = arg0;

949

const = arg1;

950

definition = arg2

951

})))))

952

 _::xs > loop xs _state in

953

loop xs

954

((Result.Ok []), (Result.Ok None),

955

(Result.Error "Vhdl_ast.vhdl_type_t.definition"))

956

 _ > Result.Error "Vhdl_ast.vhdl_type_t")) arg0

957

 `List ((`String "RECORD_TYPE_DEFINITION")::arg0::[]) >

958

((function

959

 `List xs >

960

map_bind (fun x > vhdl_element_declaration_t_of_yojson x)

961

[] xs

962

 _ > Result.Error "Vhdl_ast.vhdl_type_t") arg0) >>=

963

((fun arg0 > Result.Ok (Record arg0)))

964

 `List ((`String "ENUMERATION_TYPE_DEFINITION")::arg0::[]) >

965

((function

966

 `List xs > map_bind (fun x > vhdl_name_t_of_yojson x) [] xs

967

 _ > Result.Error "Vhdl_ast.vhdl_type_t") arg0) >>=

968

((fun arg0 > Result.Ok (Enumerated arg0)))

969

 `List ((`String "Void")::[]) > Result.Ok Void

970

 _ > Result.Error "Vhdl_ast.vhdl_type_t")

971

[@ocaml.warning "A"])

972


973

and (vhdl_element_declaration_t_to_yojson :

974

vhdl_element_declaration_t > Yojson.Safe.json)

975

=

976

((let open! Ppx_deriving_yojson_runtime in

977

fun x >

978

let fields = [] in

979

let fields =

980

("definition",

981

((fun x > vhdl_subtype_indication_t_to_yojson x) x.definition))

982

:: fields in

983

let fields =

984

("names",

985

((fun x >

986

`List (List.map (fun x > vhdl_name_t_to_yojson x) x))

987

x.names))

988

:: fields in

989

`Assoc fields)

990

[@ocaml.warning "A"])

991


992

and (vhdl_element_declaration_t_of_yojson :

993

Yojson.Safe.json >

994

vhdl_element_declaration_t Ppx_deriving_yojson_runtime.error_or)

995

=

996

((let open! Ppx_deriving_yojson_runtime in

997

function

998

 `Assoc xs >

999

let rec loop xs ((arg0,arg1) as _state) =

1000

match xs with

1001

 ("names",x)::xs >

1002

loop xs

1003

(((function

1004

 `List xs >

1005

map_bind (fun x > vhdl_name_t_of_yojson x) [] xs

1006

 _ >

1007

Result.Error

1008

"Vhdl_ast.vhdl_element_declaration_t.names") x),

1009

arg1)

1010

 ("definition",x)::xs >

1011

loop xs

1012

(arg0,

1013

((fun x > vhdl_subtype_indication_t_of_yojson x) x))

1014

 [] >

1015

arg1 >>=

1016

((fun arg1 >

1017

arg0 >>=

1018

(fun arg0 >

1019

Result.Ok { names = arg0; definition = arg1 })))

1020

 _::xs > loop xs _state in

1021

loop xs

1022

((Result.Error "Vhdl_ast.vhdl_element_declaration_t.names"),

1023

(Result.Error "Vhdl_ast.vhdl_element_declaration_t.definition"))

1024

 _ > Result.Error "Vhdl_ast.vhdl_element_declaration_t")

1025

[@ocaml.warning "A"])

1026


1027

and (vhdl_subtype_indication_t_to_yojson :

1028

vhdl_subtype_indication_t > Yojson.Safe.json)

1029

=

1030

((let open! Ppx_deriving_yojson_runtime in

1031

fun x >

1032

let fields = [] in

1033

let fields =

1034

if x.const = NoConstraint

1035

then fields

1036

else

1037

("const", (((fun x > vhdl_constraint_t_to_yojson x)) x.const))

1038

:: fields

1039

in

1040

let fields =

1041

if x.functionName = NoName

1042

then fields

1043

else

1044

("functionName",

1045

(((fun x > vhdl_name_t_to_yojson x)) x.functionName))

1046

:: fields

1047

in

1048

let fields =

1049

if x.name = NoName

1050

then fields

1051

else ("name", (((fun x > vhdl_name_t_to_yojson x)) x.name)) ::

1052

fields

1053

in

1054

`Assoc fields)

1055

[@ocaml.warning "A"])

1056


1057

and (vhdl_subtype_indication_t_of_yojson :

1058

Yojson.Safe.json >

1059

vhdl_subtype_indication_t Ppx_deriving_yojson_runtime.error_or)

1060

=

1061

((let open! Ppx_deriving_yojson_runtime in

1062

function

1063

 `Assoc xs >

1064

let rec loop xs ((arg0,arg1,arg2) as _state) =

1065

match xs with

1066

 ("name",x)::xs >

1067

loop xs (((fun x > vhdl_name_t_of_yojson x) x), arg1, arg2)

1068

 ("functionName",x)::xs >

1069

loop xs (arg0, ((fun x > vhdl_name_t_of_yojson x) x), arg2)

1070

 ("const",x)::xs >

1071

loop xs

1072

(arg0, arg1, ((fun x > vhdl_constraint_t_of_yojson x) x))

1073

 [] >

1074

arg2 >>=

1075

((fun arg2 >

1076

arg1 >>=

1077

(fun arg1 >

1078

arg0 >>=

1079

(fun arg0 >

1080

Result.Ok

1081

{

1082

name = arg0;

1083

functionName = arg1;

1084

const = arg2

1085

}))))

1086

 _::xs > loop xs _state in

1087

loop xs

1088

((Result.Ok NoName), (Result.Ok NoName),

1089

(Result.Ok NoConstraint))

1090

 _ > Result.Error "Vhdl_ast.vhdl_subtype_indication_t")

1091

[@ocaml.warning "A"])

1092


1093

and (vhdl_discrete_range_t_to_yojson :

1094

vhdl_discrete_range_t > Yojson.Safe.json)

1095

=

1096

((let open! Ppx_deriving_yojson_runtime in

1097

function

1098

 SubDiscreteRange arg0 >

1099

`List

1100

[`String "SUB_DISCRETE_RANGE";

1101

((fun x > vhdl_subtype_indication_t_to_yojson x)) arg0]

1102

 NamedRange arg0 >

1103

`List

1104

[`String "NAMED_RANGE";

1105

((fun x > vhdl_name_t_to_yojson x)) arg0]

1106

 DirectedRange arg0 >

1107

`List

1108

[`String "RANGE_WITH_DIRECTION";

1109

(let fields = [] in

1110

let fields =

1111

("_to", ((fun x > vhdl_expr_t_to_yojson x) arg0._to)) ::

1112

fields in

1113

let fields =

1114

("from", ((fun x > vhdl_expr_t_to_yojson x) arg0.from)) ::

1115

fields in

1116

let fields =

1117

("direction",

1118

((fun (x : Ppx_deriving_runtime.string) > `String x)

1119

arg0.direction))

1120

:: fields in

1121

`Assoc fields)])

1122

[@ocaml.warning "A"])

1123


1124

and (vhdl_discrete_range_t_of_yojson :

1125

Yojson.Safe.json >

1126

vhdl_discrete_range_t Ppx_deriving_yojson_runtime.error_or)

1127

=

1128

((let open! Ppx_deriving_yojson_runtime in

1129

function

1130

 `List ((`String "SUB_DISCRETE_RANGE")::arg0::[]) >

1131

((fun x > vhdl_subtype_indication_t_of_yojson x) arg0) >>=

1132

((fun arg0 > Result.Ok (SubDiscreteRange arg0)))

1133

 `List ((`String "NAMED_RANGE")::arg0::[]) >

1134

((fun x > vhdl_name_t_of_yojson x) arg0) >>=

1135

((fun arg0 > Result.Ok (NamedRange arg0)))

1136

 `List ((`String "RANGE_WITH_DIRECTION")::arg0::[]) >

1137

((function

1138

 `Assoc xs >

1139

let rec loop xs ((arg0,arg1,arg2) as _state) =

1140

match xs with

1141

 ("direction",x)::xs >

1142

loop xs

1143

(((function

1144

 `String x > Result.Ok x

1145

 _ >

1146

Result.Error

1147

"Vhdl_ast.vhdl_discrete_range_t.direction")

1148

x), arg1, arg2)

1149

 ("from",x)::xs >

1150

loop xs

1151

(arg0, ((fun x > vhdl_expr_t_of_yojson x) x), arg2)

1152

 ("_to",x)::xs >

1153

loop xs

1154

(arg0, arg1, ((fun x > vhdl_expr_t_of_yojson x) x))

1155

 [] >

1156

arg2 >>=

1157

((fun arg2 >

1158

arg1 >>=

1159

(fun arg1 >

1160

arg0 >>=

1161

(fun arg0 >

1162

Result.Ok

1163

(DirectedRange

1164

{

1165

direction = arg0;

1166

from = arg1;

1167

_to = arg2

1168

})))))

1169

 _::xs > loop xs _state in

1170

loop xs

1171

((Result.Error "Vhdl_ast.vhdl_discrete_range_t.direction"),

1172

(Result.Error "Vhdl_ast.vhdl_discrete_range_t.from"),

1173

(Result.Error "Vhdl_ast.vhdl_discrete_range_t._to"))

1174

 _ > Result.Error "Vhdl_ast.vhdl_discrete_range_t")) arg0

1175

 _ > Result.Error "Vhdl_ast.vhdl_discrete_range_t")

1176

[@ocaml.warning "A"])

1177


1178

and (vhdl_constraint_t_to_yojson : vhdl_constraint_t > Yojson.Safe.json) =

1179

((let open! Ppx_deriving_yojson_runtime in

1180

function

1181

 RefConstraint arg0 >

1182

`List

1183

[`String "RefConstraint";

1184

(let fields = [] in

1185

let fields =

1186

("ref_name",

1187

((fun x > vhdl_name_t_to_yojson x) arg0.ref_name))

1188

:: fields in

1189

`Assoc fields)]

1190

 RangeConstraint arg0 >

1191

`List

1192

[`String "RANGE_CONSTRAINT";

1193

(let fields = [] in

1194

let fields =

1195

("range",

1196

((fun x > vhdl_discrete_range_t_to_yojson x) arg0.range))

1197

:: fields in

1198

`Assoc fields)]

1199

 IndexConstraint arg0 >

1200

`List

1201

[`String "INDEX_CONSTRAINT";

1202

(let fields = [] in

1203

let fields =

1204

("ranges",

1205

((fun x >

1206

`List

1207

(List.map

1208

(fun x > vhdl_discrete_range_t_to_yojson x) x))

1209

arg0.ranges))

1210

:: fields in

1211

`Assoc fields)]

1212

 ArrayConstraint arg0 >

1213

`List

1214

[`String "ARRAY_CONSTRAINT";

1215

(let fields = [] in

1216

let fields =

1217

("sub", ((fun x > vhdl_constraint_t_to_yojson x) arg0.sub))

1218

:: fields in

1219

let fields =

1220

("ranges",

1221

((fun x >

1222

`List

1223

(List.map

1224

(fun x > vhdl_discrete_range_t_to_yojson x) x))

1225

arg0.ranges))

1226

:: fields in

1227

`Assoc fields)]

1228

 RecordConstraint > `List [`String "RecordConstraint"]

1229

 NoConstraint > `List [`String "NoConstraint"])

1230

[@ocaml.warning "A"])

1231


1232

and (vhdl_constraint_t_of_yojson :

1233

Yojson.Safe.json >

1234

vhdl_constraint_t Ppx_deriving_yojson_runtime.error_or)

1235

=

1236

((let open! Ppx_deriving_yojson_runtime in

1237

function

1238

 `List ((`String "RefConstraint")::arg0::[]) >

1239

((function

1240

 `Assoc xs >

1241

let rec loop xs (arg0 as _state) =

1242

match xs with

1243

 ("ref_name",x)::xs >

1244

loop xs ((fun x > vhdl_name_t_of_yojson x) x)

1245

 [] >

1246

arg0 >>=

1247

((fun arg0 >

1248

Result.Ok (RefConstraint { ref_name = arg0 })))

1249

 _::xs > loop xs _state in

1250

loop xs (Result.Error "Vhdl_ast.vhdl_constraint_t.ref_name")

1251

 _ > Result.Error "Vhdl_ast.vhdl_constraint_t")) arg0

1252

 `List ((`String "RANGE_CONSTRAINT")::arg0::[]) >

1253

((function

1254

 `Assoc xs >

1255

let rec loop xs (arg0 as _state) =

1256

match xs with

1257

 ("range",x)::xs >

1258

loop xs

1259

((fun x > vhdl_discrete_range_t_of_yojson x) x)

1260

 [] >

1261

arg0 >>=

1262

((fun arg0 >

1263

Result.Ok (RangeConstraint { range = arg0 })))

1264

 _::xs > loop xs _state in

1265

loop xs (Result.Error "Vhdl_ast.vhdl_constraint_t.range")

1266

 _ > Result.Error "Vhdl_ast.vhdl_constraint_t")) arg0

1267

 `List ((`String "INDEX_CONSTRAINT")::arg0::[]) >

1268

((function

1269

 `Assoc xs >

1270

let rec loop xs (arg0 as _state) =

1271

match xs with

1272

 ("ranges",x)::xs >

1273

loop xs

1274

((function

1275

 `List xs >

1276

map_bind

1277

(fun x > vhdl_discrete_range_t_of_yojson x)

1278

[] xs

1279

 _ >

1280

Result.Error

1281

"Vhdl_ast.vhdl_constraint_t.ranges") x)

1282

 [] >

1283

arg0 >>=

1284

((fun arg0 >

1285

Result.Ok (IndexConstraint { ranges = arg0 })))

1286

 _::xs > loop xs _state in

1287

loop xs (Result.Error "Vhdl_ast.vhdl_constraint_t.ranges")

1288

 _ > Result.Error "Vhdl_ast.vhdl_constraint_t")) arg0

1289

 `List ((`String "ARRAY_CONSTRAINT")::arg0::[]) >

1290

((function

1291

 `Assoc xs >

1292

let rec loop xs ((arg0,arg1) as _state) =

1293

match xs with

1294

 ("ranges",x)::xs >

1295

loop xs

1296

(((function

1297

 `List xs >

1298

map_bind

1299

(fun x > vhdl_discrete_range_t_of_yojson x)

1300

[] xs

1301

 _ >

1302

Result.Error

1303

"Vhdl_ast.vhdl_constraint_t.ranges") x),

1304

arg1)

1305

 ("sub",x)::xs >

1306

loop xs

1307

(arg0, ((fun x > vhdl_constraint_t_of_yojson x) x))

1308

 [] >

1309

arg1 >>=

1310

((fun arg1 >

1311

arg0 >>=

1312

(fun arg0 >

1313

Result.Ok

1314

(ArrayConstraint

1315

{ ranges = arg0; sub = arg1 }))))

1316

 _::xs > loop xs _state in

1317

loop xs

1318

((Result.Error "Vhdl_ast.vhdl_constraint_t.ranges"),

1319

(Result.Error "Vhdl_ast.vhdl_constraint_t.sub"))

1320

 _ > Result.Error "Vhdl_ast.vhdl_constraint_t")) arg0

1321

 `List ((`String "RecordConstraint")::[]) >

1322

Result.Ok RecordConstraint

1323

 `List ((`String "NoConstraint")::[]) > Result.Ok NoConstraint

1324

 _ > Result.Error "Vhdl_ast.vhdl_constraint_t")

1325

[@ocaml.warning "A"])

1326


1327

and (vhdl_definition_t_to_yojson : vhdl_definition_t > Yojson.Safe.json) =

1328

((let open! Ppx_deriving_yojson_runtime in

1329

function

1330

 Type arg0 >

1331

`List

1332

[`String "TYPE_DECLARATION";

1333

(let fields = [] in

1334

let fields =

1335

("definition",

1336

((fun x > vhdl_type_t_to_yojson x) arg0.definition))

1337

:: fields in

1338

let fields =

1339

("name", ((fun x > vhdl_name_t_to_yojson x) arg0.name)) ::

1340

fields in

1341

`Assoc fields)]

1342

 Subtype arg0 >

1343

`List

1344

[`String "SUBTYPE_DECLARATION";

1345

(let fields = [] in

1346

let fields =

1347

("typ",

1348

((fun x > vhdl_subtype_indication_t_to_yojson x) arg0.typ))

1349

:: fields in

1350

let fields =

1351

("name", ((fun x > vhdl_name_t_to_yojson x) arg0.name)) ::

1352

fields in

1353

`Assoc fields)])

1354

[@ocaml.warning "A"])

1355


1356

and (vhdl_definition_t_of_yojson :

1357

Yojson.Safe.json >

1358

vhdl_definition_t Ppx_deriving_yojson_runtime.error_or)

1359

=

1360

((let open! Ppx_deriving_yojson_runtime in

1361

function

1362

 `List ((`String "TYPE_DECLARATION")::arg0::[]) >

1363

((function

1364

 `Assoc xs >

1365

let rec loop xs ((arg0,arg1) as _state) =

1366

match xs with

1367

 ("name",x)::xs >

1368

loop xs (((fun x > vhdl_name_t_of_yojson x) x), arg1)

1369

 ("definition",x)::xs >

1370

loop xs (arg0, ((fun x > vhdl_type_t_of_yojson x) x))

1371

 [] >

1372

arg1 >>=

1373

((fun arg1 >

1374

arg0 >>=

1375

(fun arg0 >

1376

Result.Ok

1377

(Type { name = arg0; definition = arg1 }))))

1378

 _::xs > loop xs _state in

1379

loop xs

1380

((Result.Error "Vhdl_ast.vhdl_definition_t.name"),

1381

(Result.Error "Vhdl_ast.vhdl_definition_t.definition"))

1382

 _ > Result.Error "Vhdl_ast.vhdl_definition_t")) arg0

1383

 `List ((`String "SUBTYPE_DECLARATION")::arg0::[]) >

1384

((function

1385

 `Assoc xs >

1386

let rec loop xs ((arg0,arg1) as _state) =

1387

match xs with

1388

 ("name",x)::xs >

1389

loop xs (((fun x > vhdl_name_t_of_yojson x) x), arg1)

1390

 ("typ",x)::xs >

1391

loop xs

1392

(arg0,

1393

((fun x > vhdl_subtype_indication_t_of_yojson x)

1394

x))

1395

 [] >

1396

arg1 >>=

1397

((fun arg1 >

1398

arg0 >>=

1399

(fun arg0 >

1400

Result.Ok

1401

(Subtype { name = arg0; typ = arg1 }))))

1402

 _::xs > loop xs _state in

1403

loop xs

1404

((Result.Error "Vhdl_ast.vhdl_definition_t.name"),

1405

(Result.Error "Vhdl_ast.vhdl_definition_t.typ"))

1406

 _ > Result.Error "Vhdl_ast.vhdl_definition_t")) arg0

1407

 _ > Result.Error "Vhdl_ast.vhdl_definition_t")

1408

[@ocaml.warning "A"])

1409


1410

and (vhdl_expr_t_to_yojson : vhdl_expr_t > Yojson.Safe.json) =

1411

((let open! Ppx_deriving_yojson_runtime in

1412

function

1413

 Call arg0 >

1414

`List [`String "CALL"; ((fun x > vhdl_name_t_to_yojson x)) arg0]

1415

 Cst arg0 >

1416

`List

1417

[`String "CONSTANT_VALUE";

1418

(let fields = [] in

1419

let fields =

1420

if arg0.unit_name = None

1421

then fields

1422

else

1423

("unit_name",

1424

(((function

1425

 None > `Null

1426

 Some x > ((fun x > vhdl_name_t_to_yojson x)) x))

1427

arg0.unit_name))

1428

:: fields

1429

in

1430

let fields =

1431

("value", ((fun x > vhdl_cst_val_t_to_yojson x) arg0.value))

1432

:: fields in

1433

`Assoc fields)]

1434

 Op arg0 >

1435

`List

1436

[`String "EXPRESSION";

1437

(let fields = [] in

1438

let fields =

1439

if arg0.args = []

1440

then fields

1441

else

1442

("args",

1443

(((fun x >

1444

`List

1445

(List.map (fun x > vhdl_expr_t_to_yojson x) x)))

1446

arg0.args))

1447

:: fields

1448

in

1449

let fields =

1450

if arg0.id = ""

1451

then fields

1452

else

1453

("id",

1454

(((fun (x : Ppx_deriving_runtime.string) > `String x))

1455

arg0.id))

1456

:: fields

1457

in

1458

`Assoc fields)]

1459

 IsNull > `List [`String "IsNull"]

1460

 Time arg0 >

1461

`List

1462

[`String "Time";

1463

(let fields = [] in

1464

let fields =

1465

if arg0.phy_unit = ""

1466

then fields

1467

else

1468

("phy_unit",

1469

(((fun (x : Ppx_deriving_runtime.string) > `String x))

1470

arg0.phy_unit))

1471

:: fields

1472

in

1473

let fields =

1474

("value",

1475

((fun (x : Ppx_deriving_runtime.int) > `Int x) arg0.value))

1476

:: fields in

1477

`Assoc fields)]

1478

 Sig arg0 >

1479

`List

1480

[`String "Sig";

1481

(let fields = [] in

1482

let fields =

1483

("att",

1484

((function

1485

 None > `Null

1486

 Some x >

1487

((fun x > vhdl_signal_attributes_t_to_yojson x)) x)

1488

arg0.att))

1489

:: fields in

1490

let fields =

1491

("name", ((fun x > vhdl_name_t_to_yojson x) arg0.name)) ::

1492

fields in

1493

`Assoc fields)]

1494

 SuffixMod arg0 >

1495

`List

1496

[`String "SuffixMod";

1497

(let fields = [] in

1498

let fields =

1499

("selection",

1500

((fun x > vhdl_suffix_selection_t_to_yojson x)

1501

arg0.selection))

1502

:: fields in

1503

let fields =

1504

("expr", ((fun x > vhdl_expr_t_to_yojson x) arg0.expr)) ::

1505

fields in

1506

`Assoc fields)]

1507

 Aggregate arg0 >

1508

`List

1509

[`String "AGGREGATE";

1510

(let fields = [] in

1511

let fields =

1512

("elems",

1513

((fun x >

1514

`List

1515

(List.map (fun x > vhdl_element_assoc_t_to_yojson x)

1516

x)) arg0.elems))

1517

:: fields in

1518

`Assoc fields)]

1519

 Others > `List [`String "OTHERS"])

1520

[@ocaml.warning "A"])

1521


1522

and (vhdl_expr_t_of_yojson :

1523

Yojson.Safe.json > vhdl_expr_t Ppx_deriving_yojson_runtime.error_or)

1524

=

1525

((let open! Ppx_deriving_yojson_runtime in

1526

function

1527

 `List ((`String "CALL")::arg0::[]) >

1528

((fun x > vhdl_name_t_of_yojson x) arg0) >>=

1529

((fun arg0 > Result.Ok (Call arg0)))

1530

 `List ((`String "CONSTANT_VALUE")::arg0::[]) >

1531

((function

1532

 `Assoc xs >

1533

let rec loop xs ((arg0,arg1) as _state) =

1534

match xs with

1535

 ("value",x)::xs >

1536

loop xs

1537

(((fun x > vhdl_cst_val_t_of_yojson x) x), arg1)

1538

 ("unit_name",x)::xs >

1539

loop xs

1540

(arg0,

1541

((function

1542

 `Null > Result.Ok None

1543

 x >

1544

((fun x > vhdl_name_t_of_yojson x) x) >>=

1545

((fun x > Result.Ok (Some x)))) x))

1546

 [] >

1547

arg1 >>=

1548

((fun arg1 >

1549

arg0 >>=

1550

(fun arg0 >

1551

Result.Ok

1552

(Cst { value = arg0; unit_name = arg1 }))))

1553

 _::xs > loop xs _state in

1554

loop xs

1555

((Result.Error "Vhdl_ast.vhdl_expr_t.value"),

1556

(Result.Ok None))

1557

 _ > Result.Error "Vhdl_ast.vhdl_expr_t")) arg0

1558

 `List ((`String "EXPRESSION")::arg0::[]) >

1559

((function

1560

 `Assoc xs >

1561

let rec loop xs ((arg0,arg1) as _state) =

1562

match xs with

1563

 ("id",x)::xs >

1564

loop xs

1565

(((function

1566

 `String x > Result.Ok x

1567

 _ > Result.Error "Vhdl_ast.vhdl_expr_t.id") x),

1568

arg1)

1569

 ("args",x)::xs >

1570

loop xs

1571

(arg0,

1572

((function

1573

 `List xs >

1574

map_bind (fun x > vhdl_expr_t_of_yojson x)

1575

[] xs

1576

 _ > Result.Error "Vhdl_ast.vhdl_expr_t.args")

1577

x))

1578

 [] >

1579

arg1 >>=

1580

((fun arg1 >

1581

arg0 >>=

1582

(fun arg0 >

1583

Result.Ok (Op { id = arg0; args = arg1 }))))

1584

 _::xs > loop xs _state in

1585

loop xs ((Result.Ok ""), (Result.Ok []))

1586

 _ > Result.Error "Vhdl_ast.vhdl_expr_t")) arg0

1587

 `List ((`String "IsNull")::[]) > Result.Ok IsNull

1588

 `List ((`String "Time")::arg0::[]) >

1589

((function

1590

 `Assoc xs >

1591

let rec loop xs ((arg0,arg1) as _state) =

1592

match xs with

1593

 ("value",x)::xs >

1594

loop xs

1595

(((function

1596

 `Int x > Result.Ok x

1597

 _ > Result.Error "Vhdl_ast.vhdl_expr_t.value")

1598

x), arg1)

1599

 ("phy_unit",x)::xs >

1600

loop xs

1601

(arg0,

1602

((function

1603

 `String x > Result.Ok x

1604

 _ >

1605

Result.Error "Vhdl_ast.vhdl_expr_t.phy_unit")

1606

x))

1607

 [] >

1608

arg1 >>=

1609

((fun arg1 >

1610

arg0 >>=

1611

(fun arg0 >

1612

Result.Ok

1613

(Time { value = arg0; phy_unit = arg1 }))))

1614

 _::xs > loop xs _state in

1615

loop xs

1616

((Result.Error "Vhdl_ast.vhdl_expr_t.value"),

1617

(Result.Ok ""))

1618

 _ > Result.Error "Vhdl_ast.vhdl_expr_t")) arg0

1619

 `List ((`String "Sig")::arg0::[]) >

1620

((function

1621

 `Assoc xs >

1622

let rec loop xs ((arg0,arg1) as _state) =

1623

match xs with

1624

 ("name",x)::xs >

1625

loop xs (((fun x > vhdl_name_t_of_yojson x) x), arg1)

1626

 ("att",x)::xs >

1627

loop xs

1628

(arg0,

1629

((function

1630

 `Null > Result.Ok None

1631

 x >

1632

((fun x >

1633

vhdl_signal_attributes_t_of_yojson x) x)

1634

>>= ((fun x > Result.Ok (Some x)))) x))

1635

 [] >

1636

arg1 >>=

1637

((fun arg1 >

1638

arg0 >>=

1639

(fun arg0 >

1640

Result.Ok (Sig { name = arg0; att = arg1 }))))

1641

 _::xs > loop xs _state in

1642

loop xs

1643

((Result.Error "Vhdl_ast.vhdl_expr_t.name"),

1644

(Result.Error "Vhdl_ast.vhdl_expr_t.att"))

1645

 _ > Result.Error "Vhdl_ast.vhdl_expr_t")) arg0

1646

 `List ((`String "SuffixMod")::arg0::[]) >

1647

((function

1648

 `Assoc xs >

1649

let rec loop xs ((arg0,arg1) as _state) =

1650

match xs with

1651

 ("expr",x)::xs >

1652

loop xs (((fun x > vhdl_expr_t_of_yojson x) x), arg1)

1653

 ("selection",x)::xs >

1654

loop xs

1655

(arg0,

1656

((fun x > vhdl_suffix_selection_t_of_yojson x) x))

1657

 [] >

1658

arg1 >>=

1659

((fun arg1 >

1660

arg0 >>=

1661

(fun arg0 >

1662

Result.Ok

1663

(SuffixMod

1664

{ expr = arg0; selection = arg1 }))))

1665

 _::xs > loop xs _state in

1666

loop xs

1667

((Result.Error "Vhdl_ast.vhdl_expr_t.expr"),

1668

(Result.Error "Vhdl_ast.vhdl_expr_t.selection"))

1669

 _ > Result.Error "Vhdl_ast.vhdl_expr_t")) arg0

1670

 `List ((`String "AGGREGATE")::arg0::[]) >

1671

((function

1672

 `Assoc xs >

1673

let rec loop xs (arg0 as _state) =

1674

match xs with

1675

 ("elems",x)::xs >

1676

loop xs

1677

((function

1678

 `List xs >

1679

map_bind

1680

(fun x > vhdl_element_assoc_t_of_yojson x)

1681

[] xs

1682

 _ > Result.Error "Vhdl_ast.vhdl_expr_t.elems") x)

1683

 [] >

1684

arg0 >>=

1685

((fun arg0 > Result.Ok (Aggregate { elems = arg0 })))

1686

 _::xs > loop xs _state in

1687

loop xs (Result.Error "Vhdl_ast.vhdl_expr_t.elems")

1688

 _ > Result.Error "Vhdl_ast.vhdl_expr_t")) arg0

1689

 `List ((`String "OTHERS")::[]) > Result.Ok Others

1690

 _ > Result.Error "Vhdl_ast.vhdl_expr_t")

1691

[@ocaml.warning "A"])

1692


1693

and (vhdl_name_t_to_yojson : vhdl_name_t > Yojson.Safe.json) =

1694

((let open! Ppx_deriving_yojson_runtime in

1695

function

1696

 Simple arg0 >

1697

`List

1698

[`String "SIMPLE_NAME";

1699

((fun (x : Ppx_deriving_runtime.string) > `String x)) arg0]

1700

 Identifier arg0 >

1701

`List

1702

[`String "IDENTIFIER";

1703

((fun (x : Ppx_deriving_runtime.string) > `String x)) arg0]

1704

 Selected arg0 >

1705

`List

1706

[`String "SELECTED_NAME";

1707

((fun x >

1708

`List (List.map (fun x > vhdl_name_t_to_yojson x) x))) arg0]

1709

 Index arg0 >

1710

`List

1711

[`String "INDEXED_NAME";

1712

(let fields = [] in

1713

let fields =

1714

("exprs",

1715

((fun x >

1716

`List (List.map (fun x > vhdl_expr_t_to_yojson x) x))

1717

arg0.exprs))

1718

:: fields in

1719

let fields =

1720

("id", ((fun x > vhdl_name_t_to_yojson x) arg0.id)) ::

1721

fields in

1722

`Assoc fields)]

1723

 Slice arg0 >

1724

`List

1725

[`String "SLICE_NAME";

1726

(let fields = [] in

1727

let fields =

1728

("range",

1729

((fun x > vhdl_discrete_range_t_to_yojson x) arg0.range))

1730

:: fields in

1731

let fields =

1732

("id", ((fun x > vhdl_name_t_to_yojson x) arg0.id)) ::

1733

fields in

1734

`Assoc fields)]

1735

 Attribute arg0 >

1736

`List

1737

[`String "ATTRIBUTE_NAME";

1738

(let fields = [] in

1739

let fields =

1740

if arg0.expr = IsNull

1741

then fields

1742

else

1743

("expr", (((fun x > vhdl_expr_t_to_yojson x)) arg0.expr))

1744

:: fields

1745

in

1746

let fields =

1747

("designator",

1748

((fun x > vhdl_name_t_to_yojson x) arg0.designator))

1749

:: fields in

1750

let fields =

1751

("id", ((fun x > vhdl_name_t_to_yojson x) arg0.id)) ::

1752

fields in

1753

`Assoc fields)]

1754

 Function arg0 >

1755

`List

1756

[`String "FUNCTION_CALL";

1757

(let fields = [] in

1758

let fields =

1759

("assoc_list",

1760

((fun x >

1761

`List

1762

(List.map (fun x > vhdl_assoc_element_t_to_yojson x)

1763

x)) arg0.assoc_list))

1764

:: fields in

1765

let fields =

1766

("id", ((fun x > vhdl_name_t_to_yojson x) arg0.id)) ::

1767

fields in

1768

`Assoc fields)]

1769

 NoName > `List [`String "NoName"])

1770

[@ocaml.warning "A"])

1771


1772

and (vhdl_name_t_of_yojson :

1773

Yojson.Safe.json > vhdl_name_t Ppx_deriving_yojson_runtime.error_or)

1774

=

1775

((let open! Ppx_deriving_yojson_runtime in

1776

function

1777

 `List ((`String "SIMPLE_NAME")::arg0::[]) >

1778

((function

1779

 `String x > Result.Ok x

1780

 _ > Result.Error "Vhdl_ast.vhdl_name_t") arg0) >>=

1781

((fun arg0 > Result.Ok (Simple arg0)))

1782

 `List ((`String "IDENTIFIER")::arg0::[]) >

1783

((function

1784

 `String x > Result.Ok x

1785

 _ > Result.Error "Vhdl_ast.vhdl_name_t") arg0) >>=

1786

((fun arg0 > Result.Ok (Identifier arg0)))

1787

 `List ((`String "SELECTED_NAME")::arg0::[]) >

1788

((function

1789

 `List xs > map_bind (fun x > vhdl_name_t_of_yojson x) [] xs

1790

 _ > Result.Error "Vhdl_ast.vhdl_name_t") arg0) >>=

1791

((fun arg0 > Result.Ok (Selected arg0)))

1792

 `List ((`String "INDEXED_NAME")::arg0::[]) >

1793

((function

1794

 `Assoc xs >

1795

let rec loop xs ((arg0,arg1) as _state) =

1796

match xs with

1797

 ("id",x)::xs >

1798

loop xs (((fun x > vhdl_name_t_of_yojson x) x), arg1)

1799

 ("exprs",x)::xs >

1800

loop xs

1801

(arg0,

1802

((function

1803

 `List xs >

1804

map_bind (fun x > vhdl_expr_t_of_yojson x)

1805

[] xs

1806

 _ > Result.Error "Vhdl_ast.vhdl_name_t.exprs")

1807

x))

1808

 [] >

1809

arg1 >>=

1810

((fun arg1 >

1811

arg0 >>=

1812

(fun arg0 >

1813

Result.Ok

1814

(Index { id = arg0; exprs = arg1 }))))

1815

 _::xs > loop xs _state in

1816

loop xs

1817

((Result.Error "Vhdl_ast.vhdl_name_t.id"),

1818

(Result.Error "Vhdl_ast.vhdl_name_t.exprs"))

1819

 _ > Result.Error "Vhdl_ast.vhdl_name_t")) arg0

1820

 `List ((`String "SLICE_NAME")::arg0::[]) >

1821

((function

1822

 `Assoc xs >

1823

let rec loop xs ((arg0,arg1) as _state) =

1824

match xs with

1825

 ("id",x)::xs >

1826

loop xs (((fun x > vhdl_name_t_of_yojson x) x), arg1)

1827

 ("range",x)::xs >

1828

loop xs

1829

(arg0,

1830

((fun x > vhdl_discrete_range_t_of_yojson x) x))

1831

 [] >

1832

arg1 >>=

1833

((fun arg1 >

1834

arg0 >>=

1835

(fun arg0 >

1836

Result.Ok

1837

(Slice { id = arg0; range = arg1 }))))

1838

 _::xs > loop xs _state in

1839

loop xs

1840

((Result.Error "Vhdl_ast.vhdl_name_t.id"),

1841

(Result.Error "Vhdl_ast.vhdl_name_t.range"))

1842

 _ > Result.Error "Vhdl_ast.vhdl_name_t")) arg0

1843

 `List ((`String "ATTRIBUTE_NAME")::arg0::[]) >

1844

((function

1845

 `Assoc xs >

1846

let rec loop xs ((arg0,arg1,arg2) as _state) =

1847

match xs with

1848

 ("id",x)::xs >

1849

loop xs

1850

(((fun x > vhdl_name_t_of_yojson x) x), arg1, arg2)

1851

 ("designator",x)::xs >

1852

loop xs

1853

(arg0, ((fun x > vhdl_name_t_of_yojson x) x), arg2)

1854

 ("expr",x)::xs >

1855

loop xs

1856

(arg0, arg1, ((fun x > vhdl_expr_t_of_yojson x) x))

1857

 [] >

1858

arg2 >>=

1859

((fun arg2 >

1860

arg1 >>=

1861

(fun arg1 >

1862

arg0 >>=

1863

(fun arg0 >

1864

Result.Ok

1865

(Attribute

1866

{

1867

id = arg0;

1868

designator = arg1;

1869

expr = arg2

1870

})))))

1871

 _::xs > loop xs _state in

1872

loop xs

1873

((Result.Error "Vhdl_ast.vhdl_name_t.id"),

1874

(Result.Error "Vhdl_ast.vhdl_name_t.designator"),

1875

(Result.Ok IsNull))

1876

 _ > Result.Error "Vhdl_ast.vhdl_name_t")) arg0

1877

 `List ((`String "FUNCTION_CALL")::arg0::[]) >

1878

((function

1879

 `Assoc xs >

1880

let rec loop xs ((arg0,arg1) as _state) =

1881

match xs with

1882

 ("id",x)::xs >

1883

loop xs (((fun x > vhdl_name_t_of_yojson x) x), arg1)

1884

 ("assoc_list",x)::xs >

1885

loop xs

1886

(arg0,

1887

((function

1888

 `List xs >

1889

map_bind

1890

(fun x > vhdl_assoc_element_t_of_yojson x)

1891

[] xs

1892

 _ >

1893

Result.Error

1894

"Vhdl_ast.vhdl_name_t.assoc_list") x))

1895

 [] >

1896

arg1 >>=

1897

((fun arg1 >

1898

arg0 >>=

1899

(fun arg0 >

1900

Result.Ok

1901

(Function { id = arg0; assoc_list = arg1 }))))

1902

 _::xs > loop xs _state in

1903

loop xs

1904

((Result.Error "Vhdl_ast.vhdl_name_t.id"),

1905

(Result.Error "Vhdl_ast.vhdl_name_t.assoc_list"))

1906

 _ > Result.Error "Vhdl_ast.vhdl_name_t")) arg0

1907

 `List ((`String "NoName")::[]) > Result.Ok NoName

1908

 _ > Result.Error "Vhdl_ast.vhdl_name_t")

1909

[@ocaml.warning "A"])

1910


1911

and (vhdl_assoc_element_t_to_yojson :

1912

vhdl_assoc_element_t > Yojson.Safe.json)

1913

=

1914

((let open! Ppx_deriving_yojson_runtime in

1915

fun x >

1916

let fields = [] in

1917

let fields =

1918

if x.actual_expr = None

1919

then fields

1920

else

1921

("actual_expr",

1922

(((function

1923

 None > `Null

1924

 Some x > ((fun x > vhdl_expr_t_to_yojson x)) x))

1925

x.actual_expr))

1926

:: fields

1927

in

1928

let fields =

1929

if x.actual_designator = None

1930

then fields

1931

else

1932

("actual_designator",

1933

(((function

1934

 None > `Null

1935

 Some x > ((fun x > vhdl_name_t_to_yojson x)) x))

1936

x.actual_designator))

1937

:: fields

1938

in

1939

let fields =

1940

if x.actual_name = None

1941

then fields

1942

else

1943

("actual_name",

1944

(((function

1945

 None > `Null

1946

 Some x > ((fun x > vhdl_name_t_to_yojson x)) x))

1947

x.actual_name))

1948

:: fields

1949

in

1950

let fields =

1951

if x.formal_arg = None

1952

then fields

1953

else

1954

("formal_arg",

1955

(((function

1956

 None > `Null

1957

 Some x > ((fun x > vhdl_name_t_to_yojson x)) x))

1958

x.formal_arg))

1959

:: fields

1960

in

1961

let fields =

1962

if x.formal_name = None

1963

then fields

1964

else

1965

("formal_name",

1966

(((function

1967

 None > `Null

1968

 Some x > ((fun x > vhdl_name_t_to_yojson x)) x))

1969

x.formal_name))

1970

:: fields

1971

in

1972

`Assoc fields)

1973

[@ocaml.warning "A"])

1974


1975

and (vhdl_assoc_element_t_of_yojson :

1976

Yojson.Safe.json >

1977

vhdl_assoc_element_t Ppx_deriving_yojson_runtime.error_or)

1978

=

1979

((let open! Ppx_deriving_yojson_runtime in

1980

function

1981

 `Assoc xs >

1982

let rec loop xs ((arg0,arg1,arg2,arg3,arg4) as _state) =

1983

match xs with

1984

 ("formal_name",x)::xs >

1985

loop xs

1986

(((function

1987

 `Null > Result.Ok None

1988

 x >

1989

((fun x > vhdl_name_t_of_yojson x) x) >>=

1990

((fun x > Result.Ok (Some x)))) x), arg1, arg2,

1991

arg3, arg4)

1992

 ("formal_arg",x)::xs >

1993

loop xs

1994

(arg0,

1995

((function

1996

 `Null > Result.Ok None

1997

 x >

1998

((fun x > vhdl_name_t_of_yojson x) x) >>=

1999

((fun x > Result.Ok (Some x)))) x), arg2, arg3,

2000

arg4)

2001

 ("actual_name",x)::xs >

2002

loop xs

2003

(arg0, arg1,

2004

((function

2005

 `Null > Result.Ok None

2006

 x >

2007

((fun x > vhdl_name_t_of_yojson x) x) >>=

2008

((fun x > Result.Ok (Some x)))) x), arg3, arg4)

2009

 ("actual_designator",x)::xs >

2010

loop xs

2011

(arg0, arg1, arg2,

2012

((function

2013

 `Null > Result.Ok None

2014

 x >

2015

((fun x > vhdl_name_t_of_yojson x) x) >>=

2016

((fun x > Result.Ok (Some x)))) x), arg4)

2017

 ("actual_expr",x)::xs >

2018

loop xs

2019

(arg0, arg1, arg2, arg3,

2020

((function

2021

 `Null > Result.Ok None

2022

 x >

2023

((fun x > vhdl_expr_t_of_yojson x) x) >>=

2024

((fun x > Result.Ok (Some x)))) x))

2025

 [] >

2026

arg4 >>=

2027

((fun arg4 >

2028

arg3 >>=

2029

(fun arg3 >

2030

arg2 >>=

2031

(fun arg2 >

2032

arg1 >>=

2033

(fun arg1 >

2034

arg0 >>=

2035

(fun arg0 >

2036

Result.Ok

2037

{

2038

formal_name = arg0;

2039

formal_arg = arg1;

2040

actual_name = arg2;

2041

actual_designator = arg3;

2042

actual_expr = arg4

2043

}))))))

2044

 _::xs > loop xs _state in

2045

loop xs

2046

((Result.Ok (Some NoName)), (Result.Ok (Some NoName)),

2047

(Result.Ok (Some NoName)), (Result.Ok (Some NoName)),

2048

(Result.Ok (Some IsNull)))

2049

 _ > Result.Error "Vhdl_ast.vhdl_assoc_element_t")

2050

[@ocaml.warning "A"])

2051


2052

and (vhdl_element_assoc_t_to_yojson :

2053

vhdl_element_assoc_t > Yojson.Safe.json)

2054

=

2055

((let open! Ppx_deriving_yojson_runtime in

2056

fun x >

2057

let fields = [] in

2058

let fields = ("expr", ((fun x > vhdl_expr_t_to_yojson x) x.expr))

2059

:: fields in

2060

let fields =

2061

if x.choices = []

2062

then fields

2063

else

2064

("choices",

2065

(((fun x >

2066

`List (List.map (fun x > vhdl_expr_t_to_yojson x) x)))

2067

x.choices))

2068

:: fields

2069

in

2070

`Assoc fields)

2071

[@ocaml.warning "A"])

2072


2073

and (vhdl_element_assoc_t_of_yojson :

2074

Yojson.Safe.json >

2075

vhdl_element_assoc_t Ppx_deriving_yojson_runtime.error_or)

2076

=

2077

((let open! Ppx_deriving_yojson_runtime in

2078

function

2079

 `Assoc xs >

2080

let rec loop xs ((arg0,arg1) as _state) =

2081

match xs with

2082

 ("choices",x)::xs >

2083

loop xs

2084

(((function

2085

 `List xs >

2086

map_bind (fun x > vhdl_expr_t_of_yojson x) [] xs

2087

 _ >

2088

Result.Error "Vhdl_ast.vhdl_element_assoc_t.choices")

2089

x), arg1)

2090

 ("expr",x)::xs >

2091

loop xs (arg0, ((fun x > vhdl_expr_t_of_yojson x) x))

2092

 [] >

2093

arg1 >>=

2094

((fun arg1 >

2095

arg0 >>=

2096

(fun arg0 >

2097

Result.Ok { choices = arg0; expr = arg1 })))

2098

 _::xs > loop xs _state in

2099

loop xs

2100

((Result.Ok []),

2101

(Result.Error "Vhdl_ast.vhdl_element_assoc_t.expr"))

2102

 _ > Result.Error "Vhdl_ast.vhdl_element_assoc_t")

2103

[@ocaml.warning "A"])

2104


2105

and (vhdl_array_attributes_t_to_yojson :

2106

vhdl_array_attributes_t > Yojson.Safe.json)

2107

=

2108

((let open! Ppx_deriving_yojson_runtime in

2109

function

2110

 AAttInt arg0 >

2111

`List

2112

[`String "AAttInt";

2113

(let fields = [] in

2114

let fields =

2115

("arg",

2116

((fun (x : Ppx_deriving_runtime.int) > `Int x) arg0.arg))

2117

:: fields in

2118

let fields =

2119

("id",

2120

((fun (x : Ppx_deriving_runtime.string) > `String x)

2121

arg0.id))

2122

:: fields in

2123

`Assoc fields)]

2124

 AAttAscending > `List [`String "AAttAscending"])

2125

[@ocaml.warning "A"])

2126


2127

and (vhdl_array_attributes_t_of_yojson :

2128

Yojson.Safe.json >

2129

vhdl_array_attributes_t Ppx_deriving_yojson_runtime.error_or)

2130

=

2131

((let open! Ppx_deriving_yojson_runtime in

2132

function

2133

 `List ((`String "AAttInt")::arg0::[]) >

2134

((function

2135

 `Assoc xs >

2136

let rec loop xs ((arg0,arg1) as _state) =

2137

match xs with

2138

 ("id",x)::xs >

2139

loop xs

2140

(((function

2141

 `String x > Result.Ok x

2142

 _ >

2143

Result.Error

2144

"Vhdl_ast.vhdl_array_attributes_t.id") x),

2145

arg1)

2146

 ("arg",x)::xs >

2147

loop xs

2148

(arg0,

2149

((function

2150

 `Int x > Result.Ok x

2151

 _ >

2152

Result.Error

2153

"Vhdl_ast.vhdl_array_attributes_t.arg") x))

2154

 [] >

2155

arg1 >>=

2156

((fun arg1 >

2157

arg0 >>=

2158

(fun arg0 >

2159

Result.Ok

2160

(AAttInt { id = arg0; arg = arg1 }))))

2161

 _::xs > loop xs _state in

2162

loop xs

2163

((Result.Error "Vhdl_ast.vhdl_array_attributes_t.id"),

2164

(Result.Error "Vhdl_ast.vhdl_array_attributes_t.arg"))

2165

 _ > Result.Error "Vhdl_ast.vhdl_array_attributes_t")) arg0

2166

 `List ((`String "AAttAscending")::[]) > Result.Ok AAttAscending

2167

 _ > Result.Error "Vhdl_ast.vhdl_array_attributes_t")

2168

[@ocaml.warning "A"])

2169


2170

and (vhdl_signal_attributes_t_to_yojson :

2171

vhdl_signal_attributes_t > Yojson.Safe.json)

2172

=

2173

((let open! Ppx_deriving_yojson_runtime in

2174

function

2175

 SigAtt arg0 >

2176

`List

2177

[`String "SigAtt";

2178

((fun (x : Ppx_deriving_runtime.string) > `String x)) arg0])

2179

[@ocaml.warning "A"])

2180


2181

and (vhdl_signal_attributes_t_of_yojson :

2182

Yojson.Safe.json >

2183

vhdl_signal_attributes_t Ppx_deriving_yojson_runtime.error_or)

2184

=

2185

((let open! Ppx_deriving_yojson_runtime in

2186

function

2187

 `List ((`String "SigAtt")::arg0::[]) >

2188

((function

2189

 `String x > Result.Ok x

2190

 _ > Result.Error "Vhdl_ast.vhdl_signal_attributes_t") arg0)

2191

>>= ((fun arg0 > Result.Ok (SigAtt arg0)))

2192

 _ > Result.Error "Vhdl_ast.vhdl_signal_attributes_t")

2193

[@ocaml.warning "A"])

2194


2195

and (vhdl_string_attributes_t_to_yojson :

2196

vhdl_string_attributes_t > Yojson.Safe.json)

2197

=

2198

((let open! Ppx_deriving_yojson_runtime in

2199

function

2200

 StringAtt arg0 >

2201

`List

2202

[`String "StringAtt";

2203

((fun (x : Ppx_deriving_runtime.string) > `String x)) arg0])

2204

[@ocaml.warning "A"])

2205


2206

and (vhdl_string_attributes_t_of_yojson :

2207

Yojson.Safe.json >

2208

vhdl_string_attributes_t Ppx_deriving_yojson_runtime.error_or)

2209

=

2210

((let open! Ppx_deriving_yojson_runtime in

2211

function

2212

 `List ((`String "StringAtt")::arg0::[]) >

2213

((function

2214

 `String x > Result.Ok x

2215

 _ > Result.Error "Vhdl_ast.vhdl_string_attributes_t") arg0)

2216

>>= ((fun arg0 > Result.Ok (StringAtt arg0)))

2217

 _ > Result.Error "Vhdl_ast.vhdl_string_attributes_t")

2218

[@ocaml.warning "A"])

2219


2220

and (vhdl_suffix_selection_t_to_yojson :

2221

vhdl_suffix_selection_t > Yojson.Safe.json)

2222

=

2223

((let open! Ppx_deriving_yojson_runtime in

2224

function

2225

 Idx arg0 >

2226

`List

2227

[`String "Idx";

2228

((fun (x : Ppx_deriving_runtime.int) > `Int x)) arg0]

2229

 SuffixRange (arg0,arg1) >

2230

`List

2231

[`String "SuffixRange";

2232

((fun (x : Ppx_deriving_runtime.int) > `Int x)) arg0;

2233

((fun (x : Ppx_deriving_runtime.int) > `Int x)) arg1])

2234

[@ocaml.warning "A"])

2235


2236

and (vhdl_suffix_selection_t_of_yojson :

2237

Yojson.Safe.json >

2238

vhdl_suffix_selection_t Ppx_deriving_yojson_runtime.error_or)

2239

=

2240

((let open! Ppx_deriving_yojson_runtime in

2241

function

2242

 `List ((`String "Idx")::arg0::[]) >

2243

((function

2244

 `Int x > Result.Ok x

2245

 _ > Result.Error "Vhdl_ast.vhdl_suffix_selection_t") arg0) >>=

2246

((fun arg0 > Result.Ok (Idx arg0)))

2247

 `List ((`String "SuffixRange")::arg0::arg1::[]) >

2248

((function

2249

 `Int x > Result.Ok x

2250

 _ > Result.Error "Vhdl_ast.vhdl_suffix_selection_t") arg1) >>=

2251

((fun arg1 >

2252

((function

2253

 `Int x > Result.Ok x

2254

 _ > Result.Error "Vhdl_ast.vhdl_suffix_selection_t")

2255

arg0)

2256

>>= (fun arg0 > Result.Ok (SuffixRange (arg0, arg1)))))

2257

 _ > Result.Error "Vhdl_ast.vhdl_suffix_selection_t")

2258

[@ocaml.warning "A"])

2259


2260

type 'basetype vhdl_type_attributes_t =

2261

 TAttNoArg of {

2262

id: string }

2263

 TAttIntArg of {

2264

id: string ;

2265

arg: int }

2266

 TAttValArg of {

2267

id: string ;

2268

arg: 'basetype }

2269

 TAttStringArg of {

2270

id: string ;

2271

arg: string }

2272


2273

(* TODO *)

2274

let rec pp_vhdl_type_attributes_t

2275

=

2276

((let open! Ppx_deriving_runtime in

2277

fun poly_basetype >

2278

fun fmt >

2279

function

2280

 TAttNoArg { id = aid } >

2281

(Format.fprintf fmt "@[<2>TAttNoArg {@,";

2282

(Format.fprintf fmt "@[%s =@ " "id";

2283

(Format.fprintf fmt "%S") aid;

2284

Format.fprintf fmt "@]");

2285

Format.fprintf fmt "@]}")

2286

 TAttIntArg { id = aid; arg = aarg } >

2287

(Format.fprintf fmt "@[<2>TAttIntArg {@,";

2288

((Format.fprintf fmt "@[%s =@ " "id";

2289

(Format.fprintf fmt "%S") aid;

2290

Format.fprintf fmt "@]");

2291

Format.fprintf fmt ";@ ";

2292

Format.fprintf fmt "@[%s =@ " "arg";

2293

(Format.fprintf fmt "%d") aarg;

2294

Format.fprintf fmt "@]");

2295

Format.fprintf fmt "@]}")

2296

 TAttValArg { id = aid; arg = aarg } >

2297

(Format.fprintf fmt "@[<2>TAttValArg {@,";

2298

((Format.fprintf fmt "@[%s =@ " "id";

2299

(Format.fprintf fmt "%S") aid;

2300

Format.fprintf fmt "@]");

2301

Format.fprintf fmt ";@ ";

2302

Format.fprintf fmt "@[%s =@ " "arg";

2303

(poly_basetype fmt) aarg;

2304

Format.fprintf fmt "@]");

2305

Format.fprintf fmt "@]}")

2306

 TAttStringArg { id = aid; arg = aarg } >

2307

(Format.fprintf fmt "@[<2>TAttStringArg {@,";

2308

((Format.fprintf fmt "@[%s =@ " "id";

2309

(Format.fprintf fmt "%S") aid;

2310

Format.fprintf fmt "@]");

2311

Format.fprintf fmt ";@ ";

2312

Format.fprintf fmt "@[%s =@ " "arg";

2313

(Format.fprintf fmt "%S") aarg;

2314

Format.fprintf fmt "@]");

2315

Format.fprintf fmt "@]}"))

2316

[@ocaml.warning "A"])

2317


2318

and show_vhdl_type_attributes_t =

2319

fun poly_basetype >

2320

fun x >

2321

Format.asprintf "%a" (pp_vhdl_type_attributes_t poly_basetype) x

2322


2323

let rec vhdl_type_attributes_t_to_yojson :

2324

'basetype .

2325

('basetype > Yojson.Safe.json) >

2326

'basetype vhdl_type_attributes_t > Yojson.Safe.json

2327

=

2328

fun poly_basetype >

2329

((let open! Ppx_deriving_yojson_runtime in

2330

function

2331

 TAttNoArg arg0 >

2332

`List

2333

[`String "TAttNoArg";

2334

(let fields = [] in

2335

let fields =

2336

("id",

2337

((fun (x : Ppx_deriving_runtime.string) > `String x)

2338

arg0.id))

2339

:: fields in

2340

`Assoc fields)]

2341

 TAttIntArg arg0 >

2342

`List

2343

[`String "TAttIntArg";

2344

(let fields = [] in

2345

let fields =

2346

("arg",

2347

((fun (x : Ppx_deriving_runtime.int) > `Int x) arg0.arg))

2348

:: fields in

2349

let fields =

2350

("id",

2351

((fun (x : Ppx_deriving_runtime.string) > `String x)

2352

arg0.id))

2353

:: fields in

2354

`Assoc fields)]

2355

 TAttValArg arg0 >

2356

`List

2357

[`String "TAttValArg";

2358

(let fields = [] in

2359

let fields =

2360

("arg", ((poly_basetype : _ > Yojson.Safe.json) arg0.arg))

2361

:: fields in

2362

let fields =

2363

("id",

2364

((fun (x : Ppx_deriving_runtime.string) > `String x)

2365

arg0.id))

2366

:: fields in

2367

`Assoc fields)]

2368

 TAttStringArg arg0 >

2369

`List

2370

[`String "TAttStringArg";

2371

(let fields = [] in

2372

let fields =

2373

("arg",

2374

((fun (x : Ppx_deriving_runtime.string) > `String x)

2375

arg0.arg))

2376

:: fields in

2377

let fields =

2378

("id",

2379

((fun (x : Ppx_deriving_runtime.string) > `String x)

2380

arg0.id))

2381

:: fields in

2382

`Assoc fields)])

2383

[@ocaml.warning "A"])

2384


2385

and vhdl_type_attributes_t_of_yojson :

2386

'basetype .

2387

(Yojson.Safe.json > 'basetype Ppx_deriving_yojson_runtime.error_or) >

2388

Yojson.Safe.json >

2389

'basetype vhdl_type_attributes_t Ppx_deriving_yojson_runtime.error_or

2390

=

2391

fun poly_basetype >

2392

((let open! Ppx_deriving_yojson_runtime in

2393

function

2394

 `List ((`String "TAttNoArg")::arg0::[]) >

2395

((function

2396

 `Assoc xs >

2397

let rec loop xs (arg0 as _state) =

2398

match xs with

2399

 ("id",x)::xs >

2400

loop xs

2401

((function

2402

 `String x > Result.Ok x

2403

 _ >

2404

Result.Error

2405

"Vhdl_ast.vhdl_type_attributes_t.id") x)

2406

 [] >

2407

arg0 >>=

2408

((fun arg0 > Result.Ok (TAttNoArg { id = arg0 })))

2409

 _::xs > loop xs _state in

2410

loop xs (Result.Error "Vhdl_ast.vhdl_type_attributes_t.id")

2411

 _ > Result.Error "Vhdl_ast.vhdl_type_attributes_t")) arg0

2412

 `List ((`String "TAttIntArg")::arg0::[]) >

2413

((function

2414

 `Assoc xs >

2415

let rec loop xs ((arg0,arg1) as _state) =

2416

match xs with

2417

 ("id",x)::xs >

2418

loop xs

2419

(((function

2420

 `String x > Result.Ok x

2421

 _ >

2422

Result.Error

2423

"Vhdl_ast.vhdl_type_attributes_t.id") x),

2424

arg1)

2425

 ("arg",x)::xs >

2426

loop xs

2427

(arg0,

2428

((function

2429

 `Int x > Result.Ok x

2430

 _ >

2431

Result.Error

2432

"Vhdl_ast.vhdl_type_attributes_t.arg") x))

2433

 [] >

2434

arg1 >>=

2435

((fun arg1 >

2436

arg0 >>=

2437

(fun arg0 >

2438

Result.Ok

2439

(TAttIntArg { id = arg0; arg = arg1 }))))

2440

 _::xs > loop xs _state in

2441

loop xs

2442

((Result.Error "Vhdl_ast.vhdl_type_attributes_t.id"),

2443

(Result.Error "Vhdl_ast.vhdl_type_attributes_t.arg"))

2444

 _ > Result.Error "Vhdl_ast.vhdl_type_attributes_t")) arg0

2445

 `List ((`String "TAttValArg")::arg0::[]) >

2446

((function

2447

 `Assoc xs >

2448

let rec loop xs ((arg0,arg1) as _state) =

2449

match xs with

2450

 ("id",x)::xs >

2451

loop xs

2452

(((function

2453

 `String x > Result.Ok x

2454

 _ >

2455

Result.Error

2456

"Vhdl_ast.vhdl_type_attributes_t.id") x),

2457

arg1)

2458

 ("arg",x)::xs >

2459

loop xs

2460

(arg0,

2461

((poly_basetype : Yojson.Safe.json > _ error_or)

2462

x))

2463

 [] >

2464

arg1 >>=

2465

((fun arg1 >

2466

arg0 >>=

2467

(fun arg0 >

2468

Result.Ok

2469

(TAttValArg { id = arg0; arg = arg1 }))))

2470

 _::xs > loop xs _state in

2471

loop xs

2472

((Result.Error "Vhdl_ast.vhdl_type_attributes_t.id"),

2473

(Result.Error "Vhdl_ast.vhdl_type_attributes_t.arg"))

2474

 _ > Result.Error "Vhdl_ast.vhdl_type_attributes_t")) arg0

2475

 `List ((`String "TAttStringArg")::arg0::[]) >

2476

((function

2477

 `Assoc xs >

2478

let rec loop xs ((arg0,arg1) as _state) =

2479

match xs with

2480

 ("id",x)::xs >

2481

loop xs

2482

(((function

2483

 `String x > Result.Ok x

2484

 _ >

2485

Result.Error

2486

"Vhdl_ast.vhdl_type_attributes_t.id") x),

2487

arg1)

2488

 ("arg",x)::xs >

2489

loop xs

2490

(arg0,

2491

((function

2492

 `String x > Result.Ok x

2493

 _ >

2494

Result.Error

2495

"Vhdl_ast.vhdl_type_attributes_t.arg") x))

2496

 [] >

2497

arg1 >>=

2498

((fun arg1 >

2499

arg0 >>=

2500

(fun arg0 >

2501

Result.Ok

2502

(TAttStringArg { id = arg0; arg = arg1 }))))

2503

 _::xs > loop xs _state in

2504

loop xs

2505

((Result.Error "Vhdl_ast.vhdl_type_attributes_t.id"),

2506

(Result.Error "Vhdl_ast.vhdl_type_attributes_t.arg"))

2507

 _ > Result.Error "Vhdl_ast.vhdl_type_attributes_t")) arg0

2508

 _ > Result.Error "Vhdl_ast.vhdl_type_attributes_t")

2509

[@ocaml.warning "A"])

2510


2511

let typ_att_noarg = ["base"; "left"; "right"; "high"; "low"]

2512

let typ_att_intarg = ["pos"; "val"; "succ"; "pred"; "leftof"; "rightof"]

2513

let typ_att_valarg = ["image"]

2514

let typ_att_stringarg = ["value"]

2515

let array_att_intarg =

2516

["left"; "right"; "high"; "low"; "range"; "reverse_range"; "length"]

2517

type vhdl_parameter_t =

2518

{

2519

names: vhdl_name_t list ;

2520

mode: string list [@default []];

2521

typ: vhdl_subtype_indication_t ;

2522

init_val: vhdl_cst_val_t option [@default None]}

2523


2524

(* TODO *)

2525

let rec pp_vhdl_parameter_t :

2526

Format.formatter > vhdl_parameter_t > Ppx_deriving_runtime.unit =

2527

let __2 () = pp_vhdl_cst_val_t

2528


2529

and __1 () = pp_vhdl_subtype_indication_t

2530


2531

and __0 () = pp_vhdl_name_t

2532

in

2533

((let open! Ppx_deriving_runtime in

2534

fun fmt >

2535

fun x >

2536

Format.fprintf fmt "@[<2>{ ";

2537

((((Format.fprintf fmt "@[%s =@ " "names";

2538

((fun x >

2539

Format.fprintf fmt "@[<2>[";

2540

ignore

2541

(List.fold_left

2542

(fun sep >

2543

fun x >

2544

if sep then Format.fprintf fmt ";@ ";

2545

((__0 ()) fmt) x;

2546

true) false x);

2547

Format.fprintf fmt "@,]@]")) x.names;

2548

Format.fprintf fmt "@]");

2549

Format.fprintf fmt ";@ ";

2550

Format.fprintf fmt "@[%s =@ " "mode";

2551

((fun x >

2552

Format.fprintf fmt "@[<2>[";

2553

ignore

2554

(List.fold_left

2555

(fun sep >

2556

fun x >

2557

if sep then Format.fprintf fmt ";@ ";

2558

(Format.fprintf fmt "%S") x;

2559

true) false x);

2560

Format.fprintf fmt "@,]@]")) x.mode;

2561

Format.fprintf fmt "@]");

2562

Format.fprintf fmt ";@ ";

2563

Format.fprintf fmt "@[%s =@ " "typ";

2564

((__1 ()) fmt) x.typ;

2565

Format.fprintf fmt "@]");

2566

Format.fprintf fmt ";@ ";

2567

Format.fprintf fmt "@[%s =@ " "init_val";

2568

((function

2569

 None > Format.pp_print_string fmt "None"

2570

 Some x >

2571

(Format.pp_print_string fmt "(Some ";

2572

((__2 ()) fmt) x;

2573

Format.pp_print_string fmt ")"))) x.init_val;

2574

Format.fprintf fmt "@]");

2575

Format.fprintf fmt "@ }@]")

2576

[@ocaml.warning "A"])

2577


2578

and show_vhdl_parameter_t : vhdl_parameter_t > Ppx_deriving_runtime.string =

2579

fun x > Format.asprintf "%a" pp_vhdl_parameter_t x

2580


2581

let rec (vhdl_parameter_t_to_yojson : vhdl_parameter_t > Yojson.Safe.json) =

2582

((let open! Ppx_deriving_yojson_runtime in

2583

fun x >

2584

let fields = [] in

2585

let fields =

2586

if x.init_val = None

2587

then fields

2588

else

2589

("init_val",

2590

(((function

2591

 None > `Null

2592

 Some x > ((fun x > vhdl_cst_val_t_to_yojson x)) x))

2593

x.init_val))

2594

:: fields

2595

in

2596

let fields =

2597

("typ", ((fun x > vhdl_subtype_indication_t_to_yojson x) x.typ))

2598

:: fields in

2599

let fields =

2600

if x.mode = []

2601

then fields

2602

else

2603

("mode",

2604

(((fun x >

2605

`List

2606

(List.map

2607

(fun (x : Ppx_deriving_runtime.string) > `String x)

2608

x))) x.mode))

2609

:: fields

2610

in

2611

let fields =

2612

("names",

2613

((fun x >

2614

`List (List.map (fun x > vhdl_name_t_to_yojson x) x))

2615

x.names))

2616

:: fields in

2617

`Assoc fields)

2618

[@ocaml.warning "A"])

2619


2620

and (vhdl_parameter_t_of_yojson :

2621

Yojson.Safe.json >

2622

vhdl_parameter_t Ppx_deriving_yojson_runtime.error_or)

2623

=

2624

((let open! Ppx_deriving_yojson_runtime in

2625

function

2626

 `Assoc xs >

2627

let rec loop xs ((arg0,arg1,arg2,arg3) as _state) =

2628

match xs with

2629

 ("names",x)::xs >

2630

loop xs

2631

(((function

2632

 `List xs >

2633

map_bind (fun x > vhdl_name_t_of_yojson x) [] xs

2634

 _ > Result.Error "Vhdl_ast.vhdl_parameter_t.names") x),

2635

arg1, arg2, arg3)

2636

 ("mode",x)::xs >

2637

loop xs

2638

(arg0,

2639

((function

2640

 `List xs >

2641

map_bind

2642

(function

2643

 `String x > Result.Ok x

2644

 _ >

2645

Result.Error

2646

"Vhdl_ast.vhdl_parameter_t.mode") [] xs

2647

 _ > Result.Error "Vhdl_ast.vhdl_parameter_t.mode") x),

2648

arg2, arg3)

2649

 ("typ",x)::xs >

2650

loop xs

2651

(arg0, arg1,

2652

((fun x > vhdl_subtype_indication_t_of_yojson x) x),

2653

arg3)

2654

 ("init_val",x)::xs >

2655

loop xs

2656

(arg0, arg1, arg2,

2657

((function

2658

 `Null > Result.Ok None

2659

 x >

2660

((fun x > vhdl_cst_val_t_of_yojson x) x) >>=

2661

((fun x > Result.Ok (Some x)))) x))

2662

 [] >

2663

arg3 >>=

2664

((fun arg3 >

2665

arg2 >>=

2666

(fun arg2 >

2667

arg1 >>=

2668

(fun arg1 >

2669

arg0 >>=

2670

(fun arg0 >

2671

Result.Ok

2672

{

2673

names = arg0;

2674

mode = arg1;

2675

typ = arg2;

2676

init_val = arg3

2677

})))))

2678

 _::xs > loop xs _state in

2679

loop xs

2680

((Result.Error "Vhdl_ast.vhdl_parameter_t.names"),

2681

(Result.Ok []), (Result.Error "Vhdl_ast.vhdl_parameter_t.typ"),

2682

(Result.Ok (Some (CstInt 0))))

2683

 _ > Result.Error "Vhdl_ast.vhdl_parameter_t")

2684

[@ocaml.warning "A"])

2685


2686

type vhdl_subprogram_spec_t =

2687

{

2688

name: string [@default ""];

2689

typeMark: vhdl_name_t [@default NoName];

2690

parameters: vhdl_parameter_t list ;

2691

isPure: bool [@default false]}

2692


2693

(* TODO *)

2694

let rec pp_vhdl_subprogram_spec_t :

2695

Format.formatter > vhdl_subprogram_spec_t > Ppx_deriving_runtime.unit =

2696

let __1 () = pp_vhdl_parameter_t

2697


2698

and __0 () = pp_vhdl_name_t

2699

in

2700

((let open! Ppx_deriving_runtime in

2701

fun fmt >

2702

fun x >

2703

Format.fprintf fmt "@[<2>{ ";

2704

((((Format.fprintf fmt "@[%s =@ " "name";

2705

(Format.fprintf fmt "%S") x.name;

2706

Format.fprintf fmt "@]");

2707

Format.fprintf fmt ";@ ";

2708

Format.fprintf fmt "@[%s =@ " "typeMark";

2709

((__0 ()) fmt) x.typeMark;

2710

Format.fprintf fmt "@]");

2711

Format.fprintf fmt ";@ ";

2712

Format.fprintf fmt "@[%s =@ " "parameters";

2713

((fun x >

2714

Format.fprintf fmt "@[<2>[";

2715

ignore

2716

(List.fold_left

2717

(fun sep >

2718

fun x >

2719

if sep then Format.fprintf fmt ";@ ";

2720

((__1 ()) fmt) x;

2721

true) false x);

2722

Format.fprintf fmt "@,]@]")) x.parameters;

2723

Format.fprintf fmt "@]");

2724

Format.fprintf fmt ";@ ";

2725

Format.fprintf fmt "@[%s =@ " "isPure";

2726

(Format.fprintf fmt "%B") x.isPure;

2727

Format.fprintf fmt "@]");

2728

Format.fprintf fmt "@ }@]")

2729

[@ocaml.warning "A"])

2730


2731

and show_vhdl_subprogram_spec_t :

2732

vhdl_subprogram_spec_t > Ppx_deriving_runtime.string =

2733

fun x > Format.asprintf "%a" pp_vhdl_subprogram_spec_t x

2734


2735

let rec (vhdl_subprogram_spec_t_to_yojson :

2736

vhdl_subprogram_spec_t > Yojson.Safe.json)

2737

=

2738

((let open! Ppx_deriving_yojson_runtime in

2739

fun x >

2740

let fields = [] in

2741

let fields =

2742

if x.isPure = false

2743

then fields

2744

else

2745

("isPure",

2746

(((fun (x : Ppx_deriving_runtime.bool) > `Bool x)) x.isPure))

2747

:: fields

2748

in

2749

let fields =

2750

("parameters",

2751

((fun x >

2752

`List (List.map (fun x > vhdl_parameter_t_to_yojson x) x))

2753

x.parameters))

2754

:: fields in

2755

let fields =

2756

if x.typeMark = NoName

2757

then fields

2758

else

2759

("typeMark", (((fun x > vhdl_name_t_to_yojson x)) x.typeMark))

2760

:: fields

2761

in

2762

let fields =

2763

if x.name = ""

2764

then fields

2765

else

2766

("name",

2767

(((fun (x : Ppx_deriving_runtime.string) > `String x)) x.name))

2768

:: fields

2769

in

2770

`Assoc fields)

2771

[@ocaml.warning "A"])

2772


2773

and (vhdl_subprogram_spec_t_of_yojson :

2774

Yojson.Safe.json >

2775

vhdl_subprogram_spec_t Ppx_deriving_yojson_runtime.error_or)

2776

=

2777

((let open! Ppx_deriving_yojson_runtime in

2778

function

2779

 `Assoc xs >

2780

let rec loop xs ((arg0,arg1,arg2,arg3) as _state) =

2781

match xs with

2782

 ("name",x)::xs >

2783

loop xs

2784

(((function

2785

 `String x > Result.Ok x

2786

 _ >

2787

Result.Error "Vhdl_ast.vhdl_subprogram_spec_t.name")

2788

x), arg1, arg2, arg3)

2789

 ("typeMark",x)::xs >

2790

loop xs

2791

(arg0, ((fun x > vhdl_name_t_of_yojson x) x), arg2, arg3)

2792

 ("parameters",x)::xs >

2793

loop xs

2794

(arg0, arg1,

2795

((function

2796

 `List xs >

2797

map_bind (fun x > vhdl_parameter_t_of_yojson x)

2798

[] xs

2799

 _ >

2800

Result.Error

2801

"Vhdl_ast.vhdl_subprogram_spec_t.parameters") x),

2802

arg3)

2803

 ("isPure",x)::xs >

2804

loop xs

2805

(arg0, arg1, arg2,

2806

((function

2807

 `Bool x > Result.Ok x

2808

 _ >

2809

Result.Error

2810

"Vhdl_ast.vhdl_subprogram_spec_t.isPure") x))

2811

 [] >

2812

arg3 >>=

2813

((fun arg3 >

2814

arg2 >>=

2815

(fun arg2 >

2816

arg1 >>=

2817

(fun arg1 >

2818

arg0 >>=

2819

(fun arg0 >

2820

Result.Ok

2821

{

2822

name = arg0;

2823

typeMark = arg1;

2824

parameters = arg2;

2825

isPure = arg3

2826

})))))

2827

 _::xs > loop xs _state in

2828

loop xs

2829

((Result.Ok ""), (Result.Ok NoName),

2830

(Result.Error "Vhdl_ast.vhdl_subprogram_spec_t.parameters"),

2831

(Result.Ok false))

2832

 _ > Result.Error "Vhdl_ast.vhdl_subprogram_spec_t")

2833

[@ocaml.warning "A"])

2834


2835

let arith_funs = ["+"; ""; "*"; "/"; "mod"; "rem"; "abs"; "**"; "&"]

2836

let bool_funs = ["and"; "or"; "nand"; "nor"; "xor"; "not"]

2837

let rel_funs =

2838

["<";

2839

">";

2840

"<=";

2841

">=";

2842

"/=";

2843

"=";

2844

"?=";

2845

"?/=";

2846

"?<";

2847

"?<=";

2848

"?>";

2849

"?>=";

2850

"??"]

2851

let shift_funs = ["sll"; "srl"; "sla"; "sra"; "rol"; "ror"]

2852

type vhdl_sequential_stmt_t =

2853

 VarAssign of

2854

{

2855

label: vhdl_name_t [@default NoName];

2856

lhs: vhdl_name_t ;

2857

rhs: vhdl_expr_t } [@name "VARIABLE_ASSIGNMENT_STATEMENT"]

2858

 SigSeqAssign of

2859

{

2860

label: vhdl_name_t [@default NoName];

2861

lhs: vhdl_name_t ;

2862

rhs: vhdl_expr_t list } [@name "SIGNAL_ASSIGNMENT_STATEMENT"]

2863

 If of

2864

{

2865

label: vhdl_name_t [@default NoName];

2866

if_cases: vhdl_if_case_t list ;

2867

default: vhdl_sequential_stmt_t list [@default []]} [@name "IF_STATEMENT"]

2868

 Case of

2869

{

2870

label: vhdl_name_t [@default NoName];

2871

guard: vhdl_expr_t ;

2872

branches: vhdl_case_item_t list } [@name "CASE_STATEMENT_TREE"]

2873

 Exit of

2874

{

2875

label: vhdl_name_t [@default NoName];

2876

loop_label: string option [@default Some ""];

2877

condition: vhdl_expr_t option [@default Some IsNull]}

2878

[@name "EXIT_STATEMENT"]

2879

 Assert of

2880

{

2881

label: vhdl_name_t [@default NoName];

2882

cond: vhdl_expr_t ;

2883

report: vhdl_expr_t [@default IsNull];

2884

severity: vhdl_expr_t [@default IsNull]} [@name "ASSERTION_STATEMENT"]

2885

 ProcedureCall of

2886

{

2887

label: vhdl_name_t [@default NoName];

2888

name: vhdl_name_t ;

2889

assocs: vhdl_assoc_element_t list } [@name "PROCEDURE_CALL_STATEMENT"]

2890

 Wait [@name "WAIT_STATEMENT"]

2891

 Null of {

2892

label: vhdl_name_t [@default NoName]} [@name "NULL_STATEMENT"]

2893

 Return of {

2894

label: vhdl_name_t [@default NoName]} [@name "RETURN_STATEMENT"]

2895

and vhdl_if_case_t =

2896

{

2897

if_cond: vhdl_expr_t ;

2898

if_block: vhdl_sequential_stmt_t list }

2899

and vhdl_case_item_t =

2900

{

2901

when_cond: vhdl_expr_t list ;

2902

when_stmt: vhdl_sequential_stmt_t list }

2903


2904

let rec pp_vhdl_sequential_stmt_t :

2905

Format.formatter > vhdl_sequential_stmt_t > Ppx_deriving_runtime.unit =

2906

let __22 () = pp_vhdl_name_t

2907


2908

and __21 () = pp_vhdl_name_t

2909


2910

and __20 () = pp_vhdl_assoc_element_t

2911


2912

and __19 () = pp_vhdl_name_t

2913


2914

and __18 () = pp_vhdl_name_t

2915


2916

and __17 () = pp_vhdl_expr_t

2917


2918

and __16 () = pp_vhdl_expr_t

2919


2920

and __15 () = pp_vhdl_expr_t

2921


2922

and __14 () = pp_vhdl_name_t

2923


2924

and __13 () = pp_vhdl_expr_t

2925


2926

and __12 () = pp_vhdl_name_t

2927


2928

and __11 () = pp_vhdl_case_item_t

2929


2930

and __10 () = pp_vhdl_expr_t

2931


2932

and __9 () = pp_vhdl_name_t

2933


2934

and __8 () = pp_vhdl_sequential_stmt_t

2935


2936

and __7 () = pp_vhdl_if_case_t

2937


2938

and __6 () = pp_vhdl_name_t

2939


2940

and __5 () = pp_vhdl_expr_t

2941


2942

and __4 () = pp_vhdl_name_t

2943


2944

and __3 () = pp_vhdl_name_t

2945


2946

and __2 () = pp_vhdl_expr_t

2947


2948

and __1 () = pp_vhdl_name_t

2949


2950

and __0 () = pp_vhdl_name_t

2951

in

2952

((let open! Ppx_deriving_runtime in

2953

fun fmt >

2954

function

2955

 VarAssign { label = alabel; lhs = alhs; rhs = arhs } >

2956

(match alabel with

2957

 NoName > Format.fprintf fmt "";

2958

 _ > (((__0 ()) fmt) alabel;

2959

Format.fprintf fmt ": ")

2960

);

2961

((__1 ()) fmt) alhs;

2962

Format.fprintf fmt " := ";

2963

((__2 ()) fmt) arhs;

2964

(* TODO: Check

2965

(Format.fprintf fmt "@[<2>VarAssign {@,";

2966

(((Format.fprintf fmt "@[%s =@ " "label";

2967

((__0 ()) fmt) alabel;

2968

Format.fprintf fmt "@]");

2969

Format.fprintf fmt ";@ ";

2970

Format.fprintf fmt "@[%s =@ " "lhs";

2971

((__1 ()) fmt) alhs;

2972

Format.fprintf fmt "@]");

2973

Format.fprintf fmt ";@ ";

2974

Format.fprintf fmt "@[%s =@ " "rhs";

2975

((__2 ()) fmt) arhs;

2976

Format.fprintf fmt "@]");

2977

Format.fprintf fmt "@]}") *)

2978

 SigSeqAssign { label = alabel; lhs = alhs; rhs = arhs } >

2979

(match alabel with

2980

 NoName > Format.fprintf fmt "";

2981

 _ > (((__3 ()) fmt) alabel;

2982

Format.fprintf fmt ":@ ")

2983

);

2984

Format.fprintf fmt "@[<2>";

2985

((__4 ()) fmt) alhs;

2986

Format.fprintf fmt "@ <=@ ";

2987

((fun x >

2988

Format.fprintf fmt "@[";

2989

ignore

2990

(List.fold_left

2991

(fun sep >

2992

fun x >

2993

if sep then Format.fprintf fmt "";

2994

((__5 ()) fmt) x;

2995

true) false x);

2996

Format.fprintf fmt "@]@]")) arhs;

2997

 If { label = alabel; if_cases = aif_cases; default = adefault } >

2998

(match alabel with

2999

 NoName > Format.fprintf fmt "";

3000

 _ > (((__6 ()) fmt) alabel;

3001

Format.fprintf fmt ":@ ")

3002

);

3003

Format.fprintf fmt "@[<v>if";

3004

((fun x >

3005

ignore

3006

(List.fold_left

3007

(fun sep >

3008

fun x >

3009

if sep then Format.fprintf fmt "@;elseif";

3010

((__7 ()) fmt) x;

3011

true

3012

) false x);

3013

)) aif_cases;

3014

(match adefault with

3015

 [] > Format.fprintf fmt "";

3016

 _ > (Format.fprintf fmt "@;else";

3017

((fun x >

3018

Format.fprintf fmt "@;<0 2>";

3019

ignore

3020

(List.fold_left

3021

(fun sep >

3022

fun x >

3023

if sep then Format.fprintf fmt "";

3024

((__8 ()) fmt) x;

3025

true) false x))) adefault));

3026

Format.fprintf fmt "@;end if;@]"

3027

 Case { label = alabel; guard = aguard; branches = abranches } >

3028

(match alabel with

3029

 NoName > Format.fprintf fmt "";

3030

 _ > (((__9 ()) fmt) alabel;

3031

Format.fprintf fmt ":@ ")

3032

);

3033

Format.fprintf fmt "@[<v>case ";

3034

((__10 ()) fmt) aguard;

3035

Format.fprintf fmt " is";

3036

((fun x >

3037

ignore

3038

(List.fold_left

3039

(fun sep >

3040

fun x >

3041

if sep then Format.fprintf fmt "";

3042

((__11 ()) fmt) x;

3043

true) false x);)) abranches;

3044

Format.fprintf fmt "@;end case;@]";

3045

 Exit

3046

{ label = alabel; loop_label = aloop_label;

3047

condition = acondition }

3048

>

3049

(match alabel with

3050

 NoName > Format.fprintf fmt "";

3051

 _ > (((__12 ()) fmt) alabel;

3052

Format.fprintf fmt ":@ ")

3053

);

3054

Format.fprintf fmt "exit";

3055

(match aloop_label with

3056

 None > Format.pp_print_string fmt ""

3057

 Some x > (Format.fprintf fmt "@ %s@ ") x);

3058

((function

3059

 None > Format.pp_print_string fmt ""

3060

 Some x >

3061

(Format.pp_print_string fmt "when@ ";

3062

((__13 ()) fmt) x;))) acondition;

3063

 Assert

3064

{ label = alabel; cond = acond; report = areport;

3065

severity = aseverity }

3066

>

3067

Format.fprintf fmt "@[<v 2>";

3068

(match alabel with

3069

 NoName > Format.fprintf fmt "";

3070

 _ > (((__14 ()) fmt) alabel;

3071

Format.fprintf fmt ":@ ")

3072

);

3073

Format.fprintf fmt "assert ";

3074

((__15 ()) fmt) acond;

3075

(match areport with

3076

 IsNull > Format.fprintf fmt "";

3077

 _ >

3078

Format.fprintf fmt "@;report ";

3079

((__16 ()) fmt) areport);

3080

(match aseverity with

3081

 IsNull > Format.fprintf fmt "";

3082

 _ >

3083

Format.fprintf fmt "@;severity ";

3084

((__17 ()) fmt) aseverity);

3085

Format.fprintf fmt "@]";

3086

 ProcedureCall { label = alabel; name = aname; assocs = aassocs } >

3087

(match alabel with

3088

 NoName > Format.fprintf fmt "";

3089

 _ > (((__18 ()) fmt) alabel;

3090

Format.fprintf fmt ":@ ")

3091

);

3092

((__19 ()) fmt) aname;

3093

((fun x >

3094

Format.fprintf fmt "(";

3095

ignore

3096

(List.fold_left

3097

(fun sep >

3098

fun x >

3099

if sep then Format.fprintf fmt ",@ ";

3100

((__20 ()) fmt) x;

3101

true) false x);

3102

Format.fprintf fmt ")")) aassocs;

3103

 Wait > Format.pp_print_string fmt "wait"

3104

 Null { label = alabel } >

3105

(match alabel with

3106

 NoName > Format.fprintf fmt "";

3107

 _ > (((__18 ()) fmt) alabel;

3108

Format.fprintf fmt ":@ ")

3109

);

3110

Format.fprintf fmt "null";

3111

 Return { label = alabel } >

3112

(match alabel with

3113

 NoName > Format.fprintf fmt "";

3114

 _ > (((__19 ()) fmt) alabel;

3115

Format.fprintf fmt ":@ ")

3116

);

3117

Format.fprintf fmt "return";)

3118

[@ocaml.warning "A"])

3119


3120

and show_vhdl_sequential_stmt_t :

3121

vhdl_sequential_stmt_t > Ppx_deriving_runtime.string =

3122

fun x > Format.asprintf "%a" pp_vhdl_sequential_stmt_t x

3123


3124

and pp_vhdl_if_case_t :

3125

Format.formatter > vhdl_if_case_t > Ppx_deriving_runtime.unit =

3126

let __1 () = pp_vhdl_sequential_stmt_t

3127


3128

and __0 () = pp_vhdl_expr_t

3129

in

3130

((let open! Ppx_deriving_runtime in

3131

fun fmt >

3132

fun x >

3133

Format.fprintf fmt " (";

3134

((__0 ()) fmt) x.if_cond;

3135

Format.fprintf fmt ") then@;<0 2>";

3136

((fun x >

3137

ignore

3138

(List.fold_left

3139

(fun sep >

3140

fun x >

3141

if sep then Format.fprintf fmt "@;<0 2>";

3142

((__1 ()) fmt) x;

3143

true) false x);

3144

)) x.if_block;)

3145

[@ocaml.warning "A"])

3146


3147

and show_vhdl_if_case_t : vhdl_if_case_t > Ppx_deriving_runtime.string =

3148

fun x > Format.asprintf "%a" pp_vhdl_if_case_t x

3149


3150

and pp_vhdl_case_item_t :

3151

Format.formatter > vhdl_case_item_t > Ppx_deriving_runtime.unit =

3152

let __1 () = pp_vhdl_sequential_stmt_t

3153


3154

and __0 () = pp_vhdl_expr_t

3155

in

3156

((let open! Ppx_deriving_runtime in

3157

fun fmt >

3158

fun x >

3159

Format.fprintf fmt "@;@[<v 2>when ";

3160

((fun x >

3161

ignore

3162

(List.fold_left

3163

(fun sep >

3164

fun x >

3165

if sep then Format.fprintf fmt "@ @ ";

3166

((__0 ()) fmt) x;

3167

true) false x);)) x.when_cond;

3168

Format.fprintf fmt " => ";

3169

(fun x >

3170

ignore

3171

(List.fold_left

3172

(fun sep >

3173

fun x >

3174

if sep then Format.fprintf fmt "@;";

3175

((__1 ()) fmt) x;

3176

Format.fprintf fmt ";";

3177

true) ((List.length x) > 1) x);) x.when_stmt;

3178

Format.fprintf fmt "@]")

3179

[@ocaml.warning "A"])

3180


3181

and show_vhdl_case_item_t : vhdl_case_item_t > Ppx_deriving_runtime.string =

3182

fun x > Format.asprintf "%a" pp_vhdl_case_item_t x

3183


3184

let rec (vhdl_sequential_stmt_t_to_yojson :

3185

vhdl_sequential_stmt_t > Yojson.Safe.json)

3186

=

3187

((let open! Ppx_deriving_yojson_runtime in

3188

function

3189

 VarAssign arg0 >

3190

`List

3191

[`String "VARIABLE_ASSIGNMENT_STATEMENT";

3192

(let fields = [] in

3193

let fields =

3194

("rhs", ((fun x > vhdl_expr_t_to_yojson x) arg0.rhs)) ::

3195

fields in

3196

let fields =

3197

("lhs", ((fun x > vhdl_name_t_to_yojson x) arg0.lhs)) ::

3198

fields in

3199

let fields =

3200

if arg0.label = NoName

3201

then fields

3202

else

3203

("label",

3204

(((fun x > vhdl_name_t_to_yojson x)) arg0.label))

3205

:: fields

3206

in

3207

`Assoc fields)]

3208

 SigSeqAssign arg0 >

3209

`List

3210

[`String "SIGNAL_ASSIGNMENT_STATEMENT";

3211

(let fields = [] in

3212

let fields =

3213

("rhs",

3214

((fun x >

3215

`List (List.map (fun x > vhdl_expr_t_to_yojson x) x))

3216

arg0.rhs))

3217

:: fields in

3218

let fields =

3219

("lhs", ((fun x > vhdl_name_t_to_yojson x) arg0.lhs)) ::

3220

fields in

3221

let fields =

3222

if arg0.label = NoName

3223

then fields

3224

else

3225

("label",

3226

(((fun x > vhdl_name_t_to_yojson x)) arg0.label))

3227

:: fields

3228

in

3229

`Assoc fields)]

3230

 If arg0 >

3231

`List

3232

[`String "IF_STATEMENT";

3233

(let fields = [] in

3234

let fields =

3235

if arg0.default = []

3236

then fields

3237

else

3238

("default",

3239

(((fun x >

3240

`List

3241

(List.map

3242

(fun x > vhdl_sequential_stmt_t_to_yojson x) x)))

3243

arg0.default))

3244

:: fields

3245

in

3246

let fields =

3247

("if_cases",

3248

((fun x >

3249

`List

3250

(List.map (fun x > vhdl_if_case_t_to_yojson x) x))

3251

arg0.if_cases))

3252

:: fields in

3253

let fields =

3254

if arg0.label = NoName

3255

then fields

3256

else

3257

("label",

3258

(((fun x > vhdl_name_t_to_yojson x)) arg0.label))

3259

:: fields

3260

in

3261

`Assoc fields)]

3262

 Case arg0 >

3263

`List

3264

[`String "CASE_STATEMENT_TREE";

3265

(let fields = [] in

3266

let fields =

3267

("branches",

3268

((fun x >

3269

`List

3270

(List.map (fun x > vhdl_case_item_t_to_yojson x) x))

3271

arg0.branches))

3272

:: fields in

3273

let fields =

3274

("guard", ((fun x > vhdl_expr_t_to_yojson x) arg0.guard)) ::

3275

fields in

3276

let fields =

3277

if arg0.label = NoName

3278

then fields

3279

else

3280

("label",

3281

(((fun x > vhdl_name_t_to_yojson x)) arg0.label))

3282

:: fields

3283

in

3284

`Assoc fields)]

3285

 Exit arg0 >

3286

`List

3287

[`String "EXIT_STATEMENT";

3288

(let fields = [] in

3289

let fields =

3290

if arg0.condition = (Some IsNull)

3291

then fields

3292

else

3293

("condition",

3294

(((function

3295

 None > `Null

3296

 Some x > ((fun x > vhdl_expr_t_to_yojson x)) x))

3297

arg0.condition))

3298

:: fields

3299

in

3300

let fields =

3301

if arg0.loop_label = (Some "")

3302

then fields

3303

else

3304

("loop_label",

3305

(((function

3306

 None > `Null

3307

 Some x >

3308

((fun (x : Ppx_deriving_runtime.string) >

3309

`String x)) x)) arg0.loop_label))

3310

:: fields

3311

in

3312

let fields =

3313

if arg0.label = NoName

3314

then fields

3315

else

3316

("label",

3317

(((fun x > vhdl_name_t_to_yojson x)) arg0.label))

3318

:: fields

3319

in

3320

`Assoc fields)]

3321

 Assert arg0 >

3322

`List

3323

[`String "ASSERTION_STATEMENT";

3324

(let fields = [] in

3325

let fields =

3326

if arg0.severity = IsNull

3327

then fields

3328

else

3329

("severity",

3330

(((fun x > vhdl_expr_t_to_yojson x)) arg0.severity))

3331

:: fields

3332

in

3333

let fields =

3334

if arg0.report = IsNull

3335

then fields

3336

else

3337

("report",

3338

(((fun x > vhdl_expr_t_to_yojson x)) arg0.report))

3339

:: fields

3340

in

3341

let fields =

3342

("cond", ((fun x > vhdl_expr_t_to_yojson x) arg0.cond)) ::

3343

fields in

3344

let fields =

3345

if arg0.label = NoName

3346

then fields

3347

else

3348

("label",

3349

(((fun x > vhdl_name_t_to_yojson x)) arg0.label))

3350

:: fields

3351

in

3352

`Assoc fields)]

3353

 ProcedureCall arg0 >

3354

`List

3355

[`String "PROCEDURE_CALL_STATEMENT";

3356

(let fields = [] in

3357

let fields =

3358

("assocs",

3359

((fun x >

3360

`List

3361

(List.map (fun x > vhdl_assoc_element_t_to_yojson x)

3362

x)) arg0.assocs))

3363

:: fields in

3364

let fields =

3365

("name", ((fun x > vhdl_name_t_to_yojson x) arg0.name)) ::

3366

fields in

3367

let fields =

3368

if arg0.label = NoName

3369

then fields

3370

else

3371

("label",

3372

(((fun x > vhdl_name_t_to_yojson x)) arg0.label))

3373

:: fields

3374

in

3375

`Assoc fields)]

3376

 Wait > `List [`String "WAIT_STATEMENT"]

3377

 Null arg0 