Project

General

Profile

Revision d4175560 src/backends/VHDL/vhdl_ast_deriving.ml

View differences:

src/backends/VHDL/vhdl_ast_deriving.ml
228 228
        fun x  ->
229 229
          ((__0 ()) fmt) x.name;
230 230
          ((__1 ()) fmt) x.functionName;
231
          Format.fprintf fmt " ";
232
          ((__2 ()) fmt) x.const;
233
    )
231
          (match x.const with
232
            | NoConstraint -> Format.fprintf fmt "";
233
            | _ -> Format.fprintf fmt " ";
234
                   ((__2 ()) fmt) x.const))
234 235
    [@ocaml.warning "-A"])
235 236

  
236 237
and show_vhdl_subtype_indication_t :
......
3519 3520
  {
3520 3521
  names: vhdl_name_t list ;
3521 3522
  typ: vhdl_subtype_indication_t ;
3522
  init_val: vhdl_cst_val_t option [@default None]}
3523
  [@name "VARIABLE_DECLARATION"]
3523
  init_val: vhdl_expr_t [@default IsNull]} [@name "VARIABLE_DECLARATION"]
3524 3524
  | CstDecl of
3525 3525
  {
3526 3526
  names: vhdl_name_t list ;
3527 3527
  typ: vhdl_subtype_indication_t ;
3528
  init_val: vhdl_cst_val_t } [@name "CONSTANT_DECLARATION"]
3528
  init_val: vhdl_expr_t } [@name "CONSTANT_DECLARATION"]
3529 3529
  | SigDecl of
3530 3530
  {
3531 3531
  names: vhdl_name_t list ;
3532 3532
  typ: vhdl_subtype_indication_t ;
3533
  init_val: vhdl_cst_val_t option [@default None]}
3534
  [@name "SIGNAL_DECLARATION"]
3533
  init_val: vhdl_expr_t [@default IsNull]} [@name "SIGNAL_DECLARATION"]
3535 3534
  | Subprogram of
3536 3535
  {
3537 3536
  name: vhdl_name_t [@default NoName];
......
3553 3552
  
3554 3553
  and __9 () = pp_vhdl_name_t
3555 3554
  
3556
  and __8 () = pp_vhdl_cst_val_t
3555
  and __8 () = pp_vhdl_expr_t
3557 3556
  
3558 3557
  and __7 () = pp_vhdl_subtype_indication_t
3559 3558
  
3560 3559
  and __6 () = pp_vhdl_name_t
3561 3560
  
3562
  and __5 () = pp_vhdl_cst_val_t
3561
  and __5 () = pp_vhdl_expr_t
3563 3562
  
3564 3563
  and __4 () = pp_vhdl_subtype_indication_t
3565 3564
  
3566 3565
  and __3 () = pp_vhdl_name_t
3567 3566
  
3568
  and __2 () = pp_vhdl_cst_val_t
3567
  and __2 () = pp_vhdl_expr_t
3569 3568
  
3570 3569
  and __1 () = pp_vhdl_subtype_indication_t
3571 3570
  
......
3586 3585
                              true) false x);)) anames;
3587 3586
               Format.fprintf fmt " : ";
3588 3587
               ((__1 ()) fmt) atyp;
3589
              ((function
3590
                | None  -> Format.pp_print_string fmt ""
3591
                | Some x ->
3588
               (match ainit_val with
3589
                | IsNull  -> Format.pp_print_string fmt ""
3590
                | _ ->
3592 3591
                    (Format.fprintf fmt ":=";
3593
                     ((__2 ()) fmt) x;))) ainit_val);
3594
            ))
3592
                     ((__2 ()) fmt) ainit_val;))));)
3595 3593
        | CstDecl { names = anames; typ = atyp; init_val = ainit_val } ->
