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

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

225

((fun x >

226

ignore

227

(List.fold_left

228

(fun sep >

229

fun x >

230

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

231

((__0 ()) fmt) x;

232

Format.fprintf fmt " range <>";

233

true) false x)) aindexes);

234

Format.fprintf fmt ")@]");

235

(function

236

 None > Format.pp_print_string fmt ""

237

 Some x >

238

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

239

Format.fprintf fmt " of ";

240

((__2 ()) fmt) adefinition;

241

 Record a0 >

242

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

243

(fun x >

244

ignore

245

(List.fold_left

246

(fun sep >

247

fun x >

248

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

249

((__3 ()) fmt) x;

250

true) false x);

251

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

252

 Enumerated a0 >

253

(Format.fprintf fmt "(";

254

((fun x >

255

ignore

256

(List.fold_left

257

(fun sep >

258

fun x >

259

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

260

((__4 ()) fmt) x;

261

true) false x))) a0;

262

Format.fprintf fmt ")");

263

 Void > Format.pp_print_string fmt "")

264

[@ocaml.warning "A"])

265


266

and show_vhdl_type_t : vhdl_type_t > Ppx_deriving_runtime.string =

267

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

268


269

and pp_vhdl_element_declaration_t :

270

Format.formatter > vhdl_element_declaration_t > Ppx_deriving_runtime.unit

271

=

272

let __1 () = pp_vhdl_subtype_indication_t

273


274

and __0 () = pp_vhdl_name_t

275

in

276

((let open! Ppx_deriving_runtime in

277

fun fmt >

278

fun x >

279

(fun x >

280

ignore

281

(List.fold_left

282

(fun sep >

283

fun x >

284

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

285

((__0 ()) fmt) x;

286

true) false x)) x.names;

287

Format.fprintf fmt ":@ ";

288

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

289

[@ocaml.warning "A"])

290


291

and show_vhdl_element_declaration_t :

292

vhdl_element_declaration_t > Ppx_deriving_runtime.string =

293

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

294


295

and pp_vhdl_subtype_indication_t :

296

Format.formatter > vhdl_subtype_indication_t > Ppx_deriving_runtime.unit

297

=

298

let __2 () = pp_vhdl_constraint_t

299


300

and __1 () = pp_vhdl_name_t

301


302

and __0 () = pp_vhdl_name_t

303

in

304

((let open! Ppx_deriving_runtime in

305

fun fmt >

306

fun x >

307

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

308

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

309

(match x.const with

310

 NoConstraint > Format.fprintf fmt "";

311

 _ > Format.fprintf fmt " ";

312

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

313

[@ocaml.warning "A"])

314


315

and show_vhdl_subtype_indication_t :

316

vhdl_subtype_indication_t > Ppx_deriving_runtime.string =

317

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

318


319

and pp_vhdl_discrete_range_t :

320

Format.formatter > vhdl_discrete_range_t > Ppx_deriving_runtime.unit =

321

let __3 () = pp_vhdl_expr_t

322


323

and __2 () = pp_vhdl_expr_t

324


325

and __1 () = pp_vhdl_name_t

326


327

and __0 () = pp_vhdl_subtype_indication_t

328

in

329

((let open! Ppx_deriving_runtime in

330

fun fmt >

331

function

332

 SubDiscreteRange a0 >

333

((__0 ()) fmt) a0;

334

 NamedRange a0 >

335

((__1 ()) fmt) a0;

336

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

337

>

338

((__2 ()) fmt) afrom;

339

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

340

((__3 ()) fmt) a_to;

341

)

342

[@ocaml.warning "A"])

343


344

and show_vhdl_discrete_range_t :

345

vhdl_discrete_range_t > Ppx_deriving_runtime.string =

346

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

347


348

(* TODO Adapt for: ArrayConstraint, RecordConstraint *)

349

and pp_vhdl_constraint_t :

350

Format.formatter > vhdl_constraint_t > Ppx_deriving_runtime.unit =

351

let __4 () = pp_vhdl_constraint_t

352


353

and __3 () = pp_vhdl_discrete_range_t

354


355

and __2 () = pp_vhdl_discrete_range_t

356


357

and __1 () = pp_vhdl_discrete_range_t

358


359

and __0 () = pp_vhdl_name_t

360

in

361

((let open! Ppx_deriving_runtime in

362

fun fmt >

363

function

364

 RefConstraint { ref_name = aref_name } >

365

(Format.fprintf fmt "(";

366

((__0 ()) fmt) aref_name;

367

Format.fprintf fmt ")");

368

 RangeConstraint { range = arange } >

369

(Format.fprintf fmt "(";

370

((__1 ()) fmt) arange;

371

Format.fprintf fmt ")");

372

 IndexConstraint { ranges = aranges } >

373

Format.fprintf fmt "(";

374

((fun x >

375

ignore

376

(List.fold_left

377

(fun sep >

378

fun x >

379

if sep then Format.fprintf fmt ", ";

380

((__2 ()) fmt) x;

381

true) false x))) aranges;

382

Format.fprintf fmt ")";

383

 ArrayConstraint { ranges = aranges; sub = asub } >

384

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

385

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

386

((fun x >

387

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

388

ignore

389

(List.fold_left

390

(fun sep >

391

fun x >

392

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

393

((__3 ()) fmt) x;

394

true) false x);

395

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

396

Format.fprintf fmt "@]");

397

Format.fprintf fmt ";@ ";

398

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

399

((__4 ()) fmt) asub;

400

Format.fprintf fmt "@]");

401

Format.fprintf fmt "@]}")

402

 RecordConstraint > Format.pp_print_string fmt ""

403

 NoConstraint > Format.pp_print_string fmt "")

404

[@ocaml.warning "A"])

405


406

and show_vhdl_constraint_t : vhdl_constraint_t > Ppx_deriving_runtime.string

407

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

408


409

and pp_vhdl_definition_t :

410

Format.formatter > vhdl_definition_t > Ppx_deriving_runtime.unit =

411

let __3 () = pp_vhdl_subtype_indication_t

412


413

and __2 () = pp_vhdl_name_t

414


415

and __1 () = pp_vhdl_type_t

416


417

and __0 () = pp_vhdl_name_t

418

in

419

((let open! Ppx_deriving_runtime in

420

fun fmt >

421

function

422

 Type { name = aname; definition = adefinition } >

423

Format.fprintf fmt "type ";

424

((__0 ()) fmt) aname;

425

Format.fprintf fmt " is ";

426

((__1 ()) fmt) adefinition;

427

 Subtype { name = aname; typ = atyp } >

428

Format.fprintf fmt "subtype ";

429

((__2 ()) fmt) aname;

430

Format.fprintf fmt " is ";

431

((__3 ()) fmt) atyp;

432

)

433

[@ocaml.warning "A"])

434


435

and show_vhdl_definition_t : vhdl_definition_t > Ppx_deriving_runtime.string

436

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

437


438

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

439

and pp_vhdl_expr_t :

440

Format.formatter > vhdl_expr_t > Ppx_deriving_runtime.unit =

441

let __8 () = pp_vhdl_element_assoc_t

442


443

and __7 () = pp_vhdl_suffix_selection_t

444


445

and __6 () = pp_vhdl_expr_t

446


447

and __5 () = pp_vhdl_signal_attributes_t

448


449

and __4 () = pp_vhdl_name_t

450


451

and __3 () = pp_vhdl_expr_t

452


453

and __2 () = pp_vhdl_name_t

454


455

and __1 () = pp_vhdl_cst_val_t

456


457

and __0 () = pp_vhdl_name_t

458

in

459

((let open! Ppx_deriving_runtime in

460

fun fmt >

461

function

462

 Call a0 >

463

((__0 ()) fmt) a0;

464

 Cst { value = avalue; unit_name = aunit_name } >

465

((__1 ()) fmt) avalue;

466

(function

467

 None > Format.pp_print_string fmt ""

468

 Some x >

469

Format.fprintf fmt " ";

470

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

471

 Op { id = aid; args = aargs } >

472

(match aargs with

473

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

474

 hd::[] >

475

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

476

((__3 ()) fmt) hd

477

 hd::(hd2::[]) >

478

((__3 ()) fmt) hd;

479

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

480

((__3 ()) fmt) hd2

481

 _ >

482

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

483

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

484

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

485

Format.fprintf fmt "@]");

486

Format.fprintf fmt ";@ ";

487

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

488

((fun x >

489

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

490

ignore

491

(List.fold_left

492

(fun sep >

493

fun x >

494

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

495

((__3 ()) fmt) x;

496

true) false x);

497

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

498

Format.fprintf fmt "@]");

499

Format.fprintf fmt "@]}"))

500

 IsNull > Format.pp_print_string fmt ""

501

 Time { value = avalue; phy_unit = aphy_unit } >

502

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

503

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

504

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

505

Format.fprintf fmt "@]");

506

Format.fprintf fmt ";@ ";

507

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

508

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

509

Format.fprintf fmt "@]");

510

Format.fprintf fmt "@]}")

511

 Sig { name = aname; att = aatt } >

512

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

513

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

514

((__4 ()) fmt) aname;

515

Format.fprintf fmt "@]");

516

Format.fprintf fmt ";@ ";

517

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

518

((function

519

 None > Format.pp_print_string fmt "None"

520

 Some x >

521

(Format.pp_print_string fmt "(Some ";

522

((__5 ()) fmt) x;

523

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

524

Format.fprintf fmt "@]");

525

Format.fprintf fmt "@]}")

526

 SuffixMod { expr = aexpr; selection = aselection } >

527

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

528

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

529

((__6 ()) fmt) aexpr;

530

Format.fprintf fmt "@]");

531

Format.fprintf fmt ";@ ";

532

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

533

((__7 ()) fmt) aselection;

534

Format.fprintf fmt "@]");

535

Format.fprintf fmt "@]}")

536

 Aggregate { elems = aelems } >

537

(match aelems with

538

 [] > Format.fprintf fmt "";

539

 _ >

540

(Format.fprintf fmt "(@[";

541

((fun x >

542

ignore

543

(List.fold_left

544

(fun sep >

545

fun x >

546

if sep then Format.fprintf fmt ", ";

547

((__8 ()) fmt) x;

548

true) false x))) aelems;

549

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

550

 Others > Format.pp_print_string fmt "others")

551

[@ocaml.warning "A"])

552


553

and show_vhdl_expr_t : vhdl_expr_t > Ppx_deriving_runtime.string =

554

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

555


556

and pp_vhdl_name_t :

557

Format.formatter > vhdl_name_t > Ppx_deriving_runtime.unit =

558

let __9 () = pp_vhdl_assoc_element_t

559


560

and __8 () = pp_vhdl_name_t

561


562

and __7 () = pp_vhdl_expr_t

563


564

and __6 () = pp_vhdl_name_t

565


566

and __5 () = pp_vhdl_name_t

567


568

and __4 () = pp_vhdl_discrete_range_t

569


570

and __3 () = pp_vhdl_name_t

571


572

and __2 () = pp_vhdl_expr_t

573


574

and __1 () = pp_vhdl_name_t

575


576

and __0 () = pp_vhdl_name_t

577

in

578

