Project

General

Profile

Revision e1102543

View differences:

src/tools/importer/vhdl_ast.ml
18 18
let literal_base = ["B"; "O"; "X"; "UB"; "UO"; "UX"; "SB"; "SO"; "SX"; "D"] (* Prefix of CstLiteral *)
19 19

  
20 20
(* TODO: do we need more constructors ? *)
21
type cst_val_t = 
21
type vhdl_cst_val_t = 
22 22
    CstInt of int 
23 23
  | CstStdLogic of string
24 24
  | CstLiteral of string [@name "CST_LITERAL"]
......
61 61
  | Subtype of {name : vhdl_name_t ; typ : vhdl_subtype_indication_t} [@name "SUBTYPE_DECLARATION"]
62 62
and vhdl_expr_t =
63 63
  | Call of vhdl_name_t [@name "CALL"]
64
  | Cst of cst_val_t [@name "CONSTANT_VALUE"]
64
  | Cst of vhdl_cst_val_t [@name "CONSTANT_VALUE"]
65 65
  | Op of { id: string [@default ""]; args: vhdl_expr_t list [@default []]} [@name "EXPRESSION"]
66 66
  | IsNull [@name "IsNull"]
67 67
  | Time of { value: int; phy_unit: string [@default ""]}
......
133 133
    names: vhdl_name_t list;
134 134
    mode: string list [@default []];
135 135
    typ: vhdl_subtype_indication_t;
136
    init_val: cst_val_t option [@default Some (CstInt (0))];
136
    init_val: vhdl_cst_val_t option [@default Some (CstInt (0))];
137 137
  }
138 138
[@@deriving show { with_path = false }, yojson {strict = false}];;
139 139

  
......
182 182
  | VarDecl of {
183 183
      names : vhdl_name_t list; 
184 184
      typ : vhdl_subtype_indication_t; 
185
      init_val : cst_val_t option [@default Some (CstInt (0))] 
185
      init_val : vhdl_cst_val_t option [@default Some (CstInt (0))] 
186 186
    } [@name "VARIABLE_DECLARATION"]
187 187
  | CstDecl of { 
188 188
      names : vhdl_name_t list; 
189 189
      typ : vhdl_subtype_indication_t; 
190
      init_val : cst_val_t 
190
      init_val : vhdl_cst_val_t 
191 191
    } [@name "CONSTANT_DECLARATION"]
192 192
  | SigDecl of { 
193 193
      names : vhdl_name_t list; 
194 194
      typ : vhdl_subtype_indication_t; 
195
      init_val : cst_val_t option [@default Some (CstInt (0))] 
195
      init_val : vhdl_cst_val_t option [@default Some (CstInt (0))] 
196 196
    } [@name "SIGNAL_DECLARATION"]
197 197
  | Subprogram of {
198 198
      name: vhdl_name_t [@default NoName]; 
src/tools/importer/vhdl_ast_map.ml
1 1
open Vhdl_ast
2 2

  
3
let _ = fun (_ : cst_val_t)  -> () 
3
let _ = fun (_ : vhdl_cst_val_t)  -> () 
4 4
let _ = fun (_ : vhdl_type_t)  -> () 
5 5
let _ = fun (_ : vhdl_subtype_indication_t)  -> () 
6 6
let _ = fun (_ : vhdl_discrete_range_t)  -> () 
......
61 61
    method virtual  vhdl_declaration_t : vhdl_declaration_t -> vhdl_declaration_t
62 62
    method virtual  vhdl_sequential_stmt_t : vhdl_sequential_stmt_t -> vhdl_sequential_stmt_t
63 63
    method virtual  vhdl_signal_condition_t : vhdl_signal_condition_t -> vhdl_signal_condition_t
64
    method virtual  cst_val_t : cst_val_t -> cst_val_t
64
    method virtual  vhdl_cst_val_t : vhdl_cst_val_t -> vhdl_cst_val_t
65 65
    method virtual  vhdl_subprogram_spec_t : vhdl_subprogram_spec_t -> vhdl_subprogram_spec_t
66 66
    method virtual  vhdl_discrete_range_t : vhdl_discrete_range_t -> vhdl_discrete_range_t
67 67
    method virtual  vhdl_parameter_t : vhdl_parameter_t -> vhdl_parameter_t
......
76 76
    method virtual  vhdl_design_unit_t : vhdl_design_unit_t -> vhdl_design_unit_t
77 77
    method virtual  vhdl_design_file_t : vhdl_design_file_t -> vhdl_design_file_t
78 78

  
79
    method cst_val_t : cst_val_t -> cst_val_t=
79
    method vhdl_cst_val_t : vhdl_cst_val_t -> vhdl_cst_val_t=
80 80
      fun x  ->
81 81
        match x with
82 82
        | CstInt a -> let a = self#int a  in CstInt a
......
152 152
      fun x  ->
153 153
        match x with
154 154
        | Call a -> let a = self#vhdl_name_t a  in Call a
155
        | Cst a -> let a = self#cst_val_t a  in Cst a
155
        | Cst a -> let a = self#vhdl_cst_val_t a  in Cst a
156 156
        | Op { id; args } ->
157 157
            let id = self#string id  in
158 158
            let args = self#list self#vhdl_expr_t args  in Op { id; args }
......
265 265
        let names = self#list self#vhdl_name_t names  in
266 266
        let mode = self#list self#string mode  in
267 267
        let typ = self#vhdl_subtype_indication_t typ  in
268
        let init_val = self#option self#cst_val_t init_val  in
268
        let init_val = self#option self#vhdl_cst_val_t init_val  in
269 269
        { names; mode; typ; init_val }
270 270

  
271 271
    method vhdl_subprogram_spec_t :
......
333 333
        | VarDecl { names; typ; init_val } ->
334 334
            let names = self#list self#vhdl_name_t names  in
335 335
            let typ = self#vhdl_subtype_indication_t typ  in
336
            let init_val = self#option self#cst_val_t init_val  in
336
            let init_val = self#option self#vhdl_cst_val_t init_val  in
337 337
            VarDecl { names; typ; init_val }
338 338
        | CstDecl { names; typ; init_val } ->
339 339
            let names = self#list self#vhdl_name_t names  in
340 340
            let typ = self#vhdl_subtype_indication_t typ  in
341
            let init_val = self#cst_val_t init_val  in
341
            let init_val = self#vhdl_cst_val_t init_val  in
342 342
            CstDecl { names; typ; init_val }
343 343
        | SigDecl { names; typ; init_val } ->
344 344
            let names = self#list self#vhdl_name_t names  in
345 345
            let typ = self#vhdl_subtype_indication_t typ  in
346
            let init_val = self#option self#cst_val_t init_val  in
346
            let init_val = self#option self#vhdl_cst_val_t init_val  in
347 347
            SigDecl { names; typ; init_val }
348 348
        | Subprogram { name; kind; spec; decl_part; stmts } ->
349 349
            let name = self#vhdl_name_t name  in

Also available in: Unified diff