3596 3594
            (Format.fprintf fmt "constant ";
3597 3595
             ((((fun x  ->
......
3619 3617
              )) anames;
3620 3618
            Format.fprintf fmt " : ";
3621 3619
            ((__7 ()) fmt) atyp;
3622
            (function
3623
              | None  -> Format.pp_print_string fmt ""
3624
              | Some x ->
3620
            (match ainit_val with
3621
              | IsNull  -> Format.pp_print_string fmt ""
3622
              | _ ->
3625 3623
                  (Format.fprintf fmt ":=";
3626
                  ((__8 ()) fmt) x;)
3627
            ) ainit_val)
3624
                  ((__8 ()) fmt) ainit_val;)))
3628 3625
        | Subprogram
3629 3626
            { name = aname; kind = akind; spec = aspec;
3630 3627
              decl_part = adecl_part; stmts = astmts }
......
3684 3681
            [`String "VARIABLE_DECLARATION";
3685 3682
            (let fields = []  in
3686 3683
             let fields =
3687
               if arg0.init_val = None
3684
               if arg0.init_val = IsNull
3688 3685
               then fields
3689 3686
               else
3690 3687
                 ("init_val",
3691
                   (((function
3692
                      | None  -> `Null
3693
                      | Some x -> ((fun x  -> vhdl_cst_val_t_to_yojson x)) x))
3694
                      arg0.init_val))
3688
                   (((fun x  -> vhdl_expr_t_to_yojson x)) arg0.init_val))
3695 3689
                 :: fields
3696 3690
                in
3697 3691
             let fields =
......
3711 3705
            (let fields = []  in
3712 3706
             let fields =
3713 3707
               ("init_val",
3714
                 ((fun x  -> vhdl_cst_val_t_to_yojson x) arg0.init_val))
3708
                 ((fun x  -> vhdl_expr_t_to_yojson x) arg0.init_val))
3715 3709
               :: fields  in
3716 3710
             let fields =
3717 3711
               ("typ",
......
3729 3723
            [`String "SIGNAL_DECLARATION";
3730 3724
            (let fields = []  in
3731 3725
             let fields =
3732
               if arg0.init_val = None
3726
               if arg0.init_val = IsNull
3733 3727
               then fields
3734 3728
               else
3735 3729
                 ("init_val",
3736
                   (((function
3737
                      | None  -> `Null
3738
                      | Some x -> ((fun x  -> vhdl_cst_val_t_to_yojson x)) x))
3739
                      arg0.init_val))
3730
                   (((fun x  -> vhdl_expr_t_to_yojson x)) arg0.init_val))
3740 3731
                 :: fields
3741 3732
                in
3742 3733
             let fields =
......
3841 3832
                             x), arg2)
3842 3833
                  | ("init_val",x)::xs ->
3843 3834
                      loop xs
