Project

General

Profile

Download (986 Bytes) Statistics
| Branch: | Tag: | Revision:
1
(* An application that loads json provided input and produces Lustre
2

    
3
Usage:
4
lustrei -vhdl myvhdl.json 
5
lustrei -scade myscademodel.json 
6
  will produce a lustre file that can be compiled and analyzed
7

    
8
VHDL is handled in a double way: as a backend and as an import language
9
In a first step, lustrei -vhdl -print myvhdl.json shall print the VHDL model in stdout
10

    
11
 *)
12
(*
13
open Vhdl_ast
14
open Vhdl_test
15
  *)
16
open Yojson.Safe
17
open Vhdl_ast_utils
18
open Vhdl_ast_map
19
open Vhdl_ast
20
open Ppxlib_traverse_builtins
21
open Printf
22

    
23
let _ =
24
  (* Load model with Yojson *)
25
  let vhdl_json = from_file Sys.argv.(1) in
26

    
27
  (* Create VHDL values *)
28
  let vhdl = vhdl_file_t_of_yojson vhdl_json in
29

    
30
  (* Simplify VHDL values *)
31
  match vhdl with
32
    Ok x ->
33
      Format.printf "Parsed VHDL: \n%s\n" (pretty_to_string (vhdl_file_t_to_yojson x));
34
      let folded = replace_op_expr#vhdl_file_t x in
35
      Format.printf "PP VHDL: \n%s\n" (show_vhdl_file_t folded);
36
  | Error e -> Format.printf "Error: %s\n" e;
37

    
(1-1/4)