Project

General

Profile

Revision 6a2c1a43

View differences:

src/backends/VHDL/mini_vhdl_ast_pp.ml
400 400
      fun fmt  ->
401 401
        function
402 402
        | VarDecl { names = anames; typ = atyp; init_val = ainit_val } ->
403
            (Format.fprintf fmt "@[<2>VarDecl {@,";
404
             (((Format.fprintf fmt "@[%s =@ " "names";
405
                ((fun x  ->
406
                    Format.fprintf fmt "@[<2>[";
403
            (Format.fprintf fmt "variable ";
404
             ((((fun x  ->
407 405
                    ignore
408 406
                      (List.fold_left
409 407
                         (fun sep  ->
410 408
                            fun x  ->
411
                              if sep then Format.fprintf fmt ";@ ";
409
                              if sep then Format.fprintf fmt ",";
412 410
                              ((__0 ()) fmt) x;
413
                              true) false x);
414
                    Format.fprintf fmt "@,]@]")) anames;
415
                Format.fprintf fmt "@]");
416
               Format.fprintf fmt ";@ ";
417
               Format.fprintf fmt "@[%s =@ " "typ";
411
                              true) false x);)) anames;
412
               Format.fprintf fmt " : ";
418 413
               ((__1 ()) fmt) atyp;
419
               Format.fprintf fmt "@]");
420
              Format.fprintf fmt ";@ ";
421
              Format.fprintf fmt "@[%s =@ " "init_val";
422
              ((__2 ()) fmt) ainit_val;
423
              Format.fprintf fmt "@]");
424
             Format.fprintf fmt "@]}")
414
               (match ainit_val with
415
                | IsNull  -> Format.pp_print_string fmt ""
416
                | _ ->
417
                    (Format.fprintf fmt ":=";
418
                     ((__2 ()) fmt) ainit_val;))));)
425 419
        | CstDecl { names = anames; typ = atyp; init_val = ainit_val } ->
426
            (Format.fprintf fmt "@[<2>CstDecl {@,";
427
             (((Format.fprintf fmt "@[%s =@ " "names";
428
                ((fun x  ->
429
                    Format.fprintf fmt "@[<2>[";
420
            (Format.fprintf fmt "constant ";
421
             ((((fun x  ->
430 422
                    ignore
431 423
                      (List.fold_left
432 424
                         (fun sep  ->
433 425
                            fun x  ->
434
                              if sep then Format.fprintf fmt ";@ ";
426
                              if sep then Format.fprintf fmt ",";
435 427
                              ((__3 ()) fmt) x;
436
                              true) false x);
437
                    Format.fprintf fmt "@,]@]")) anames;
438
                Format.fprintf fmt "@]");
439
               Format.fprintf fmt ";@ ";
440
               Format.fprintf fmt "@[%s =@ " "typ";
441
               ((__4 ()) fmt) atyp;
442
               Format.fprintf fmt "@]");
443
              Format.fprintf fmt ";@ ";
444
              Format.fprintf fmt "@[%s =@ " "init_val";
445
              ((__5 ()) fmt) ainit_val;
446
              Format.fprintf fmt "@]");
447
             Format.fprintf fmt "@]}")
428
                              true) false x);)) anames;
429
              Format.fprintf fmt " : ";
430
              ((__4 ()) fmt) atyp;
431
              Format.fprintf fmt " := ";
432
              ((__5 ()) fmt) ainit_val)))
448 433
        | SigDecl { names = anames; typ = atyp; init_val = ainit_val } ->
449
            (Format.fprintf fmt "@[<2>SigDecl {@,";
450
             (((Format.fprintf fmt "@[%s =@ " "names";
451
                ((fun x  ->
452
                    Format.fprintf fmt "@[<2>[";
453
                    ignore
454
                      (List.fold_left
455
                         (fun sep  ->
456
                            fun x  ->
457
                              if sep then Format.fprintf fmt ";@ ";
458
                              ((__6 ()) fmt) x;
459
                              true) false x);
460
                    Format.fprintf fmt "@,]@]")) anames;
461
                Format.fprintf fmt "@]");
462
               Format.fprintf fmt ";@ ";
463
               Format.fprintf fmt "@[%s =@ " "typ";
464
               ((__7 ()) fmt) atyp;
465
               Format.fprintf fmt "@]");
466
              Format.fprintf fmt ";@ ";
467
              Format.fprintf fmt "@[%s =@ " "init_val";
468
              ((__8 ()) fmt) ainit_val;
469
              Format.fprintf fmt "@]");
470
             Format.fprintf fmt "@]}")