3844
                        (arg0, arg1,
3845
                          ((function
3846
                            | `Null -> Result.Ok None
3847
                            | x ->
3848
                                ((fun x  -> vhdl_cst_val_t_of_yojson x) x)
3849
                                  >>= ((fun x  -> Result.Ok (Some x)))) x))
3835
                        (arg0, arg1, ((fun x  -> vhdl_expr_t_of_yojson x) x))
3850 3836
                  | [] ->
3851 3837
                      arg2 >>=
3852 3838
                        ((fun arg2  ->
......
3865 3851
                loop xs
3866 3852
                  ((Result.Error "Vhdl_ast.vhdl_declaration_t.names"),
3867 3853
                    (Result.Error "Vhdl_ast.vhdl_declaration_t.typ"),
3868
                    (Result.Ok (Some (CstInt 0))))
3854
                    (Result.Ok IsNull))
3869 3855
            | _ -> Result.Error "Vhdl_ast.vhdl_declaration_t")) arg0
3870 3856
      | `List ((`String "CONSTANT_DECLARATION")::arg0::[]) ->
3871 3857
          ((function
......
3889 3875
                             x), arg2)
3890 3876
                  | ("init_val",x)::xs ->
3891 3877
                      loop xs
3892
                        (arg0, arg1,
3893
                          ((fun x  -> vhdl_cst_val_t_of_yojson x) x))
3878
                        (arg0, arg1, ((fun x  -> vhdl_expr_t_of_yojson x) x))
3894 3879
                  | [] ->
3895 3880
                      arg2 >>=
3896 3881
                        ((fun arg2  ->
......
3933 3918
                             x), arg2)
3934 3919
                  | ("init_val",x)::xs ->
3935 3920
                      loop xs
3936
                        (arg0, arg1,
3937
                          ((function
3938
                            | `Null -> Result.Ok None
3939
                            | x ->
3940
                                ((fun x  -> vhdl_cst_val_t_of_yojson x) x)
3941
                                  >>= ((fun x  -> Result.Ok (Some x)))) x))
3921
                        (arg0, arg1, ((fun x  -> vhdl_expr_t_of_yojson x) x))
3942 3922
                  | [] ->
3943 3923
                      arg2 >>=
3944 3924
                        ((fun arg2  ->
......
3957 3937
                loop xs
3958 3938
                  ((Result.Error "Vhdl_ast.vhdl_declaration_t.names"),
3959 3939
                    (Result.Error "Vhdl_ast.vhdl_declaration_t.typ"),
3960
                    (Result.Ok (Some (CstInt 0))))
3940
                    (Result.Ok IsNull))
3961 3941
            | _ -> Result.Error "Vhdl_ast.vhdl_declaration_t")) arg0
3962 3942
      | `List ((`String "SUBPROGRAM_BODY")::arg0::[]) ->
3963 3943
          ((function
......
4921 4901
                            true) false x);
4922 4902
                  Format.fprintf fmt "@,@]")) x.names;
4923 4903
              );
4924
             Format.fprintf fmt ":@ ";
4904
             Format.fprintf fmt ": ";
4925 4905
             ((__1 ()) fmt) x.mode;
4926 4906
             );
4927
             Format.fprintf fmt "@ ";
4907
             Format.fprintf fmt " ";
4928 4908
            ((__2 ()) fmt) x.typ;
4929 4909
            );
4930 4910
          (match x.expr with
4931 4911
           | IsNull -> Format.fprintf fmt "";
4932
           | _ -> (Format.fprintf fmt "@[:=@ ";
4912
           | _ -> (Format.fprintf fmt "@[:= ";
4933 4913
                   ((__3 ()) fmt) x.expr;
4934 4914
                   Format.fprintf fmt "@]"));
4935 4915
          Format.fprintf fmt "@]"))
......
5051 5031
               Format.fprintf fmt " is@ ");
5052 5032
              Format.fprintf fmt "@[<v>";
5053 5033
              ((fun x  ->
5054
                  Format.fprintf fmt "@[";
5055 5034
                  ignore
5056 5035
                    (List.fold_left
5057 5036
                       (fun sep  ->
5058 5037
                          fun x  ->
5059
                            if sep then Format.fprintf fmt ";@ ";
5038
                            if sep then Format.fprintf fmt ";@;";
5060 5039
                            ((__1 ()) fmt) x;
5061
                            true) false x);
5062
                  Format.fprintf fmt "@]")) x.generics;
5040
                            true) false x))) x.generics;
5063 5041
              Format.fprintf fmt "@]");
5064 5042
             Format.fprintf fmt "port (@[<v>";
5065 5043
             ((fun x  ->
5066
                 Format.fprintf fmt "@[";
5067 5044
                 ignore
5068 5045
                   (List.fold_left
5069 5046
                      (fun sep  ->
5070 5047
                         fun x  ->
5071
                           if sep then Format.fprintf fmt ";@ ";
5048
                           if sep then Format.fprintf fmt ";@;";
5072 5049
                           ((__2 ()) fmt) x;
5073
                           true) false x);
5074
                 Format.fprintf fmt "@]")) x.ports;
5050
                           true) false x))) x.ports;
5075 5051
             Format.fprintf fmt "@]);");
5076 5052
            Format.fprintf fmt "@[<v>";
5077 5053
            ((fun x  ->

Also available in: Unified diff