Project

General

Profile

Revision 77bdbec5

View differences:

src/backends/VHDL/vhdl_ast.ml
341 341
  {
342 342
    name: vhdl_name_t [@default NoName];
343 343
    entity: vhdl_name_t [@default NoName];
344
    use_clauses: vhdl_load_t list [@default []];
344 345
    declarations: vhdl_declaration_t list [@key "ARCHITECTURE_DECLARATIVE_PART"] [@default []];
345 346
    body: vhdl_concurrent_stmt_t list [@key "ARCHITECTURE_STATEMENT_PART"] [@default []]; 
346 347
  }
src/backends/VHDL/vhdl_ast_deriving.ml
6067 6067
  {
6068 6068
  name: vhdl_name_t [@default NoName];
6069 6069
  entity: vhdl_name_t [@default NoName];
6070
  use_clauses: vhdl_load_t list [@default []];
6070 6071
  declarations: vhdl_declaration_t list
6071 6072
    [@key "ARCHITECTURE_DECLARATIVE_PART"][@default []];
6072 6073
  body: vhdl_concurrent_stmt_t list
......
6074 6075

  
6075 6076
let rec pp_vhdl_architecture_t :
6076 6077
  Format.formatter -> vhdl_architecture_t -> Ppx_deriving_runtime.unit =
6077
  let __3 () = pp_vhdl_concurrent_stmt_t
6078
  let __4 () = pp_vhdl_concurrent_stmt_t
6079
  
6080
  and __3 () = pp_vhdl_declaration_t
6078 6081
  
6079
  and __2 () = pp_vhdl_declaration_t
6082
  and __2 () = pp_vhdl_load_t
6080 6083
  
6081 6084
  and __1 () = pp_vhdl_name_t
6082 6085
  
......
6089 6092
          Format.fprintf fmt " of ";
6090 6093
          ((__1 ()) fmt) x.entity;
6091 6094
          Format.fprintf fmt " is@;";
6092
          ((fun x  ->
6095
            ((fun x  ->
6096
               ignore
6097
                 (List.fold_left
6098
                    (fun sep  ->
6099
                       fun x  ->
6100
                         if sep then Format.fprintf fmt "";
6101
                         ((__2 ()) fmt) x;
6102
                         Format.fprintf fmt "@;";
6103
                         true) false x))) x.use_clauses;
6104
            ((fun x  ->
6093 6105
             ignore
6094 6106
               (List.fold_left
6095 6107
                  (fun sep  ->
6096 6108
                     fun x  ->
6097 6109
                       if sep then Format.fprintf fmt "@;";
6098
                       ((__2 ()) fmt) x;
6110
                       ((__3 ()) fmt) x;
6099 6111
                       Format.fprintf fmt ";";
6100 6112
                       true) false x))) x.declarations;
6101 6113
          Format.fprintf fmt "@;";
6102 6114
          (match x.body with
6103 6115
            | [] -> Format.fprintf fmt "";
6104 6116
            | _ -> Format.fprintf fmt "@[<v 2>begin@;";
6105
          ((fun x  ->
6117
               ((fun x  ->
6106 6118
               ignore
6107 6119
                 (List.fold_left
6108 6120
                    (fun sep  ->
6109 6121
                       fun x  ->
6110 6122
                         if sep then Format.fprintf fmt "@;";
6111
                         ((__3 ()) fmt) x;
6123
                         ((__4 ()) fmt) x;
6112 6124
                         true) false x))) x.body;
6113
          Format.fprintf fmt "@]@;end;"))
6125
           Format.fprintf fmt "@]@;end;"))
6114 6126
    [@ocaml.warning "-A"])
6115 6127

  
6116 6128
and show_vhdl_architecture_t :
......
6146 6158
            :: fields
6147 6159
           in
6148 6160
        let fields =
6161
          if x.use_clauses = []
6162
          then fields
6163
          else
6164
            ("use_clauses",
6165
              (((fun x  ->
6166
                   `List (List.map (fun x  -> vhdl_load_t_to_yojson x) x)))
6167
                 x.use_clauses))
6168
            :: fields
6169
           in
6170
        let fields =
6149 6171
          if x.entity = NoName
6150 6172
          then fields
6151 6173
          else ("entity", (((fun x  -> vhdl_name_t_to_yojson x)) x.entity))
......
6167 6189
  ((let open! Ppx_deriving_yojson_runtime in
6168 6190
      function
6169 6191
      | `Assoc xs ->
6170
          let rec loop xs ((arg0,arg1,arg2,arg3) as _state) =
6192
          let rec loop xs ((arg0,arg1,arg2,arg3,arg4) as _state) =
6171 6193
            match xs with
6172 6194
            | ("name",x)::xs ->
6173 6195
                loop xs
6174
                  (((fun x  -> vhdl_name_t_of_yojson x) x), arg1, arg2, arg3)
6196
                  (((fun x  -> vhdl_name_t_of_yojson x) x), arg1, arg2, arg3,
6197
                    arg4)
6175 6198
            | ("entity",x)::xs ->
6176 6199
                loop xs
6177
                  (arg0, ((fun x  -> vhdl_name_t_of_yojson x) x), arg2, arg3)
6178
            | ("ARCHITECTURE_DECLARATIVE_PART",x)::xs ->
6200
                  (arg0, ((fun x  -> vhdl_name_t_of_yojson x) x), arg2, arg3,
6201
                    arg4)
6202
            | ("use_clauses",x)::xs ->
6179 6203
                loop xs
6180 6204
                  (arg0, arg1,
6181 6205
                    ((function
6182 6206
                      | `List xs ->
6207
                          map_bind (fun x  -> vhdl_load_t_of_yojson x) [] xs
6208
                      | _ ->
6209
                          Result.Error
6210
                            "Vhdl_ast.vhdl_architecture_t.use_clauses") x),
6211
                    arg3, arg4)
6212
            | ("ARCHITECTURE_DECLARATIVE_PART",x)::xs ->
6213
                loop xs
6214
                  (arg0, arg1, arg2,
6215
                    ((function
6216
                      | `List xs ->
6183 6217
                          map_bind (fun x  -> vhdl_declaration_t_of_yojson x)
6184 6218
                            [] xs
6185 6219
                      | _ ->
6186 6220
                          Result.Error
6187 6221
                            "Vhdl_ast.vhdl_architecture_t.declarations") x),
6188
                    arg3)
6222
                    arg4)
6189 6223
            | ("ARCHITECTURE_STATEMENT_PART",x)::xs ->
6190 6224
                loop xs
6191
                  (arg0, arg1, arg2,
6225
                  (arg0, arg1, arg2, arg3,
6192 6226
                    ((function
6193 6227
                      | `List xs ->
6194 6228
                          map_bind
......
6197 6231
                      | _ -> Result.Error "Vhdl_ast.vhdl_architecture_t.body")
6198 6232
                       x))
6199 6233
            | [] ->
6200
                arg3 >>=
6201
                  ((fun arg3  ->
6202
                      arg2 >>=
6203
                        (fun arg2  ->
6204
                           arg1 >>=
6205
                             (fun arg1  ->
6206
                                arg0 >>=
6207
                                  (fun arg0  ->
6208
                                     Result.Ok
6209
                                       {
6210
                                         name = arg0;
6211
                                         entity = arg1;
6212
                                         declarations = arg2;
6213
                                         body = arg3
6214
                                       })))))
6234
                arg4 >>=
6235
                  ((fun arg4  ->
6236
                      arg3 >>=
6237
                        (fun arg3  ->
6238
                           arg2 >>=
6239
                             (fun arg2  ->
6240
                                arg1 >>=
6241
                                  (fun arg1  ->
6242
                                     arg0 >>=
6243
                                       (fun arg0  ->
6244
                                          Result.Ok
6245
                                            {
6246
                                              name = arg0;
6247
                                              entity = arg1;
6248
                                              use_clauses = arg2;
6249
                                              declarations = arg3;
6250
                                              body = arg4
6251
                                            }))))))
6215 6252
            | _::xs -> loop xs _state  in
6216 6253
          loop xs
6217 6254
            ((Result.Ok NoName), (Result.Ok NoName), (Result.Ok []),
6218
              (Result.Ok []))
6255
              (Result.Ok []), (Result.Ok []))
6219 6256
      | _ -> Result.Error "Vhdl_ast.vhdl_architecture_t")
6220 6257
  [@ocaml.warning "-A"])
6221 6258

  
src/backends/VHDL/vhdl_ast_map.ml
474 474
        | Use a -> let a = self#list self#vhdl_name_t a  in Use a
475 475

  
476 476
    method vhdl_architecture_t : vhdl_architecture_t -> vhdl_architecture_t=
477
      fun { name; entity; declarations; body }  ->
477
      fun { name; entity; use_clauses; declarations; body }  ->
478 478
        let name = self#vhdl_name_t name  in
479 479
        let entity = self#vhdl_name_t entity  in
480
        let use_clauses = self#list self#vhdl_load_t use_clauses  in
480 481
        let declarations = self#list self#vhdl_declaration_t declarations  in
481 482
        let body = self#list self#vhdl_concurrent_stmt_t body  in
482
        { name; entity; declarations; body }
483
        { name; entity; use_clauses; declarations; body }
483 484

  
484 485
    method vhdl_configuration_t :
485 486
      vhdl_configuration_t -> vhdl_configuration_t= self#unit
src/tools/importer/vhdl_to_lustre.ml
476 476
        | Use a -> let a = self#list self#vhdl_name_t a  in Use a
477 477

  
478 478
    method vhdl_architecture_t : vhdl_architecture_t -> vhdl_architecture_t=
479
      fun { name; entity; declarations; body }  ->
479
      fun { name; entity; use_clauses; declarations; body }  ->
480 480
        let name = self#vhdl_name_t name  in
481 481
        let entity = self#vhdl_name_t entity  in
482
        let use_clauses = self#list self#vhdl_load_t use_clauses  in
482 483
        let declarations = self#list self#vhdl_declaration_t declarations  in
483 484
        let body = self#list self#vhdl_concurrent_stmt_t body  in
484
        { name; entity; declarations; body }
485
        { name; entity; use_clauses; declarations; body }
485 486

  
486 487
    method vhdl_configuration_t :
487 488
      vhdl_configuration_t -> vhdl_configuration_t= self#unit

Also available in: Unified diff