434
            (Format.fprintf fmt "signal ";
435
            ((fun x  ->
436
              ignore
437
              (List.fold_left
438
                (fun sep  ->
439
                  fun x  ->
440
                    if sep then Format.fprintf fmt ",";
441
                                ((__6 ()) fmt) x;
442
                                true) false x);
443
              )) anames;
444
            Format.fprintf fmt " : ";
445
            ((__7 ()) fmt) atyp;
446
            (match ainit_val with
447
              | IsNull  -> Format.pp_print_string fmt ""
448
              | _ ->
449
                  (Format.fprintf fmt ":=";
450
                  ((__8 ()) fmt) ainit_val;)))
471 451
        | ComponentDecl
472 452
            { name = aname; generics = agenerics; ports = aports } ->
473
            (Format.fprintf fmt "@[<2>ComponentDecl {@,";
474
             (((Format.fprintf fmt "@[%s =@ " "name";
475
                ((__9 ()) fmt) aname;
476
                Format.fprintf fmt "@]");
477
               Format.fprintf fmt ";@ ";
478
               Format.fprintf fmt "@[%s =@ " "generics";
479
               ((fun x  ->
480
                   Format.fprintf fmt "@[<2>[";
481
                   ignore
482
                     (List.fold_left
483
                        (fun sep  ->
484
                           fun x  ->
485
                             if sep then Format.fprintf fmt ";@ ";
486
                             ((__10 ()) fmt) x;
487
                             true) false x);
488
                   Format.fprintf fmt "@,]@]")) agenerics;
489
               Format.fprintf fmt "@]");
490
              Format.fprintf fmt ";@ ";
491
              Format.fprintf fmt "@[%s =@ " "ports";
492
              ((fun x  ->
493
                  Format.fprintf fmt "@[<2>[";
453
            Format.fprintf fmt "@[<v 2>component ";
454
            ((__9 ()) fmt) aname;
455
            Format.fprintf fmt " is@;";
456
            (match agenerics with
457
            | [] -> ()
458
            | _ ->
459
                Format.fprintf fmt "generic (@[<v>";
460
                ((fun x  ->
494 461
                  ignore
495 462
                    (List.fold_left
496
                       (fun sep  ->
497
                          fun x  ->
498
                            if sep then Format.fprintf fmt ";@ ";
463
                      (fun sep  ->
464
                        fun x  ->
465
                          if sep then Format.fprintf fmt ";@;";
466
                            ((__10 ()) fmt) x;
467
                            true) false x))) agenerics;
468
                Format.fprintf fmt "@]);");
469
            (match aports with
470
            | [] -> ()
471
            | _ ->
472
                Format.fprintf fmt "port (@[<v>";
473
                ((fun x  ->
474
                  ignore
475
                    (List.fold_left
476
                      (fun sep  ->
477
                        fun x  ->
478
                          if sep then Format.fprintf fmt ";@;";
499 479
                            ((__11 ()) fmt) x;
500
                            true) false x);
501
                  Format.fprintf fmt "@,]@]")) aports;
502
              Format.fprintf fmt "@]");
503
             Format.fprintf fmt "@]}")
504
        | Subprogram { spec = aspec; decl_part = adecl_part; stmts = astmts }
480
                            true) false x))) aports;
481
                Format.fprintf fmt "@]);");
482
            Format.fprintf fmt "@]@;end component";
483
        | Subprogram
484
            { spec = aspec; decl_part = adecl_part; stmts = astmts }
505 485
            ->