((let open! Ppx_deriving_runtime in

579

fun fmt >

580

function

581

 Simple a0 >

582

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

583

 Identifier a0 >

584

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

585

 Selected a0 >

586

((fun x >

587

ignore

588

(List.fold_left

589

(fun sep >

590

fun x >

591

if sep then Format.fprintf fmt ".";

592

((__0 ()) fmt) x;

593

true) false x);) a0;)

594

 Index { id = aid; exprs = aexprs } >

595

((__1 ()) fmt) aid;

596

Format.fprintf fmt "(";

597

(fun x >

598

ignore

599

(List.fold_left

600

(fun sep >

601

fun x >

602

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

603

((__2 ()) fmt) x;

604

true

605

) false x);

606

) aexprs;

607

Format.fprintf fmt ")";

608

 Slice { id = aid; range = arange } >

609

((__3 ()) fmt) aid;

610

Format.fprintf fmt "(";

611

((__4 ()) fmt) arange;

612

Format.fprintf fmt ")";

613

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

614

((__5 ()) fmt) aid;

615

Format.fprintf fmt "\'";

616

((__6 ()) fmt) adesignator;

617

(match aexpr with

618

 IsNull > Format.fprintf fmt "";

619

 _ >

620

Format.fprintf fmt "(";

621

((__7 ()) fmt) aexpr;

622

Format.fprintf fmt ")")

623

 Function { id = aid; assoc_list = aassoc_list } >

624

(((__8 ()) fmt) aid;

625

Format.fprintf fmt "(";

626

((fun x >

627

Format.fprintf fmt "@[";

628

ignore

629

(List.fold_left

630

(fun sep >

631

fun x >

632

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

633

((__9 ()) fmt) x;

634

true) false x);

635

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

636

Format.fprintf fmt ")";)

637

 NoName > Format.pp_print_string fmt "")

638

[@ocaml.warning "A"])

639


640

and show_vhdl_name_t : vhdl_name_t > Ppx_deriving_runtime.string =

641

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

642


643

and pp_vhdl_assoc_element_t :

644

Format.formatter > vhdl_assoc_element_t > Ppx_deriving_runtime.unit =

645

let __4 () = pp_vhdl_expr_t

646


647

and __3 () = pp_vhdl_name_t

648


649

and __2 () = pp_vhdl_name_t

650


651

and __1 () = pp_vhdl_name_t

652


653

and __0 () = pp_vhdl_name_t

654

in

655

((let open! Ppx_deriving_runtime in

656

fun fmt >

657

fun x >

658

(match x.formal_name with

659

 None > Format.pp_print_string fmt ""

660

 Some NoName > Format.pp_print_string fmt ""

661

 Some a >

662

(((__0 ()) fmt) a;

663

(match x.formal_arg with

664

 None > ()

665

 Some b > Format.fprintf fmt "(";

666

((__1 ()) fmt) b;

667

Format.fprintf fmt ")");

668

Format.fprintf fmt " => "));

669

(match x.actual_name with

670

 None > Format.pp_print_string fmt ""

671

 Some a >

672

(((__2 ()) fmt) a;

673

(match x.actual_designator with

674

 None > ()

675

 Some NoName > Format.pp_print_string fmt ""

676

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

677

((__3 ()) fmt) b;

678

Format.fprintf fmt ")"));

679

(match x.actual_expr with

680

 None > ()

681

 Some IsNull > Format.pp_print_string fmt ""

682

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

683

((__4 ()) fmt) c;

684

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

685

[@ocaml.warning "A"])

686


687

and show_vhdl_assoc_element_t :

688

vhdl_assoc_element_t > Ppx_deriving_runtime.string =

689

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

690


691

and pp_vhdl_element_assoc_t :

692

Format.formatter > vhdl_element_assoc_t > Ppx_deriving_runtime.unit =

693

let __1 () = pp_vhdl_expr_t

694


695

and __0 () = pp_vhdl_expr_t

696

in

697

((let open! Ppx_deriving_runtime in

698

fun fmt >

699

fun x >

700

(match x.choices with

701

 [] > Format.fprintf fmt "";

702

 _ >

703

(((fun x >

704

ignore

705

(List.fold_left

706

(fun sep >

707

fun x >

708

if sep then Format.fprintf fmt "@ ";

709

((__0 ()) fmt) x;

710

true) false x))) x.choices;

711

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

712

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

713

[@ocaml.warning "A"])

714


715

and show_vhdl_element_assoc_t :

716

vhdl_element_assoc_t > Ppx_deriving_runtime.string =

717

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

718


719

(* TODO *)

720

and (pp_vhdl_array_attributes_t :

721

Format.formatter >

722

vhdl_array_attributes_t > Ppx_deriving_runtime.unit)

723

=

724

((let open! Ppx_deriving_runtime in

725

fun fmt >

726

function

727

 AAttInt { id = aid; arg = aarg } >

728

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

729

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

730

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

731

Format.fprintf fmt "@]");

732

Format.fprintf fmt ";@ ";

733

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

734

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

735

Format.fprintf fmt "@]");

736

Format.fprintf fmt "@]}")

737

 AAttAscending > Format.pp_print_string fmt "AAttAscending")

738

[@ocaml.warning "A"])

739


740

and show_vhdl_array_attributes_t :

741

vhdl_array_attributes_t > Ppx_deriving_runtime.string =

742

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

743


744

(* TODO *)

745

and (pp_vhdl_signal_attributes_t :

746

Format.formatter >

747

vhdl_signal_attributes_t > Ppx_deriving_runtime.unit)

748

=

749

((let open! Ppx_deriving_runtime in

750

fun fmt >

751

function

752

 SigAtt a0 >

753

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

754

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

755

Format.fprintf fmt "@])"))

756

[@ocaml.warning "A"])

757


758

and show_vhdl_signal_attributes_t :

759

vhdl_signal_attributes_t > Ppx_deriving_runtime.string =

760

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

761


762

(* TODO *)

763

and (pp_vhdl_string_attributes_t :

764

Format.formatter >

765

vhdl_string_attributes_t > Ppx_deriving_runtime.unit)

766

=

767

((let open! Ppx_deriving_runtime in

768

fun fmt >

769

function

770

 StringAtt a0 >

771

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

772

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

773

Format.fprintf fmt "@])"))

774

[@ocaml.warning "A"])

775


776

and show_vhdl_string_attributes_t :

777

vhdl_string_attributes_t > Ppx_deriving_runtime.string =

778

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

779


780

(* TODO *)

781

and (pp_vhdl_suffix_selection_t :

782

Format.formatter >

783

vhdl_suffix_selection_t > Ppx_deriving_runtime.unit)

784

=

785

((let open! Ppx_deriving_runtime in

786

fun fmt >

787

function

788

 Idx a0 >

789

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

790

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

791

Format.fprintf fmt "@])")

792

 SuffixRange (a0,a1) >

793

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

794

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

795

Format.fprintf fmt ",@ ";

796

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

797

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

798

[@ocaml.warning "A"])

799


800

and show_vhdl_suffix_selection_t :

801

vhdl_suffix_selection_t > Ppx_deriving_runtime.string =

802

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

803


804

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

805

((let open! Ppx_deriving_yojson_runtime in

806

function

807

 Base arg0 >

808

`List

809

[`String "Base";

810

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

811

 Range (arg0,arg1,arg2) >

812

`List

813

[`String "Range";

814

((function

815

 None > `Null

816

 Some x >

817

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

818

arg0;

819

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

820

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

821

 Bit_vector (arg0,arg1) >

822

`List

823

[`String "Bit_vector";

824

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

825

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

826

 Array arg0 >

827

`List

828

[`String "ARRAY_TYPE_DEFINITION";

829

(let fields = [] in

830

let fields =

831

("definition",

832

((fun x > vhdl_subtype_indication_t_to_yojson x)

833

arg0.definition))

834

:: fields in

835

let fields =

836

if arg0.const = None

837

then fields

838

else

839

("const",

840

(((function

841

 None > `Null

842

 Some x >

843

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

844

arg0.const))

845

:: fields

846

in

847

let fields =

848

if arg0.indexes = []

849

then fields

850

else

851

("indexes",

852

(((fun x >

853

`List

854

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

855

arg0.indexes))

856

:: fields

857

in

858

`Assoc fields)]

859

 Record arg0 >

860

`List

861

[`String "RECORD_TYPE_DEFINITION";

862

((fun x >

863

`List

864

(List.map

865

(fun x > vhdl_element_declaration_t_to_yojson x) x)))

866

arg0]

867

 Enumerated arg0 >

868

`List

869

[`String "ENUMERATION_TYPE_DEFINITION";

870

((fun x >

871

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

872

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

873

[@ocaml.warning "A"])

874


875

and (vhdl_type_t_of_yojson :

876

Yojson.Safe.json > vhdl_type_t Ppx_deriving_yojson_runtime.error_or)

877

=

878

((let open! Ppx_deriving_yojson_runtime in

879

function

880

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

881

((function

882

 `String x > Result.Ok x

883

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

884

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

885

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

886

((function

887

 `Int x > Result.Ok x

888

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

889

((fun arg2 >

890

((function

891

 `Int x > Result.Ok x

892

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

893

(fun arg1 >

894

((function

895

 `Null > Result.Ok None

896

 x >

897

((function

898

 `String x > Result.Ok x

899

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

900

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

901

>>=

902

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

903

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

904

((function

905

 `Int x > Result.Ok x

906

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

907

((fun arg1 >

908

((function

909

 `Int x > Result.Ok x

910

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

911

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

912

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

913

((function

914

 `Assoc xs >

915

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

916

match xs with

917

 ("indexes",x)::xs >

918

loop xs

919

(((function

920

 `List xs >

921

map_bind (fun x > vhdl_name_t_of_yojson x)

922

[] xs

923

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

924

x), arg1, arg2)

925

 ("const",x)::xs >

926

loop xs

927

(arg0,

928

((function

929

 `Null > Result.Ok None

930

 x >

931

((fun x > vhdl_constraint_t_of_yojson x) x)

932

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

933

arg2)

934

 ("definition",x)::xs >

935

loop xs

936

(arg0, arg1,

937

((fun x > vhdl_subtype_indication_t_of_yojson x)

938

x))

939

 [] >

940

arg2 >>=

941

((fun arg2 >

942

arg1 >>=

943

(fun arg1 >

944

arg0 >>=

945

(fun arg0 >

946

Result.Ok

947

(Array

948

{

949

indexes = arg0;

950

const = arg1;

951

definition = arg2

952

})))))

953

 _::xs > loop xs _state in

954

loop xs

955

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

956

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

957

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

958

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

959

((function

960

 `List xs >

961

map_bind (fun x > vhdl_element_declaration_t_of_yojson x)

962

[] xs

963

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

964

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

965

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

966

((function

967

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

968

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

969

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

970

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

971

 _ > Result.Error "Vhdl_ast.vhdl_type_t")

972

[@ocaml.warning "A"])

973


974

and (vhdl_element_declaration_t_to_yojson :

975

vhdl_element_declaration_t > Yojson.Safe.json)

976

=

977

((let open! Ppx_deriving_yojson_runtime in

978

fun x >

979

let fields = [] in

980

let fields =

981

("definition",

982

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

983

:: fields in

984

let fields =

985

("names",

986

((fun x >

987

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

988

x.names))

989

:: fields in

990

`Assoc fields)

991

[@ocaml.warning "A"])

992


993

and (vhdl_element_declaration_t_of_yojson :

994

Yojson.Safe.json >

995

vhdl_element_declaration_t Ppx_deriving_yojson_runtime.error_or)

996

=

997

((let open! Ppx_deriving_yojson_runtime in

998

function

999

 `Assoc xs >

1000

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

1001

match xs with

1002

 ("names",x)::xs >

1003

loop xs

1004

(((function

1005

 `List xs >

1006

map_bind (fun x > vhdl_name_t_of_yojson x) [] xs

1007

 _ >

1008

Result.Error

1009

"Vhdl_ast.vhdl_element_declaration_t.names") x),

1010

arg1)

1011

 ("definition",x)::xs >

1012

loop xs

1013

(arg0,

1014

((fun x > vhdl_subtype_indication_t_of_yojson x) x))

1015

 [] >

1016

arg1 >>=

1017

((fun arg1 >

1018

arg0 >>=

1019

(fun arg0 >

1020

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

1021

 _::xs > loop xs _state in

1022

loop xs

1023

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

1024

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

1025

 _ > Result.Error "Vhdl_ast.vhdl_element_declaration_t")

1026

[@ocaml.warning "A"])

1027


1028

and (vhdl_subtype_indication_t_to_yojson :

1029

vhdl_subtype_indication_t > Yojson.Safe.json)

1030

=

1031

((let open! Ppx_deriving_yojson_runtime in

1032

fun x >

1033

let fields = [] in

1034

let fields =

1035

if x.const = NoConstraint

1036

then fields

1037

else

1038

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

1039

:: fields

1040

in

1041

let fields =

1042

if x.functionName = NoName

1043

then fields

1044

else

1045

("functionName",

1046

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

1047

:: fields

1048

in

1049

let fields =

1050

if x.name = NoName

1051

then fields

1052

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

1053

fields

1054

in

1055

`Assoc fields)

1056

[@ocaml.warning "A"])

1057


1058

and (vhdl_subtype_indication_t_of_yojson :

1059

Yojson.Safe.json >

1060

vhdl_subtype_indication_t Ppx_deriving_yojson_runtime.error_or)

1061

=

1062

((let open! Ppx_deriving_yojson_runtime in

1063

function

1064

 `Assoc xs >

1065

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

1066

match xs with

1067

 ("name",x)::xs >

1068

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

1069

 ("functionName",x)::xs >

1070

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

1071

 ("const",x)::xs >

1072

loop xs

1073

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

1074

 [] >

1075

arg2 >>=

1076

((fun arg2 >

1077

arg1 >>=

1078

(fun arg1 >

1079

arg0 >>=

1080

(fun arg0 >

1081

Result.Ok

1082

{

1083

name = arg0;

1084

functionName = arg1;

1085

const = arg2

1086

}))))

1087

 _::xs > loop xs _state in

1088

loop xs

1089

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

1090

(Result.Ok NoConstraint))

1091

 _ > Result.Error "Vhdl_ast.vhdl_subtype_indication_t")

1092

[@ocaml.warning "A"])

1093


1094

and (vhdl_discrete_range_t_to_yojson :

1095

vhdl_discrete_range_t > Yojson.Safe.json)

1096

=

1097

((let open! Ppx_deriving_yojson_runtime in

1098

function

1099

 SubDiscreteRange arg0 >

1100

`List

1101

[`String "SUB_DISCRETE_RANGE";

1102

((fun x > vhdl_subtype_indication_t_to_yojson x)) arg0]

1103

 NamedRange arg0 >

1104

`List

1105

[`String "NAMED_RANGE";

1106

((fun x > vhdl_name_t_to_yojson x)) arg0]

1107

 DirectedRange arg0 >

1108

`List

1109

[`String "RANGE_WITH_DIRECTION";

1110

(let fields = [] in

1111

let fields =

1112

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

1113

fields in

1114

let fields =

1115

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

1116

fields in

1117

let fields =

1118

("direction",

1119

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

1120

arg0.direction))

1121

:: fields in

1122

`Assoc fields)])

1123

[@ocaml.warning "A"])

1124


1125

and (vhdl_discrete_range_t_of_yojson :

1126

Yojson.Safe.json >

1127

vhdl_discrete_range_t Ppx_deriving_yojson_runtime.error_or)

1128

=

1129

((let open! Ppx_deriving_yojson_runtime in

1130

function

1131

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

1132

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

1133

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

1134

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

1135

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

1136

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

1137

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

1138

((function

1139

 `Assoc xs >

1140

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

1141

match xs with

1142

 ("direction",x)::xs >

1143

loop xs

1144

(((function

1145

 `String x > Result.Ok x

1146

 _ >

1147

Result.Error

1148

"Vhdl_ast.vhdl_discrete_range_t.direction")

1149

x), arg1, arg2)

1150

 ("from",x)::xs >

1151

loop xs

1152

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

1153

 ("_to",x)::xs >

1154

loop xs

1155

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

1156

 [] >

1157

arg2 >>=

1158

((fun arg2 >

1159

arg1 >>=

1160

(fun arg1 >

1161

arg0 >>=

1162

(fun arg0 >

1163

Result.Ok

1164

(DirectedRange

1165

{

1166

direction = arg0;

1167

from = arg1;

1168

_to = arg2

1169

})))))

1170

 _::xs > loop xs _state in

1171

loop xs

1172

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

1173

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

1174

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

1175

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

1176

 _ > Result.Error "Vhdl_ast.vhdl_discrete_range_t")

1177

[@ocaml.warning "A"])

1178


1179

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

1180

((let open! Ppx_deriving_yojson_runtime in

1181

function

1182

 RefConstraint arg0 >

1183

`List

1184

[`String "RefConstraint";

1185

(let fields = [] in

1186

let fields =

1187

("ref_name",

1188

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

1189

:: fields in

1190

`Assoc fields)]

1191

 RangeConstraint arg0 >

1192

`List

1193

[`String "RANGE_CONSTRAINT";

1194

(let fields = [] in

1195

let fields =

1196

("range",

1197

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

1198

:: fields in

1199

`Assoc fields)]

1200

 IndexConstraint arg0 >

1201

`List

1202

[`String "INDEX_CONSTRAINT";

1203

(let fields = [] in

1204

let fields =

1205

("ranges",

1206

((fun x >

1207

`List

1208

(List.map

1209

(fun x > vhdl_discrete_range_t_to_yojson x) x))

1210

arg0.ranges))

1211

:: fields in

1212

`Assoc fields)]

1213

 ArrayConstraint arg0 >

1214

`List

1215

[`String "ARRAY_CONSTRAINT";

1216

(let fields = [] in

1217

let fields =

1218

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

1219

:: fields in

1220

let fields =

1221

("ranges",

1222

((fun x >

1223

`List

1224

(List.map

1225

(fun x > vhdl_discrete_range_t_to_yojson x) x))

1226

arg0.ranges))

1227

:: fields in

1228

`Assoc fields)]

1229

 RecordConstraint > `List [`String "RecordConstraint"]

1230

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

1231

[@ocaml.warning "A"])

1232


1233

and (vhdl_constraint_t_of_yojson :

1234

Yojson.Safe.json >

1235

vhdl_constraint_t Ppx_deriving_yojson_runtime.error_or)

1236

=

1237

((let open! Ppx_deriving_yojson_runtime in

1238

function

1239

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

1240

((function

1241

 `Assoc xs >

1242

let rec loop xs (arg0 as _state) =

1243

match xs with

1244

 ("ref_name",x)::xs >

1245

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

1246

 [] >

1247

arg0 >>=

1248

((fun arg0 >

1249

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

1250

 _::xs > loop xs _state in

1251

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

1252

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

1253

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

1254

((function

1255

 `Assoc xs >

1256

let rec loop xs (arg0 as _state) =

1257

match xs with

1258

 ("range",x)::xs >

1259

loop xs

1260

((fun x > vhdl_discrete_range_t_of_yojson x) x)

1261

 [] >

1262

arg0 >>=

1263

((fun arg0 >

1264

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

1265

 _::xs > loop xs _state in

1266

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

1267

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

1268

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

1269

((function

1270

 `Assoc xs >

1271

let rec loop xs (arg0 as _state) =

1272

match xs with

1273

 ("ranges",x)::xs >

1274

loop xs

1275

((function

1276

 `List xs >

1277

map_bind

1278

(fun x > vhdl_discrete_range_t_of_yojson x)

1279

[] xs

1280

 _ >

1281

Result.Error

1282

"Vhdl_ast.vhdl_constraint_t.ranges") x)

1283

 [] >

1284

arg0 >>=

1285

((fun arg0 >

1286

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

1287

 _::xs > loop xs _state in

1288

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

1289

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

1290

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

1291

((function

1292

 `Assoc xs >

1293

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

1294

match xs with

1295

 ("ranges",x)::xs >

1296

loop xs

1297

(((function

1298

 `List xs >

1299

map_bind

1300

(fun x > vhdl_discrete_range_t_of_yojson x)

1301

[] xs

1302

 _ >

1303

Result.Error

1304

"Vhdl_ast.vhdl_constraint_t.ranges") x),

1305

arg1)

1306

 ("sub",x)::xs >

1307

loop xs

1308

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

1309

 [] >

1310

arg1 >>=

1311

((fun arg1 >

1312

arg0 >>=

1313

(fun arg0 >

1314

Result.Ok

1315

(ArrayConstraint

1316

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

1317

 _::xs > loop xs _state in

1318

loop xs

1319

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

1320

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

1321

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

1322

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

1323

Result.Ok RecordConstraint

1324

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

1325

 _ > Result.Error "Vhdl_ast.vhdl_constraint_t")

1326

[@ocaml.warning "A"])

1327


1328

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

1329

((let open! Ppx_deriving_yojson_runtime in

1330

function

1331

 Type arg0 >

1332

`List

1333

[`String "TYPE_DECLARATION";

1334

(let fields = [] in

1335

let fields =

1336

("definition",

1337

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

1338

:: fields in

1339

let fields =

1340

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

1341

fields in

1342

`Assoc fields)]

1343

 Subtype arg0 >

1344

`List

1345

[`String "SUBTYPE_DECLARATION";

1346

(let fields = [] in

1347

let fields =

1348

("typ",

1349

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

1350

:: fields in

1351

let fields =

1352

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

1353

fields in

1354

`Assoc fields)])

1355

[@ocaml.warning "A"])

1356


1357

and (vhdl_definition_t_of_yojson :

1358

Yojson.Safe.json >

1359

vhdl_definition_t Ppx_deriving_yojson_runtime.error_or)

1360

=

1361

((let open! Ppx_deriving_yojson_runtime in

1362

function

1363

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

1364

((function

1365

 `Assoc xs >

1366

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

1367

match xs with

1368

 ("name",x)::xs >

1369

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

1370

 ("definition",x)::xs >

1371

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

1372

 [] >

1373

arg1 >>=

1374

((fun arg1 >

1375

arg0 >>=

1376

(fun arg0 >

1377

Result.Ok

1378

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

1379

 _::xs > loop xs _state in

1380

loop xs

1381

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

1382

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

1383

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

1384

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

1385

((function

1386

 `Assoc xs >

1387

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

1388

match xs with

1389

 ("name",x)::xs >

1390

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

1391

 ("typ",x)::xs >

1392

loop xs

1393

(arg0,

1394

((fun x > vhdl_subtype_indication_t_of_yojson x)

1395

x))

1396

 [] >

1397

arg1 >>=

1398

((fun arg1 >

1399

arg0 >>=

1400

(fun arg0 >

1401

Result.Ok

1402

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

1403

 _::xs > loop xs _state in

1404

loop xs

1405

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

1406

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

1407

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

1408

 _ > Result.Error "Vhdl_ast.vhdl_definition_t")

1409

[@ocaml.warning "A"])

1410


1411

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

1412

((let open! Ppx_deriving_yojson_runtime in

1413

function

1414

 Call arg0 >

1415

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

1416

 Cst arg0 >

1417

`List

1418

[`String "CONSTANT_VALUE";

1419

(let fields = [] in

1420

let fields =

1421

if arg0.unit_name = None

1422

then fields

1423

else

1424

("unit_name",

1425

(((function

1426

 None > `Null

1427

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

1428

arg0.unit_name))

1429

:: fields

1430

in

1431

let fields =

1432

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

1433

:: fields in

1434

`Assoc fields)]

1435

 Op arg0 >

1436

`List

1437

[`String "EXPRESSION";

1438

(let fields = [] in

1439

let fields =

1440

if arg0.args = []

1441

then fields

1442

else

1443

("args",

1444

(((fun x >

1445

`List

1446

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

1447

arg0.args))

1448

:: fields

1449

in

1450

let fields =

1451

if arg0.id = ""

1452

then fields

1453

else

1454

("id",

1455

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

1456

arg0.id))

1457

:: fields

1458

in

1459

`Assoc fields)]

1460

 IsNull > `List [`String "IsNull"]

1461

 Time arg0 >

1462

`List

1463

[`String "Time";

1464

(let fields = [] in

1465

let fields =

1466

if arg0.phy_unit = ""

1467

then fields

1468

else

1469

("phy_unit",

1470

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

1471

arg0.phy_unit))

1472

:: fields

1473

in

1474

let fields =

1475

("value",

1476

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

1477

:: fields in

1478

`Assoc fields)]

1479

 Sig arg0 >

1480

`List

1481

[`String "Sig";

1482

(let fields = [] in

1483

let fields =

1484

("att",

1485

((function

1486

 None > `Null

1487

 Some x >

1488

((fun x > vhdl_signal_attributes_t_to_yojson x)) x)

1489

arg0.att))

1490

:: fields in

1491

let fields =

1492

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

1493

fields in

1494

`Assoc fields)]

1495

 SuffixMod arg0 >

1496

`List

1497

[`String "SuffixMod";

1498

(let fields = [] in

1499

let fields =

1500

("selection",

1501

((fun x > vhdl_suffix_selection_t_to_yojson x)

1502

arg0.selection))

1503

:: fields in

1504

let fields =

1505

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

1506

fields in

1507

`Assoc fields)]

1508

 Aggregate arg0 >

1509

`List

1510

[`String "AGGREGATE";

1511

(let fields = [] in

1512

let fields =

1513

("elems",

1514

((fun x >

1515

`List

1516

(List.map (fun x > vhdl_element_assoc_t_to_yojson x)

1517

x)) arg0.elems))

1518

:: fields in

1519

`Assoc fields)]

1520

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

1521

[@ocaml.warning "A"])

1522


1523

and (vhdl_expr_t_of_yojson :

1524

Yojson.Safe.json > vhdl_expr_t Ppx_deriving_yojson_runtime.error_or)

1525

=

1526

((let open! Ppx_deriving_yojson_runtime in

1527

function

1528

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

1529

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

1530

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

1531

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

1532

((function

1533

 `Assoc xs >

1534

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

1535

match xs with

1536

 ("value",x)::xs >

1537

loop xs

1538

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

1539

 ("unit_name",x)::xs >

1540

loop xs

1541

(arg0,

1542

((function

1543

 `Null > Result.Ok None

1544

 x >

1545

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

1546

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

1547

 [] >

1548

arg1 >>=

1549

((fun arg1 >

1550

arg0 >>=

1551

(fun arg0 >

1552

Result.Ok

1553

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

1554

 _::xs > loop xs _state in

1555

loop xs

1556

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

1557

(Result.Ok None))

1558

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

1559

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

1560

((function

1561

 `Assoc xs >

1562

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

1563

match xs with

1564

 ("id",x)::xs >

1565

loop xs

1566

(((function

1567

 `String x > Result.Ok x

1568

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

1569

arg1)

1570

 ("args",x)::xs >

1571

loop xs

1572

(arg0,

1573

((function

1574

 `List xs >

1575

map_bind (fun x > vhdl_expr_t_of_yojson x)

1576

[] xs

1577

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

1578

x))

1579

 [] >

1580

arg1 >>=

1581

((fun arg1 >

1582

arg0 >>=

1583

(fun arg0 >

1584

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

1585

 _::xs > loop xs _state in

1586

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

1587

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

1588

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

1589

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

1590

((function

1591

 `Assoc xs >

1592

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

1593

match xs with

1594

 ("value",x)::xs >

1595

loop xs

1596

(((function

1597

 `Int x > Result.Ok x

1598

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

1599

x), arg1)

1600

 ("phy_unit",x)::xs >

1601

loop xs

1602

(arg0,

1603

((function

1604

 `String x > Result.Ok x

1605

 _ >

1606

Result.Error "Vhdl_ast.vhdl_expr_t.phy_unit")

1607

x))

1608

 [] >

1609

arg1 >>=

1610

((fun arg1 >

1611

arg0 >>=

1612

(fun arg0 >

1613

Result.Ok

1614

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

1615

 _::xs > loop xs _state in

1616

loop xs

1617

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

1618

(Result.Ok ""))

1619

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

1620

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

1621

((function

1622

 `Assoc xs >

1623

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

1624

match xs with

1625

 ("name",x)::xs >

1626

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

1627

 ("att",x)::xs >

1628

loop xs

1629

(arg0,

1630

((function

1631

 `Null > Result.Ok None

1632

 x >

1633

((fun x >

1634

vhdl_signal_attributes_t_of_yojson x) x)

1635

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

1636

 [] >

1637

arg1 >>=

1638

((fun arg1 >

1639

arg0 >>=

1640

(fun arg0 >

1641

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

1642

 _::xs > loop xs _state in

1643

loop xs

1644

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

1645

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

1646

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

1647

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

1648

((function

1649

 `Assoc xs >

1650

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

1651

match xs with

1652

 ("expr",x)::xs >

1653

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

1654

 ("selection",x)::xs >

1655

loop xs

1656

(arg0,

1657

((fun x > vhdl_suffix_selection_t_of_yojson x) x))

1658

 [] >

1659

arg1 >>=

1660

((fun arg1 >

1661

arg0 >>=

1662

(fun arg0 >

1663

Result.Ok

1664

(SuffixMod

1665

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

1666

 _::xs > loop xs _state in

1667

loop xs

1668

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

1669

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

1670

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

1671

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

1672

((function

1673

 `Assoc xs >

1674

let rec loop xs (arg0 as _state) =

1675

match xs with

1676

 ("elems",x)::xs >

1677

loop xs

1678

((function

1679

 `List xs >

1680

map_bind

1681

(fun x > vhdl_element_assoc_t_of_yojson x)

1682

[] xs

1683

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

1684

 [] >

1685

arg0 >>=

1686

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

1687

 _::xs > loop xs _state in

1688

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

1689

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

1690

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

1691

 _ > Result.Error "Vhdl_ast.vhdl_expr_t")

1692

[@ocaml.warning "A"])

1693


1694

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

1695

((let open! Ppx_deriving_yojson_runtime in

1696

function

1697

 Simple arg0 >

1698

`List

1699

[`String "SIMPLE_NAME";

1700

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

1701

 Identifier arg0 >

1702

`List

1703

[`String "IDENTIFIER";

1704

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

1705

 Selected arg0 >

1706

`List

1707

[`String "SELECTED_NAME";

1708

((fun x >

1709

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

1710

 Index arg0 >

1711

`List

1712

[`String "INDEXED_NAME";

1713

(let fields = [] in

1714

let fields =

1715

("exprs",

1716

((fun x >

1717

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

1718

arg0.exprs))

1719

:: fields in

1720

let fields =

1721

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

1722

fields in

1723

`Assoc fields)]

1724

 Slice arg0 >

1725

`List

1726

[`String "SLICE_NAME";

1727

(let fields = [] in

1728

let fields =

1729

("range",

1730

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

1731

:: fields in

1732

let fields =

1733

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

1734

fields in

1735

`Assoc fields)]

1736

 Attribute arg0 >

1737

`List

1738

[`String "ATTRIBUTE_NAME";

1739

(let fields = [] in

1740

let fields =

1741

if arg0.expr = IsNull

1742

then fields

1743

else

1744

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

1745

:: fields

1746

in

1747

let fields =

1748

("designator",

1749

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

1750

:: fields in

1751

let fields =

1752

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

1753

fields in

1754

`Assoc fields)]

1755

 Function arg0 >

1756

`List

1757

[`String "FUNCTION_CALL";

1758

(let fields = [] in

1759

let fields =

1760

("assoc_list",

1761

((fun x >

1762

`List

1763

(List.map (fun x > vhdl_assoc_element_t_to_yojson x)

1764

x)) arg0.assoc_list))

1765

:: fields in

1766

let fields =

1767

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

1768

fields in

1769

`Assoc fields)]

1770

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

1771

[@ocaml.warning "A"])

1772


1773

and (vhdl_name_t_of_yojson :

1774

Yojson.Safe.json > vhdl_name_t Ppx_deriving_yojson_runtime.error_or)

1775

=

1776

((let open! Ppx_deriving_yojson_runtime in

1777

function

1778

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

1779

((function

1780

 `String x > Result.Ok x

1781

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

1782

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

1783

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

1784

((function

1785

 `String x > Result.Ok x

1786

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

1787

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

1788

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

1789

((function

1790

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

1791

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

1792

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

1793

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

1794

((function

1795

 `Assoc xs >

1796

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

1797

match xs with

1798

 ("id",x)::xs >

1799

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

1800

 ("exprs",x)::xs >

1801

loop xs

1802

(arg0,

1803

((function

1804

 `List xs >

1805

map_bind (fun x > vhdl_expr_t_of_yojson x)

1806

[] xs

1807

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

1808

x))

1809

 [] >

1810

arg1 >>=

1811

((fun arg1 >

1812

arg0 >>=

1813

(fun arg0 >

1814

Result.Ok

1815

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

1816

 _::xs > loop xs _state in

1817

loop xs

1818

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

1819

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

1820

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

1821

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

1822

((function

1823

 `Assoc xs >

1824

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

1825

match xs with

1826

 ("id",x)::xs >

1827

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

1828

 ("range",x)::xs >

1829

loop xs

1830

(arg0,

1831

((fun x > vhdl_discrete_range_t_of_yojson x) x))

1832

 [] >

1833

arg1 >>=

1834

((fun arg1 >

1835

arg0 >>=

1836

(fun arg0 >

1837

Result.Ok

1838

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

1839

 _::xs > loop xs _state in

1840

loop xs

1841

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

1842

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

1843

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

1844

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

1845

((function

1846

 `Assoc xs >

1847

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

1848

match xs with

1849

 ("id",x)::xs >

1850

loop xs

1851

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

1852

 ("designator",x)::xs >

1853

loop xs

1854

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

1855

 ("expr",x)::xs >

1856

loop xs

1857

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

1858

 [] >

1859

arg2 >>=

1860

((fun arg2 >

1861

arg1 >>=

1862

(fun arg1 >

1863

arg0 >>=

1864

(fun arg0 >

1865

Result.Ok

1866

(Attribute

1867

{

1868

id = arg0;

1869

designator = arg1;

1870

expr = arg2

1871

})))))

1872

 _::xs > loop xs _state in

1873

loop xs

1874

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

1875

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

1876

(Result.Ok IsNull))

1877

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

1878

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

1879

((function

1880

 `Assoc xs >

1881

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

1882

match xs with

1883

 ("id",x)::xs >

1884

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

1885

 ("assoc_list",x)::xs >

1886

loop xs

1887

(arg0,

1888

((function

1889

 `List xs >

1890

map_bind

1891

(fun x > vhdl_assoc_element_t_of_yojson x)

1892

[] xs

1893

 _ >

1894

Result.Error

1895

"Vhdl_ast.vhdl_name_t.assoc_list") x))

1896

 [] >

1897

arg1 >>=

1898

((fun arg1 >

1899

arg0 >>=

1900

(fun arg0 >

1901

Result.Ok

1902

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

1903

 _::xs > loop xs _state in

1904

loop xs

1905

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

1906

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

1907

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

1908

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

1909

 _ > Result.Error "Vhdl_ast.vhdl_name_t")

1910

[@ocaml.warning "A"])

1911


1912

and (vhdl_assoc_element_t_to_yojson :

1913

vhdl_assoc_element_t > Yojson.Safe.json)

1914

=

1915

((let open! Ppx_deriving_yojson_runtime in

1916

fun x >

1917

let fields = [] in

1918

let fields =

1919

if x.actual_expr = None

1920

then fields

1921

else

1922

("actual_expr",

1923

(((function

1924

 None > `Null

1925

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

1926

x.actual_expr))

1927

:: fields

1928

in

1929

let fields =

1930

if x.actual_designator = None

1931

then fields

1932

else

1933

("actual_designator",

1934

(((function

1935

 None > `Null

1936

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

1937

x.actual_designator))

1938

:: fields

1939

in

1940

let fields =

1941

if x.actual_name = None

1942

then fields

1943

else

1944

("actual_name",

1945

(((function

1946

 None > `Null

1947

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

1948

x.actual_name))

1949

:: fields

1950

in

1951

let fields =

1952

if x.formal_arg = None

1953

then fields

1954

else

1955

("formal_arg",

1956

(((function

1957

 None > `Null

1958

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

1959

x.formal_arg))

1960

:: fields

1961

in

1962

let fields =

1963

if x.formal_name = None

1964

then fields

1965

else

1966

("formal_name",

1967

(((function

1968

 None > `Null

1969

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

1970

x.formal_name))

1971

:: fields

1972

in

1973

`Assoc fields)

1974

[@ocaml.warning "A"])

1975


1976

and (vhdl_assoc_element_t_of_yojson :

1977

Yojson.Safe.json >

1978

vhdl_assoc_element_t Ppx_deriving_yojson_runtime.error_or)

1979

=

1980

((let open! Ppx_deriving_yojson_runtime in

1981

function

1982

 `Assoc xs >

1983

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

1984

match xs with

1985

 ("formal_name",x)::xs >

1986

loop xs

1987

(((function

1988

 `Null > Result.Ok None

1989

 x >

1990

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

1991

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

1992

arg3, arg4)

1993

 ("formal_arg",x)::xs >

1994

loop xs

1995

(arg0,

1996

((function

1997

 `Null > Result.Ok None

1998

 x >

1999

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

2000

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

2001

arg4)

2002

 ("actual_name",x)::xs >

2003

loop xs

2004

(arg0, arg1,

2005

((function

2006

 `Null > Result.Ok None

2007

 x >

2008

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

2009

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

2010

 ("actual_designator",x)::xs >

2011

loop xs

2012

(arg0, arg1, arg2,

2013

((function

2014

 `Null > Result.Ok None

2015

 x >

2016

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

2017

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

2018

 ("actual_expr",x)::xs >

2019

loop xs

2020

(arg0, arg1, arg2, arg3,

2021

((function

2022

 `Null > Result.Ok None

2023

 x >

2024

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

2025

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

2026

 [] >

2027

arg4 >>=

2028

((fun arg4 >

2029

arg3 >>=

2030

(fun arg3 >

2031

arg2 >>=

2032

(fun arg2 >

2033

arg1 >>=

2034

(fun arg1 >

2035

arg0 >>=

2036

(fun arg0 >

2037

Result.Ok

2038

{

2039

formal_name = arg0;

2040

formal_arg = arg1;

2041

actual_name = arg2;

2042

actual_designator = arg3;

2043

actual_expr = arg4

2044

}))))))

2045

 _::xs > loop xs _state in

2046

loop xs

2047

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

2048

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

2049

(Result.Ok (Some IsNull)))

2050

 _ > Result.Error "Vhdl_ast.vhdl_assoc_element_t")

2051

[@ocaml.warning "A"])

2052


2053

and (vhdl_element_assoc_t_to_yojson :

2054

vhdl_element_assoc_t > Yojson.Safe.json)

2055

=

2056

((let open! Ppx_deriving_yojson_runtime in

2057

fun x >

2058

let fields = [] in

2059

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

2060

:: fields in

2061

let fields =

2062

if x.choices = []

2063

then fields

2064

else

2065

("choices",

2066

(((fun x >

2067

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

2068

x.choices))

2069

:: fields

2070

in

2071

`Assoc fields)

2072

[@ocaml.warning "A"])

2073


2074

and (vhdl_element_assoc_t_of_yojson :

2075

Yojson.Safe.json >

2076

vhdl_element_assoc_t Ppx_deriving_yojson_runtime.error_or)

2077

=

2078

((let open! Ppx_deriving_yojson_runtime in

2079

function

2080

 `Assoc xs >

2081

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

2082

match xs with

2083

 ("choices",x)::xs >

2084

loop xs

2085

(((function

2086

 `List xs >

2087

map_bind (fun x > vhdl_expr_t_of_yojson x) [] xs

2088

 _ >

2089

Result.Error "Vhdl_ast.vhdl_element_assoc_t.choices")

2090

x), arg1)

2091

 ("expr",x)::xs >

2092

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

2093

 [] >

2094

arg1 >>=

2095

((fun arg1 >

2096

arg0 >>=

2097

(fun arg0 >

2098

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

2099

 _::xs > loop xs _state in

2100

loop xs

2101

((Result.Ok []),

2102

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

2103

 _ > Result.Error "Vhdl_ast.vhdl_element_assoc_t")

2104

[@ocaml.warning "A"])

2105


2106

and (vhdl_array_attributes_t_to_yojson :

2107

vhdl_array_attributes_t > Yojson.Safe.json)

2108

=

2109

((let open! Ppx_deriving_yojson_runtime in

2110

function

2111

 AAttInt arg0 >

2112

`List

2113

[`String "AAttInt";

2114

(let fields = [] in

2115

let fields =

2116

("arg",

2117

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

2118

:: fields in

2119

let fields =

2120

("id",

2121

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

2122

arg0.id))

2123

:: fields in

2124

`Assoc fields)]

2125

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

2126

[@ocaml.warning "A"])

2127


2128

and (vhdl_array_attributes_t_of_yojson :

2129

Yojson.Safe.json >

2130

vhdl_array_attributes_t Ppx_deriving_yojson_runtime.error_or)

2131

=

2132

((let open! Ppx_deriving_yojson_runtime in

2133

function

2134

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

2135

((function

2136

 `Assoc xs >

2137

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

2138

match xs with

2139

 ("id",x)::xs >

2140

loop xs

2141

(((function

2142

 `String x > Result.Ok x

2143

 _ >

2144

Result.Error

2145

"Vhdl_ast.vhdl_array_attributes_t.id") x),

2146

arg1)

2147

 ("arg",x)::xs >

2148

loop xs

2149

(arg0,

2150

((function

2151

 `Int x > Result.Ok x

2152

 _ >

2153

Result.Error

2154

"Vhdl_ast.vhdl_array_attributes_t.arg") x))

2155

 [] >

2156

arg1 >>=

2157

((fun arg1 >

2158

arg0 >>=

2159

(fun arg0 >

2160

Result.Ok

2161

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

2162

 _::xs > loop xs _state in

2163

loop xs

2164

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

2165

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

2166

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

2167

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

2168

 _ > Result.Error "Vhdl_ast.vhdl_array_attributes_t")

2169

[@ocaml.warning "A"])

2170


2171

and (vhdl_signal_attributes_t_to_yojson :

2172

vhdl_signal_attributes_t > Yojson.Safe.json)

2173

=

2174

((let open! Ppx_deriving_yojson_runtime in

2175

function

2176

 SigAtt arg0 >

2177

`List

2178

[`String "SigAtt";

2179

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

2180

[@ocaml.warning "A"])

2181


2182

and (vhdl_signal_attributes_t_of_yojson :

2183

Yojson.Safe.json >

2184

vhdl_signal_attributes_t Ppx_deriving_yojson_runtime.error_or)

2185

=

2186

((let open! Ppx_deriving_yojson_runtime in

2187

function

2188

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

2189

((function

2190

 `String x > Result.Ok x

2191

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

2192

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

2193

 _ > Result.Error "Vhdl_ast.vhdl_signal_attributes_t")

2194

[@ocaml.warning "A"])

2195


2196

and (vhdl_string_attributes_t_to_yojson :

2197

vhdl_string_attributes_t > Yojson.Safe.json)

2198

=

2199

((let open! Ppx_deriving_yojson_runtime in

2200

function

2201

 StringAtt arg0 >

2202

`List

2203

[`String "StringAtt";

2204

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

2205

[@ocaml.warning "A"])

2206


2207

and (vhdl_string_attributes_t_of_yojson :

2208

Yojson.Safe.json >

2209

vhdl_string_attributes_t Ppx_deriving_yojson_runtime.error_or)

2210

=

2211

((let open! Ppx_deriving_yojson_runtime in

2212

function

2213

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

2214

((function

2215

 `String x > Result.Ok x

2216

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

2217

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

2218

 _ > Result.Error "Vhdl_ast.vhdl_string_attributes_t")

2219

[@ocaml.warning "A"])

2220


2221

and (vhdl_suffix_selection_t_to_yojson :

2222

vhdl_suffix_selection_t > Yojson.Safe.json)

2223

=

2224

((let open! Ppx_deriving_yojson_runtime in

2225

function

2226

 Idx arg0 >

2227

`List

2228

[`String "Idx";

2229

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

2230

 SuffixRange (arg0,arg1) >

2231

`List

2232

[`String "SuffixRange";

2233

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

2234

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

2235

[@ocaml.warning "A"])

2236


2237

and (vhdl_suffix_selection_t_of_yojson :

2238

Yojson.Safe.json >

2239

vhdl_suffix_selection_t Ppx_deriving_yojson_runtime.error_or)

2240

=

2241

((let open! Ppx_deriving_yojson_runtime in

2242

function

2243

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

2244

((function

2245

 `Int x > Result.Ok x

2246

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

2247

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

2248

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

2249

((function

2250

 `Int x > Result.Ok x

2251

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

2252

((fun arg1 >

2253

((function

2254

 `Int x > Result.Ok x

2255

 _ > Result.Error "Vhdl_ast.vhdl_suffix_selection_t")

2256

arg0)

2257

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

2258

 _ > Result.Error "Vhdl_ast.vhdl_suffix_selection_t")

2259

[@ocaml.warning "A"])

2260


2261

type 'basetype vhdl_type_attributes_t =

2262

 TAttNoArg of {

2263

id: string }

2264

 TAttIntArg of {

2265

id: string ;

2266

arg: int }

2267

 TAttValArg of {

2268

id: string ;

2269

arg: 'basetype }

2270

 TAttStringArg of {

2271

id: string ;

2272

arg: string }

2273


2274

(* TODO *)

2275

let rec pp_vhdl_type_attributes_t

2276

=

2277

((let open! Ppx_deriving_runtime in

2278

fun poly_basetype >

2279

fun fmt >

2280

function

2281

 TAttNoArg { id = aid } >

2282

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

2283

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

2284

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

2285

Format.fprintf fmt "@]");

2286

Format.fprintf fmt "@]}")

2287

 TAttIntArg { id = aid; arg = aarg } >

2288

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

2289

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

2290

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

2291

Format.fprintf fmt "@]");

2292

Format.fprintf fmt ";@ ";

2293

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

2294

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

2295

Format.fprintf fmt "@]");

2296

Format.fprintf fmt "@]}")

2297

 TAttValArg { id = aid; arg = aarg } >

2298

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

2299

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

2300

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

2301

Format.fprintf fmt "@]");

2302

Format.fprintf fmt ";@ ";

2303

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

2304

(poly_basetype fmt) aarg;

2305

Format.fprintf fmt "@]");

2306

Format.fprintf fmt "@]}")

2307

 TAttStringArg { id = aid; arg = aarg } >

2308

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

2309

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

2310

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

2311

Format.fprintf fmt "@]");

2312

Format.fprintf fmt ";@ ";

2313

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

2314

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

2315

Format.fprintf fmt "@]");

2316

Format.fprintf fmt "@]}"))

2317

[@ocaml.warning "A"])

2318


2319

and show_vhdl_type_attributes_t =

2320

fun poly_basetype >

2321

fun x >

2322

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

2323


2324

let rec vhdl_type_attributes_t_to_yojson :

2325

'basetype .

2326

('basetype > Yojson.Safe.json) >

2327

'basetype vhdl_type_attributes_t > Yojson.Safe.json

2328

=

2329

fun poly_basetype >

2330

((let open! Ppx_deriving_yojson_runtime in

2331

function

2332

 TAttNoArg arg0 >

2333

`List

2334

[`String "TAttNoArg";

2335

(let fields = [] in

2336

let fields =

2337

("id",

2338

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

2339

arg0.id))

2340

:: fields in

2341

`Assoc fields)]

2342

 TAttIntArg arg0 >

2343

`List

2344

[`String "TAttIntArg";

2345

(let fields = [] in

2346

let fields =

2347

("arg",

2348

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

2349

:: fields in

2350

let fields =

2351

("id",

2352

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

2353

arg0.id))

2354

:: fields in

2355

`Assoc fields)]

2356

 TAttValArg arg0 >

2357

`List

2358

[`String "TAttValArg";

2359

(let fields = [] in

2360

let fields =

2361

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

2362

:: fields in

2363

let fields =

2364

("id",

2365

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

2366

arg0.id))

2367

:: fields in

2368

`Assoc fields)]

2369

 TAttStringArg arg0 >

2370

`List

2371

[`String "TAttStringArg";

2372

(let fields = [] in

2373

let fields =

2374

("arg",

2375

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

2376

arg0.arg))

2377

:: fields in

2378

let fields =

2379

("id",

2380

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

2381

arg0.id))

2382

:: fields in

2383

`Assoc fields)])

2384

[@ocaml.warning "A"])

2385


2386

and vhdl_type_attributes_t_of_yojson :

2387

'basetype .

2388

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

2389

Yojson.Safe.json >

2390

'basetype vhdl_type_attributes_t Ppx_deriving_yojson_runtime.error_or

2391

=

2392

fun poly_basetype >

2393

((let open! Ppx_deriving_yojson_runtime in

2394

function

2395

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

2396

((function

2397

 `Assoc xs >

2398

let rec loop xs (arg0 as _state) =

2399

match xs with

2400

 ("id",x)::xs >

2401

loop xs

2402

((function

2403

 `String x > Result.Ok x

2404

 _ >

2405

Result.Error

2406

"Vhdl_ast.vhdl_type_attributes_t.id") x)

2407

 [] >

2408

arg0 >>=

2409

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

2410

 _::xs > loop xs _state in

2411

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

2412

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

2413

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

2414

((function

2415

 `Assoc xs >

2416

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

2417

match xs with

2418

 ("id",x)::xs >

2419

loop xs

2420

(((function

2421

 `String x > Result.Ok x

2422

 _ >

2423

Result.Error

2424

"Vhdl_ast.vhdl_type_attributes_t.id") x),

2425

arg1)

2426

 ("arg",x)::xs >

2427

loop xs

2428

(arg0,

2429

((function

2430

 `Int x > Result.Ok x

2431

 _ >

2432

Result.Error

2433

"Vhdl_ast.vhdl_type_attributes_t.arg") x))

2434

 [] >

2435

arg1 >>=

2436

((fun arg1 >

2437

arg0 >>=

2438

(fun arg0 >

2439

Result.Ok

2440

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

2441

 _::xs > loop xs _state in

2442

loop xs

2443

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

2444

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

2445

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

2446

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

2447

((function

2448

 `Assoc xs >

2449

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

2450

match xs with

2451

 ("id",x)::xs >

2452

loop xs

2453

(((function

2454

 `String x > Result.Ok x

2455

 _ >

2456

Result.Error

2457

"Vhdl_ast.vhdl_type_attributes_t.id") x),

2458

arg1)

2459

 ("arg",x)::xs >

2460

loop xs

2461

(arg0,

2462

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

2463

x))

2464

 [] >

2465

arg1 >>=

2466

((fun arg1 >

2467

arg0 >>=

2468

(fun arg0 >

2469

Result.Ok

2470

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

2471

 _::xs > loop xs _state in

2472

loop xs

2473

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

2474

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

2475

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

2476

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

2477

((function

2478

 `Assoc xs >

2479

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

2480

match xs with

2481

 ("id",x)::xs >

2482

loop xs

2483

(((function

2484

 `String x > Result.Ok x

2485

 _ >

2486

Result.Error

2487

"Vhdl_ast.vhdl_type_attributes_t.id") x),

2488

arg1)

2489

 ("arg",x)::xs >

2490

loop xs

2491

(arg0,

2492

((function

2493

 `String x > Result.Ok x

2494

 _ >

2495

Result.Error

2496

"Vhdl_ast.vhdl_type_attributes_t.arg") x))

2497

 [] >

2498

arg1 >>=

2499

((fun arg1 >

2500

arg0 >>=

2501

(fun arg0 >

2502

Result.Ok

2503

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

2504

 _::xs > loop xs _state in

2505

loop xs

2506

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

2507

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

2508

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

2509

 _ > Result.Error "Vhdl_ast.vhdl_type_attributes_t")

2510

[@ocaml.warning "A"])

2511


2512

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

2513

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

2514

let typ_att_valarg = ["image"]

2515

let typ_att_stringarg = ["value"]

2516

let array_att_intarg =

2517

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

2518

type vhdl_parameter_t =

2519

{

2520

names: vhdl_name_t list ;

2521

mode: string list [@default []];

2522

typ: vhdl_subtype_indication_t ;

2523

init_val: vhdl_cst_val_t option [@default None]}

2524


2525

(* TODO *)

2526

let rec pp_vhdl_parameter_t :

2527

Format.formatter > vhdl_parameter_t > Ppx_deriving_runtime.unit =

2528

let __2 () = pp_vhdl_cst_val_t

2529


2530

and __1 () = pp_vhdl_subtype_indication_t

2531


2532

and __0 () = pp_vhdl_name_t

2533

in

2534

((let open! Ppx_deriving_runtime in

2535

fun fmt >

2536

fun x >

2537

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

2538

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

2539

((fun x >

2540

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

2541

ignore

2542

(List.fold_left

2543

(fun sep >

2544

fun x >

2545

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

2546

((__0 ()) fmt) x;

2547

true) false x);

2548

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

2549

Format.fprintf fmt "@]");

2550

Format.fprintf fmt ";@ ";

2551

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

2552

((fun x >

2553

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

2554

ignore

2555

(List.fold_left

2556

(fun sep >

2557

fun x >

2558

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

2559

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

2560

true) false x);

2561

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

2562

Format.fprintf fmt "@]");

2563

Format.fprintf fmt ";@ ";

2564

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

2565

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

2566

Format.fprintf fmt "@]");

2567

Format.fprintf fmt ";@ ";

2568

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

2569

((function

2570

 None > Format.pp_print_string fmt "None"

2571

 Some x >

2572

(Format.pp_print_string fmt "(Some ";

2573

((__2 ()) fmt) x;

2574

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

2575

Format.fprintf fmt "@]");

2576

Format.fprintf fmt "@ }@]")

2577

[@ocaml.warning "A"])

2578


2579

and show_vhdl_parameter_t : vhdl_parameter_t > Ppx_deriving_runtime.string =

2580

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

2581


2582

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

2583

((let open! Ppx_deriving_yojson_runtime in

2584

fun x >

2585

let fields = [] in

2586

let fields =

2587

if x.init_val = None

2588

then fields

2589

else

2590

("init_val",

2591

(((function

2592

 None > `Null

2593

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

2594

x.init_val))

2595

:: fields

2596

in

2597

let fields =

2598

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

2599

:: fields in

2600

let fields =

2601

if x.mode = []

2602

then fields

2603

else

2604

("mode",

2605

(((fun x >

2606

`List

2607

(List.map

2608

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

2609

x))) x.mode))

2610

:: fields

2611

in

2612

let fields =

2613

("names",

2614

((fun x >

2615

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

2616

x.names))

2617

:: fields in

2618

`Assoc fields)

2619

[@ocaml.warning "A"])

2620


2621

and (vhdl_parameter_t_of_yojson :

2622

Yojson.Safe.json >

2623

vhdl_parameter_t Ppx_deriving_yojson_runtime.error_or)

2624

=

2625

((let open! Ppx_deriving_yojson_runtime in

2626

function

2627

 `Assoc xs >

2628

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

2629

match xs with

2630

 ("names",x)::xs >

2631

loop xs

2632

(((function

2633

 `List xs >

2634

map_bind (fun x > vhdl_name_t_of_yojson x) [] xs

2635

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

2636

arg1, arg2, arg3)

2637

 ("mode",x)::xs >

2638

loop xs

2639

(arg0,

2640

((function

2641

 `List xs >

2642

map_bind

2643

(function

2644

 `String x > Result.Ok x

2645

 _ >

2646

Result.Error

2647

"Vhdl_ast.vhdl_parameter_t.mode") [] xs

2648

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

2649

arg2, arg3)

2650

 ("typ",x)::xs >

2651

loop xs

2652

(arg0, arg1,

2653

((fun x > vhdl_subtype_indication_t_of_yojson x) x),

2654

arg3)

2655

 ("init_val",x)::xs >

2656

loop xs

2657

(arg0, arg1, arg2,

2658

((function

2659

 `Null > Result.Ok None

2660

 x >

2661

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

2662

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

2663

 [] >

2664

arg3 >>=

2665

((fun arg3 >

2666

arg2 >>=

2667

(fun arg2 >

2668

arg1 >>=

2669

(fun arg1 >

2670

arg0 >>=

2671

(fun arg0 >

2672

Result.Ok

2673

{

2674

names = arg0;

2675

mode = arg1;

2676

typ = arg2;

2677

init_val = arg3

2678

})))))

2679

 _::xs > loop xs _state in

2680

loop xs

2681

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

2682

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

2683

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

2684

 _ > Result.Error "Vhdl_ast.vhdl_parameter_t")

2685

[@ocaml.warning "A"])

2686


2687

type vhdl_subprogram_spec_t =

2688

{

2689

name: string [@default ""];

2690

subprogram_type: string [@default ""];

2691

typeMark: vhdl_name_t [@default NoName];

2692

parameters: vhdl_parameter_t list ;

2693

isPure: bool [@default false]}

2694


2695

(* TODO *)

2696

let rec pp_vhdl_subprogram_spec_t :

2697

Format.formatter > vhdl_subprogram_spec_t > Ppx_deriving_runtime.unit =

2698

let __1 () = pp_vhdl_parameter_t

2699


2700

and __0 () = pp_vhdl_name_t

2701

in

2702

((let open! Ppx_deriving_runtime in

2703

fun fmt >

2704

fun x >

2705

(match x.subprogram_type with

2706

 "function" >

2707

if (x.isPure) then

2708

Format.fprintf fmt "pure %s" x.subprogram_type

2709

else

2710

Format.fprintf fmt "impure %s" x.subprogram_type

2711

 "procedure" >

2712

Format.fprintf fmt "%s %s" x.subprogram_type x.name);

2713

(match x.parameters with

2714

 [] > Format.fprintf fmt "";

2715

 _ >

2716

Format.fprintf fmt "(@[";

2717

((fun x >

2718

ignore

2719

(List.fold_left

2720

(fun sep >

2721

fun x >

2722

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

2723

((__1 ()) fmt) x;

2724

true) false x))) x.parameters;

2725

Format.fprintf fmt "@])");

2726

(match x.typeMark with

2727

 NoName > Format.fprintf fmt "";

2728

 _ >

2729

Format.fprintf fmt "returns ";

2730

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

2731

[@ocaml.warning "A"])

2732


2733

and show_vhdl_subprogram_spec_t :

2734

vhdl_subprogram_spec_t > Ppx_deriving_runtime.string =

2735

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

2736


2737

let rec (vhdl_subprogram_spec_t_to_yojson :

2738

vhdl_subprogram_spec_t > Yojson.Safe.json)

2739

=

2740

((let open! Ppx_deriving_yojson_runtime in

2741

fun x >

2742

let fields = [] in

2743

let fields =

2744

if x.isPure = false

2745

then fields

2746

else

2747

("isPure",

2748

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

2749

:: fields

2750

in

2751

let fields =

2752

if x.parameters = []

2753

then fields

2754

else

2755

("parameters",

2756

(((fun x >

2757

`List

2758

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

2759

x.parameters))

2760

:: fields

2761

in

2762

let fields =

2763

if x.typeMark = NoName

2764

then fields

2765

else

2766

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

2767

:: fields

2768

in

2769

let fields =

2770

if x.subprogram_type = ""

2771

then fields

2772

else

2773

("subprogram_type",

2774

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

2775

x.subprogram_type))

2776

:: fields

2777

in

2778

let fields =

2779

if x.name = ""

2780

then fields

2781

else

2782

("name",

2783

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

2784

:: fields

2785

in

2786

`Assoc fields)

2787

[@ocaml.warning "A"])

2788


2789

and (vhdl_subprogram_spec_t_of_yojson :

2790

Yojson.Safe.json >

2791

vhdl_subprogram_spec_t Ppx_deriving_yojson_runtime.error_or)

2792

=

2793

((let open! Ppx_deriving_yojson_runtime in

2794

function

2795

 `Assoc xs >

2796

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

2797

match xs with

2798

 ("name",x)::xs >

2799

loop xs

2800

(((function

2801

 `String x > Result.Ok x

2802

 _ >

2803

Result.Error "Vhdl_ast.vhdl_subprogram_spec_t.name")

2804

x), arg1, arg2, arg3, arg4)

2805

 ("subprogram_type",x)::xs >

2806

loop xs

2807

(arg0,

2808

((function

2809

 `String x > Result.Ok x

2810

 _ >

2811

Result.Error

2812

"Vhdl_ast.vhdl_subprogram_spec_t.subprogram_type")

2813

x), arg2, arg3, arg4)

2814

 ("typeMark",x)::xs >

2815

loop xs

2816

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

2817

arg4)

2818

 ("parameters",x)::xs >

2819

loop xs

2820

(arg0, arg1, arg2,

2821

((function

2822

 `List xs >

2823

map_bind (fun x > vhdl_parameter_t_of_yojson x)

2824

[] xs

2825

 _ >

2826

Result.Error

2827

"Vhdl_ast.vhdl_subprogram_spec_t.parameters") x),

2828

arg4)

2829

 ("isPure",x)::xs >

2830

loop xs

2831

(arg0, arg1, arg2, arg3,

2832

((function

2833

 `Bool x > Result.Ok x

2834

 _ >

2835

Result.Error

2836

"Vhdl_ast.vhdl_subprogram_spec_t.isPure") x))

2837

 [] >

2838

arg4 >>=

2839

((fun arg4 >

2840

arg3 >>=

2841

(fun arg3 >

2842

arg2 >>=

2843

(fun arg2 >

2844

arg1 >>=

2845

(fun arg1 >

2846

arg0 >>=

2847

(fun arg0 >

2848

Result.Ok

2849

{

2850

name = arg0;

2851

subprogram_type = arg1;

2852

typeMark = arg2;

2853

parameters = arg3;

2854

isPure = arg4

2855

}))))))

2856

 _::xs > loop xs _state in

2857

loop xs

2858

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

2859

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

2860

 _ > Result.Error "Vhdl_ast.vhdl_subprogram_spec_t")

2861

[@ocaml.warning "A"])

2862


2863

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

2864

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

2865

let rel_funs =

2866

["<";

2867

">";

2868

"<=";

2869

">=";

2870

"/=";

2871

"=";

2872

"?=";

2873

"?/=";

2874

"?<";

2875

"?<=";

2876

"?>";

2877

"?>=";

2878

"??"]

2879

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

2880


2881

type vhdl_waveform_element_t =

2882

{

2883

value: vhdl_expr_t option [@default None];

2884

delay: vhdl_expr_t option [@default None]}[@@deriving

2885

((show { with_path = false }),

2886

(yojson { strict = false }))]

2887


2888

let rec pp_vhdl_waveform_element_t :

2889

Format.formatter > vhdl_waveform_element_t > Ppx_deriving_runtime.unit =

2890

let __1 () = pp_vhdl_expr_t

2891


2892

and __0 () = pp_vhdl_expr_t

2893

in

2894

((let open! Ppx_deriving_runtime in

2895

fun fmt >

2896

fun x >

2897

(match x.value with

2898

 None > Format.fprintf fmt "";

2899

 Some IsNull > Format.fprintf fmt "null";

2900

 Some v > ((__0 ()) fmt) v);

2901

(match x.delay with

2902

 None > Format.fprintf fmt "";

2903

 Some v >

2904

Format.fprintf fmt " after ";

2905

((__1 ()) fmt) v))

2906

[@ocaml.warning "A"])

2907


2908

and show_vhdl_waveform_element_t :

2909

vhdl_waveform_element_t > Ppx_deriving_runtime.string =

2910

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

2911


2912

let rec (vhdl_waveform_element_t_to_yojson :

2913

vhdl_waveform_element_t > Yojson.Safe.json)

2914

=

2915

((let open! Ppx_deriving_yojson_runtime in

2916

fun x >

2917

let fields = [] in

2918

let fields =

2919

if x.delay = None

2920

then fields

2921

else

2922

("delay",

2923

(((function

2924

 None > `Null

2925

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

2926

x.delay))

2927

:: fields

2928

in

2929

let fields =

2930

if x.value = None

2931

then fields

2932

else

2933

("value",

2934

(((function

2935

 None > `Null

2936

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

2937

x.value))

2938

:: fields

2939

in

2940

`Assoc fields)

2941

[@ocaml.warning "A"])

2942


2943

and (vhdl_waveform_element_t_of_yojson :

2944

Yojson.Safe.json >

2945

vhdl_waveform_element_t Ppx_deriving_yojson_runtime.error_or)

2946

=

2947

((let open! Ppx_deriving_yojson_runtime in

2948

function

2949

 `Assoc xs >

2950

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

2951

match xs with

2952

 ("value",x)::xs >

2953

loop xs

2954

(((function

2955

 `Null > Result.Ok None

2956

 x >

2957

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

2958

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

2959

 ("delay",x)::xs >

2960

loop xs

2961

(arg0,

2962

((function

2963

 `Null > Result.Ok None

2964

 x >

2965

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

2966

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

2967

 [] >

2968

arg1 >>=

2969

((fun arg1 >

2970

arg0 >>=

2971

(fun arg0 >

2972

Result.Ok { value = arg0; delay = arg1 })))

2973

 _::xs > loop xs _state in

2974

loop xs ((Result.Ok None), (Result.Ok None))

2975

 _ > Result.Error "Vhdl_ast.vhdl_waveform_element_t")

2976

[@ocaml.warning "A"])

2977


2978

type vhdl_sequential_stmt_t =

2979

 VarAssign of

2980

{

2981

label: vhdl_name_t [@default NoName];

2982

lhs: vhdl_name_t ;

2983

rhs: vhdl_expr_t } [@name "VARIABLE_ASSIGNMENT_STATEMENT"]

2984

 SigSeqAssign of

2985

{

2986

label: vhdl_name_t [@default NoName];

2987

lhs: vhdl_name_t ;

2988

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

2989

 If of

2990

{

2991

label: vhdl_name_t [@default NoName];

2992

if_cases: vhdl_if_case_t list ;

2993

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

2994

 Case of

2995

{

2996

label: vhdl_name_t [@default NoName];

2997

guard: vhdl_expr_t ;

2998

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

2999

 Exit of

3000

{

3001

label: vhdl_name_t [@default NoName];

3002

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

3003

condition: vhdl_expr_t option [@default Some IsNull]}

3004

[@name "EXIT_STATEMENT"]

3005

 Assert of

3006

{

3007

label: vhdl_name_t [@default NoName];

3008

cond: vhdl_expr_t ;

3009

report: vhdl_expr_t [@default IsNull];

3010

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

3011

 ProcedureCall of

3012

{

3013

label: vhdl_name_t [@default NoName];

3014

name: vhdl_name_t ;

3015

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

3016

 Wait [@name "WAIT_STATEMENT"]

3017

 Null of {

3018

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

3019

 Return of {

3020

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

3021

and vhdl_if_case_t =

3022

{

3023

if_cond: vhdl_expr_t ;

3024

if_block: vhdl_sequential_stmt_t list }

3025

and vhdl_case_item_t =

3026

{

3027

when_cond: vhdl_expr_t list ;

3028

when_stmt: vhdl_sequential_stmt_t list }

3029


3030

let rec pp_vhdl_sequential_stmt_t :

3031

Format.formatter > vhdl_sequential_stmt_t > Ppx_deriving_runtime.unit =

3032

let __22 () = pp_vhdl_name_t

3033


3034

and __21 () = pp_vhdl_name_t

3035


3036

and __20 () = pp_vhdl_assoc_element_t

3037


3038

and __19 () = pp_vhdl_name_t

3039


3040

and __18 () = pp_vhdl_name_t

3041


3042

and __17 () = pp_vhdl_expr_t

3043


3044

and __16 () = pp_vhdl_expr_t

3045


3046

and __15 () = pp_vhdl_expr_t

3047


3048

and __14 () = pp_vhdl_name_t

3049


3050

and __13 () = pp_vhdl_expr_t

3051


3052

and __12 () = pp_vhdl_name_t

3053


3054

and __11 () = pp_vhdl_case_item_t

3055


3056

and __10 () = pp_vhdl_expr_t

3057


3058

and __9 () = pp_vhdl_name_t

3059


3060

and __8 () = pp_vhdl_sequential_stmt_t

3061


3062

and __7 () = pp_vhdl_if_case_t

3063


3064

and __6 () = pp_vhdl_name_t

3065


3066

and __5 () = pp_vhdl_waveform_element_t

3067


3068

and __4 () = pp_vhdl_name_t

3069


3070

and __3 () = pp_vhdl_name_t

3071


3072

and __2 () = pp_vhdl_expr_t

3073


3074

and __1 () = pp_vhdl_name_t

3075


3076

and __0 () = pp_vhdl_name_t

3077

in

3078

((let open! Ppx_deriving_runtime in

3079

fun fmt >

3080

function

3081

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

3082

(match alabel with

3083

 NoName > Format.fprintf fmt "";

3084

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

3085

Format.fprintf fmt ": ")

3086

);

3087

((__1 ()) fmt) alhs;

3088

Format.fprintf fmt " := ";

3089

((__2 ()) fmt) arhs;

3090

(* TODO: Check

3091

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

3092

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

3093

((__0 ()) fmt) alabel;

3094

Format.fprintf fmt "@]");

3095

Format.fprintf fmt ";@ ";

3096

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

3097

((__1 ()) fmt) alhs;

3098

Format.fprintf fmt "@]");

3099

Format.fprintf fmt ";@ ";

3100

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

3101

((__2 ()) fmt) arhs;

3102

Format.fprintf fmt "@]");

3103

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

3104

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

3105

(match alabel with

3106

 NoName > Format.fprintf fmt "";

3107

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

3108

Format.fprintf fmt ":@ ")

3109

);

3110

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

3111

((__4 ()) fmt) alhs;

3112

Format.fprintf fmt "@ <=@ ";

3113

((fun x >

3114

Format.fprintf fmt "@[";

3115

ignore

3116

(List.fold_left

3117

(fun sep >

3118

fun x >

3119

if sep then Format.fprintf fmt "";

3120

((__5 ()) fmt) x;

3121

true) false x);

3122

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

3123

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

3124

(match alabel with

3125

 NoName > Format.fprintf fmt "";

3126

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

3127

Format.fprintf fmt ":@ ")

3128

);

3129

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

3130

((fun x >

3131

ignore

3132

(List.fold_left

3133

(fun sep >

3134

fun x >

3135

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

3136

((__7 ()) fmt) x;

3137

true

3138

) false x);

3139

)) aif_cases;

3140

(match adefault with

3141

 [] > Format.fprintf fmt "";

3142

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

3143

((fun x >

3144

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

3145

ignore

3146

(List.fold_left

3147

(fun sep >

3148

fun x >

3149

if sep then Format.fprintf fmt "";

3150

((__8 ()) fmt) x;

3151

true) false x))) adefault));

3152

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

3153

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

3154

(match alabel with

3155

 NoName > Format.fprintf fmt "";

3156

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

3157

Format.fprintf fmt ":@ ")

3158

);

3159

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

3160

((__10 ()) fmt) aguard;

3161

Format.fprintf fmt " is";

3162

((fun x >

3163

ignore

3164

(List.fold_left

3165

(fun sep >

3166

fun x >

3167

if sep then Format.fprintf fmt "";

3168

((__11 ()) fmt) x;

3169

true) false x);)) abranches;

3170

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

3171

 Exit

3172

{ label = alabel; loop_label = aloop_label;

3173

condition = acondition }

3174

>

3175

(match alabel with

3176

 NoName > Format.fprintf fmt "";

3177

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

3178

Format.fprintf fmt ":@ ")

3179

);

3180

Format.fprintf fmt "exit";

3181

(match aloop_label with

3182

 None > Format.pp_print_string fmt ""

3183

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

3184

((function

3185

 None > Format.pp_print_string fmt ""

3186

 Some x >

3187

(Format.pp_print_string fmt "when@ ";

3188

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

3189

 Assert

3190

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

3191

severity = aseverity }

3192

>

3193

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

3194

(match alabel with

3195

 NoName > Format.fprintf fmt "";

3196

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

3197

Format.fprintf fmt ":@ ")

3198

);

3199

Format.fprintf fmt "assert ";

3200

((__15 ()) fmt) acond;

3201

(match areport with

3202

 IsNull > Format.fprintf fmt "";

3203

 _ >

3204

Format.fprintf fmt "@;report ";

3205

((__16 ()) fmt) areport);

3206

(match aseverity with

3207

 IsNull > Format.fprintf fmt "";

3208

 _ >

3209

Format.fprintf fmt "@;severity ";

3210

((__17 ()) fmt) aseverity);

3211

Format.fprintf fmt "@]";

3212

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

3213

(match alabel with

3214

 NoName > Format.fprintf fmt "";

3215

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

3216

Format.fprintf fmt ":@ ")

3217

);

3218

((__19 ()) fmt) aname;

3219

(match aassocs with

3220

 [] > Format.fprintf fmt "";

3221

 _ >

3222

((fun x >

3223

Format.fprintf fmt "(";

3224

ignore

3225

(List.fold_left

3226

(fun sep >

3227

fun x >

3228

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

3229

((__20 ()) fmt) x;

3230

true) false x);

3231

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

3232

 Wait > Format.pp_print_string fmt "wait"

3233

 Null { label = alabel } >

3234

(match alabel with

3235

 NoName > Format.fprintf fmt "";

3236

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

3237

Format.fprintf fmt ":@ ")

3238

);

3239

Format.fprintf fmt "null";

3240

 Return { label = alabel } >

3241

(match alabel with

3242

 NoName > Format.fprintf fmt "";

3243

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

3244

Format.fprintf fmt ":@ ")

3245

);

3246

Format.fprintf fmt "return";)

3247

[@ocaml.warning "A"])

3248


3249

and show_vhdl_sequential_stmt_t :

3250

vhdl_sequential_stmt_t > Ppx_deriving_runtime.string =

3251

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

3252


3253

and pp_vhdl_if_case_t :

3254

Format.formatter > vhdl_if_case_t > Ppx_deriving_runtime.unit =

3255

let __1 () = pp_vhdl_sequential_stmt_t

3256


3257

and __0 () = pp_vhdl_expr_t

3258

in

3259

((let open! Ppx_deriving_runtime in

3260

fun fmt >

3261

fun x >

3262

Format.fprintf fmt " (";

3263

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

3264

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

3265

((fun x >

3266

ignore

3267

(List.fold_left

3268

(fun sep >

3269

fun x >

3270

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

3271

((__1 ()) fmt) x;

3272

true) false x);

3273

)) x.if_block;)

3274

[@ocaml.warning "A"])

3275


3276

and show_vhdl_if_case_t : vhdl_if_case_t > Ppx_deriving_runtime.string =

3277

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

3278


3279

and pp_vhdl_case_item_t :

3280

Format.formatter > vhdl_case_item_t > Ppx_deriving_runtime.unit =

3281

let __1 () = pp_vhdl_sequential_stmt_t

3282


3283

and __0 () = pp_vhdl_expr_t

3284

in

3285

((let open! Ppx_deriving_runtime in

3286

fun fmt >

3287

fun x >

3288

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

3289

((fun x >

3290

ignore

3291

(List.fold_left

3292

(fun sep >

3293

fun x >

3294

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

3295

((__0 ()) fmt) x;

3296

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

3297

Format.fprintf fmt " => ";

3298

(fun x >

3299

ignore

3300

(List.fold_left

3301

(fun sep >

3302

fun x >

3303

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

3304

((__1 ()) fmt) x;

3305

Format.fprintf fmt ";";

3306

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

3307

Format.fprintf fmt "@]")

3308

[@ocaml.warning "A"])

3309


3310

and show_vhdl_case_item_t : vhdl_case_item_t > Ppx_deriving_runtime.string =

3311

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

3312


3313

let rec (vhdl_sequential_stmt_t_to_yojson :

3314

vhdl_sequential_stmt_t > Yojson.Safe.json)

3315

=

3316

((let open! Ppx_deriving_yojson_runtime in

3317

function

3318

 VarAssign arg0 >

3319

`List

3320

[`String "VARIABLE_ASSIGNMENT_STATEMENT";

3321

(let fields = [] in

3322

let fields =

3323

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

3324

fields in

3325

let fields =

3326

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

3327

fields in

3328

let fields =

3329

if arg0.label = NoName

3330

then fields

3331

else

3332

("label",

3333

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

3334

:: fields

3335

in

3336

`Assoc fields)]

3337

 SigSeqAssign arg0 >

3338

`List

3339

[`String "SIGNAL_ASSIGNMENT_STATEMENT";

3340

(let fields = [] in

3341

let fields =

3342

("rhs",

3343

((fun x >

3344

`List

3345

(List.map

3346

(fun x > vhdl_waveform_element_t_to_yojson x) x))

3347

arg0.rhs))

3348

:: fields in

3349

let fields =

3350

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

3351

fields in

3352

let fields =

3353

if arg0.label = NoName

3354

then fields

3355

else

3356

("label",

3357

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

3358

:: fields

3359

in

3360

`Assoc fields)]

3361

 If arg0 >

3362

`List

3363

[`String "IF_STATEMENT";

3364

(let fields = [] in

3365

let fields =

3366

if arg0.default = []

3367

then fields

3368

else

3369
