Project

General

Profile

Download (770 Bytes) Statistics
| Branch: | Tag: | Revision:
1 3ca452f3 ploc
(* 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 55963629 Arnaud Dieumegard
(*
13 3ca452f3 ploc
open Vhdl_ast
14
open Vhdl_test
15 55963629 Arnaud Dieumegard
  *)
16
open Yojson.Safe
17 62b6a61c Arnaud Dieumegard
open Vhdl_ast
18 55963629 Arnaud Dieumegard
open Printf
19
20 3ca452f3 ploc
let _ =
21
  (* Load model with Yojson *)
22 55963629 Arnaud Dieumegard
  let vhdl_json = from_file Sys.argv.(1) in
23
24 62b6a61c Arnaud Dieumegard
  (* Create VHDL values *)
25
  let vhdl = vhdl_file_t_of_yojson vhdl_json in
26 d77323b8 Arnaud Dieumegard
27 62b6a61c Arnaud Dieumegard
  match vhdl with
28
    Ok x ->
29
      Format.printf "Parsed VHDL: \n%s\n" (pretty_to_string (vhdl_file_t_to_yojson x))
30 d77323b8 Arnaud Dieumegard
  | Error e -> Format.printf "Error: %s\n" e;