506
            (Format.fprintf fmt "@[<2>Subprogram {@,";
507
             (((Format.fprintf fmt "@[%s =@ " "spec";
508
                ((__12 ()) fmt) aspec;
509
                Format.fprintf fmt "@]");
510
               Format.fprintf fmt ";@ ";
511
               Format.fprintf fmt "@[%s =@ " "decl_part";
512
               ((fun x  ->
513
                   Format.fprintf fmt "@[<2>[";
514
                   ignore
515
                     (List.fold_left
516
                        (fun sep  ->
517
                           fun x  ->
518
                             if sep then Format.fprintf fmt ";@ ";
486
              Format.fprintf fmt "@[<v 2>";
487
              ((__12 ()) fmt) aspec;
488
              Format.fprintf fmt " is";
489
              (match adecl_part with
490
              | [] -> Format.fprintf fmt "";
491
              | _ ->
492
                ((fun x  ->
493
                  ignore
494
                    (List.fold_left
495
                      (fun sep  ->
496
                         fun x  ->
497
                           if sep then Format.fprintf fmt "";
498
                             Format.fprintf fmt "@;";
519 499
                             ((__13 ()) fmt) x;
520
                             true) false x);
521
                   Format.fprintf fmt "@,]@]")) adecl_part;
522
               Format.fprintf fmt "@]");
523
              Format.fprintf fmt ";@ ";
524
              Format.fprintf fmt "@[%s =@ " "stmts";
500
                             Format.fprintf fmt ";";
501
                             true) false x))) adecl_part);
502
              Format.fprintf fmt "@]@;";
503
              Format.fprintf fmt "@[<v 2>begin@;";
525 504
              ((fun x  ->
526
                  Format.fprintf fmt "@[<2>[";
527 505
                  ignore
528 506
                    (List.fold_left
529 507
                       (fun sep  ->
530 508
                          fun x  ->
531
                            if sep then Format.fprintf fmt ";@ ";
509
                            if sep then Format.fprintf fmt "@;";
532 510
                            ((__14 ()) fmt) x;
533
                            true) false x);
534
                  Format.fprintf fmt "@,]@]")) astmts;
535
              Format.fprintf fmt "@]");
536
             Format.fprintf fmt "@]}"))
537
    [@ocaml.warning "-A"])
511
                            Format.fprintf fmt ";";
512
                            true) false x))) astmts;
513
              Format.fprintf fmt "@]@;end";)    [@ocaml.warning "-A"])
538 514

  
539 515
and show_mini_vhdl_declaration_t :
540 516
  mini_vhdl_declaration_t -> Ppx_deriving_runtime.string =
......
675 651
                              ((__2 ()) fmt) x;
676 652
                              true) false x))) x.active_sigs;
677 653
                 Format.fprintf fmt ")");
678
          Format.fprintf fmt " is@;";
679
          ((fun x  ->
680
            ignore
681
            (List.fold_left
682
              (fun sep  ->
683
                fun x  ->
684
                  if sep then Format.fprintf fmt "@;";
685
                    ((__1 ()) fmt) x;
686
                    Format.fprintf fmt ";";
687
                    true) false x))) x.declarations;
654
          Format.fprintf fmt " is";
655
          (match x.declarations with
656
          | [] -> Format.fprintf fmt "";
657
          | _ -> 
658
              (Format.fprintf fmt "@;";
659
              ((fun x  ->
660
                ignore
661
                (List.fold_left
662
                  (fun sep  ->
663
                    fun x  ->
664
                      if sep then Format.fprintf fmt "@;";
665
                        ((__1 ()) fmt) x;
666
                        Format.fprintf fmt ";";
667
                        true) false x))) x.declarations));
688 668
          Format.fprintf fmt "@]@;@[<v 2>begin@;";
689 669
          ((fun x  ->
690 670
               ignore
src/backends/VHDL/vhdl_ast_pp.ml
1524 1524
                              ((__2 ()) fmt) x;
1525 1525
                              true) false x))) x.active_sigs;
1526 1526
                 Format.fprintf fmt ")");
1527
          Format.fprintf fmt " is@;";
1528
          ((fun x  ->
1529
            ignore
1530
            (List.fold_left
1531
              (fun sep  ->
1532
                fun x  ->
1533
                  if sep then Format.fprintf fmt "@;";
1534
                    ((__1 ()) fmt) x;
1535
                    Format.fprintf fmt ";";
1536
                    true) false x))) x.declarations;
1527
          Format.fprintf fmt " is";
1528
          (match x.declarations with
1529
          | [] -> Format.fprintf fmt "";
1530
          | _ -> 
1531
              (Format.fprintf fmt "@;";
1532
              ((fun x  ->
1533
                ignore
1534
                (List.fold_left
1535
                  (fun sep  ->
1536
                    fun x  ->
1537
                      if sep then Format.fprintf fmt "@;";
1538
                        ((__1 ()) fmt) x;
1539
                        Format.fprintf fmt ";";
1540
                        true) false x))) x.declarations));
1537 1541
          Format.fprintf fmt "@]@;@[<v 2>begin@;";
1538 1542
          ((fun x  ->
1539 1543
               ignore

Also available in: Unified diff