Commit 9e4b5902 authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Take #reset pragmas into account + adapt to the new RdbgPlugin.t 1.177 api

(that now have a reset field)
parent 847a16d7
Pipeline #9677 passed with stages
in 8 minutes and 35 seconds
...@@ -87,12 +87,15 @@ $(WWW)/pool/$(PACKNAME).tgz: $(PACKNAME).tgz ...@@ -87,12 +87,15 @@ $(WWW)/pool/$(PACKNAME).tgz: $(PACKNAME).tgz
$(WWWTEST)/pool/$(PACKNAME).tgz: $(PACKNAME).tgz $(WWWTEST)/pool/$(PACKNAME).tgz: $(PACKNAME).tgz
mv $^ $@ mv $^ $@
OPAM_FILE=$(shell find $(WWW)/opam-repository/packages -name opam -cmin -2 | sed -e 's/^./\U&/') OPAM_FILE=$(shell find $(WWW)/opam-repository/packages -name opam | grep Lutin | sort | tail -1 | sed -e 's/^./\U&/')
OPAM_FILE_TEST=$(shell find $(WWWTEST)/opam-repository/packages -name opam -cmin -1 | sed -e 's/^./\U&/') OPAM_FILE_TEST=$(shell find $(WWWTEST)/opam-repository/packages -name opam | grep Lutin | sort | tail -1 | sed -e 's/^./\U&/')
OPAM_DIR=$(shell dirname $(OPAM_FILE)) OPAM_DIR=$(shell dirname $(OPAM_FILE))
OFFICIAL_OPAM_DIR=/home/jahier/local/opam-repository/packages/lutin OFFICIAL_OPAM_DIR=/home/jahier/local/opam-repository/packages/lutin
x:
echo $(OPAM_FILE_TEST)
opam : $(WWW)/pool/$(PACKNAME).tgz opam : $(WWW)/pool/$(PACKNAME).tgz
cd $(WWW)/opam-repository/packages && \ cd $(WWW)/opam-repository/packages && \
oasis2opam $(HTTP)/pool/$(PACKNAME).tgz && \ oasis2opam $(HTTP)/pool/$(PACKNAME).tgz && \
......
OASISFormat: 0.4 OASISFormat: 0.4
Name: Lutin Name: Lutin
Version: 2.56 Version: 2.57
Authors: Erwan Jahier, Pascal Raymond, Bertrand Jeannnet (polka), Yvan Roux Authors: Erwan Jahier, Pascal Raymond, Bertrand Jeannnet (polka), Yvan Roux
Maintainers: erwan.jahier@univ-grenoble-alpes.fr Maintainers: erwan.jahier@univ-grenoble-alpes.fr
License: CeCILL License: CeCILL
...@@ -27,7 +27,7 @@ SourceRepository "master" ...@@ -27,7 +27,7 @@ SourceRepository "master"
Executable lutin Executable lutin
Path: lutin/src Path: lutin/src
MainIs: main.ml MainIs: main.ml
BuildDepends: str,unix,num,rdbg-plugin (>= 1.170),lutin-utils,ezdl,gbddml,polka,camlp4,camlidl,gmp BuildDepends: str,unix,num,rdbg-plugin (>= 1.177),lutin-utils,ezdl,gbddml,polka,camlp4,camlidl,gmp
NativeOpt: -package num # XXX turn around a bug in oasis/ocamlbuild/ocamlfind? NativeOpt: -package num # XXX turn around a bug in oasis/ocamlbuild/ocamlfind?
Build: true Build: true
Install:true Install:true
...@@ -69,7 +69,7 @@ Library "lutin-utils" ...@@ -69,7 +69,7 @@ Library "lutin-utils"
Executable lurette Executable lurette
Path: lurette-nocaml/src Path: lurette-nocaml/src
MainIs: lurette.ml MainIs: lurette.ml
BuildDepends: str,unix,num,dynlink,extlib,camlp4,lutils (>= 1.9),lutin-utils,ezdl,gbddml,polka,camlp4,camlidl,gmp,rdbg-plugin,lustre-v6,lutin BuildDepends: str,unix,num,dynlink,extlib,camlp4,lutils (>= 1.9),lutin-utils,ezdl,gbddml,polka,camlp4,camlidl,gmp,rdbg-plugin (>= 1.177),lustre-v6,lutin
NativeOpt: rdbg4lurette.cmxa # for some reasons not recogniezd as a package NativeOpt: rdbg4lurette.cmxa # for some reasons not recogniezd as a package
Install:true Install:true
CompiledObject: native CompiledObject: native
......
...@@ -36,6 +36,7 @@ let _ = ...@@ -36,6 +36,7 @@ let _ =
let init _ = () let init _ = ()
let kill _ = () let kill _ = ()
let reset _ = ()
type var_type = string type var_type = string
...@@ -157,6 +158,7 @@ let plugin = { ...@@ -157,6 +158,7 @@ let plugin = {
id="ze rabbit plugin"; id="ze rabbit plugin";
inputs = inputs; inputs = inputs;
outputs= outputs; outputs= outputs;
reset= reset;
kill= kill; kill= kill;
init_inputs=mems_i; init_inputs=mems_i;
init_outputs=mems_o; init_outputs=mems_o;
......
(* Time-stamp: <modified the 09/05/2018 (at 15:49) by Erwan Jahier> *) (* Time-stamp: <modified the 05/07/2018 (at 14:30) by Erwan Jahier> *)
open RdbgPlugin open RdbgPlugin
type vars = (string * Data.t) list type vars = (string * Data.t) list
...@@ -119,6 +119,7 @@ let (make_ec : string -> RdbgPlugin.t) = ...@@ -119,6 +119,7 @@ let (make_ec : string -> RdbgPlugin.t) =
id = ""; id = "";
inputs = ec_in; inputs = ec_in;
outputs= ec_out; outputs= ec_out;
reset= (fun () -> RifIO.write ec_oc "#reset\n"; flush ec_oc);
kill= kill; kill= kill;
init_inputs= []; init_inputs= [];
init_outputs= []; init_outputs= [];
...@@ -240,6 +241,7 @@ let (make_socket_do : string -> int -> in_channel * RdbgPlugin.t) = ...@@ -240,6 +241,7 @@ let (make_socket_do : string -> int -> in_channel * RdbgPlugin.t) =
id = ""; id = "";
inputs = vars_in; inputs = vars_in;
outputs= vars_out; outputs= vars_out;
reset= (fun () -> RifIO.write sock_out "#reset\n"; flush sock_out);
kill= kill; kill= kill;
init_inputs= []; init_inputs= [];
init_outputs= []; init_outputs= [];
...@@ -346,6 +348,7 @@ let (make_ec_exe : string -> RdbgPlugin.t) = ...@@ -346,6 +348,7 @@ let (make_ec_exe : string -> RdbgPlugin.t) =
id = ""; id = "";
inputs = ec_in; inputs = ec_in;
outputs= ec_out; outputs= ec_out;
reset= (fun () -> RifIO.write ec_oc "#reset\n"; flush ec_oc);
kill= kill; kill= kill;
init_inputs= []; init_inputs= [];
init_outputs= []; init_outputs= [];
......
(* Time-stamp: <modified the 30/03/2017 (at 17:58) by Erwan Jahier> *) (* Time-stamp: <modified the 05/07/2018 (at 14:20) by Erwan Jahier> *)
(**********************************************************************************) (**********************************************************************************)
type vars = (string * Data.t) list type vars = (string * Data.t) list
...@@ -110,6 +110,14 @@ let make argv = ...@@ -110,6 +110,14 @@ let make argv =
id = Printf.sprintf "%s (%s)" id version; id = Printf.sprintf "%s (%s)" id version;
inputs = lut_in; inputs = lut_in;
outputs= lut_out; outputs= lut_out;
reset = (fun () -> (
ctrl_state := (LutExe.get_init_state lut_mach);
data_state :=
{ LutExe.ins = Value.OfIdent.empty;
LutExe.outs = lut_memories;
LutExe.mems = LutExe.get_init_pres lut_mach
}
));
kill=(fun _ -> ()); kill=(fun _ -> ());
init_inputs=mems_in; init_inputs=mems_in;
init_outputs=mems_out; init_outputs=mems_out;
......
...@@ -137,34 +137,41 @@ let rec to_simu oc infile mnode opt = ( ...@@ -137,34 +137,41 @@ let rec to_simu oc infile mnode opt = (
let noo = not (MainArg.only_outputs opt) in let noo = not (MainArg.only_outputs opt) in
Random.init seed; Random.init seed;
if MainArg.compute_volume opt then Solver.set_fair_mode () else Solver.set_efficient_mode (); if MainArg.compute_volume opt then Solver.set_fair_mode ()
else Solver.set_efficient_mode ();
!Solver.init_snt (); !Solver.init_snt ();
Rif.write oc msg; Rif.write oc msg;
Rif.write_interface oc init_state.Prog.s.Prog.in_vars init_state.Prog.s.Prog.out_vars loc None; Rif.write_interface oc init_state.Prog.s.Prog.in_vars
init_state.Prog.s.Prog.out_vars loc None;
Rif.flush oc; Rif.flush oc;
let next_state = init_state in let next_state = init_state in
let lut_memories = let lut_memories =
if MainArg.load_mem opt then ( if MainArg.load_mem opt then (
output_string oc "#lutin_outputs_memories "; output_string oc "#lutin_outputs_memories ";
Rif.read (Verbose.level()>0) stdin (if noo then Some oc else None) init_state.Prog.s.Prog.out_vars) Rif.read (Verbose.level()>0) stdin (if noo then Some oc else None)
init_state.Prog.s.Prog.out_vars)
else else
Value.OfIdent.empty Value.OfIdent.empty
in in
(* first main_loop : no pre context *) (* first main_loop : no pre context *)
main_loop oc opt 1 next_state lut_memories main_loop oc opt 1 next_state lut_memories next_state lut_memories
) )
and main_loop oc opt t state pre_lut_output = ( and main_loop oc opt t init_state init_pre_lut_output state pre_lut_output = (
Verbose.exe ( fun () -> Verbose.exe ( fun () ->
let csnme = (Prog.ctrl_state_to_string_long state.Prog.d.Prog.ctrl_state) in let csnme = (Prog.ctrl_state_to_string_long state.Prog.d.Prog.ctrl_state) in
Verbose.put "#Main.main_loop ctrl_state=%s\n" csnme; Verbose.put "#Main.main_loop ctrl_state=%s\n" csnme;
); );
if state.Prog.s.Prog.is_final state.Prog.d.Prog.ctrl_state if state.Prog.s.Prog.is_final state.Prog.d.Prog.ctrl_state
then () then ()
else main_loop_core oc opt t state pre_lut_output else
try
main_loop_core oc opt t init_state init_pre_lut_output state pre_lut_output
with RifIO.Reset ->
main_loop_core oc opt t init_state init_pre_lut_output init_state init_pre_lut_output
) )
and main_loop_core oc opt t state pre_lut_output = ( and main_loop_core oc opt t init_state init_pre_lut_output state pre_lut_output = (
let step_str = let step_str =
("#step " ^ (string_of_int t)) ^ ("#step " ^ (string_of_int t)) ^
(if state.Prog.d.Prog.verbose >= 1 (if state.Prog.d.Prog.verbose >= 1
...@@ -175,7 +182,9 @@ and main_loop_core oc opt t state pre_lut_output = ( ...@@ -175,7 +182,9 @@ and main_loop_core oc opt t state pre_lut_output = (
let noo = not (MainArg.only_outputs opt) in let noo = not (MainArg.only_outputs opt) in
let _ = if noo then Rif.write oc step_str in let _ = if noo then Rif.write oc step_str in
let lut_input = if t=1 && (boot opt) then Value.OfIdent.empty else let lut_input = if t=1 && (boot opt) then Value.OfIdent.empty else
Rif.read (Verbose.level()>0) stdin (if noo then Some oc else None) state.Prog.s.Prog.in_vars in Rif.read (Verbose.level()>0) stdin (if noo then Some oc else None)
state.Prog.s.Prog.in_vars
in
let generator = LucFGen.get lut_input state in let generator = LucFGen.get lut_input state in
(* (*
Call Lucky explorer/solver Call Lucky explorer/solver
...@@ -223,12 +232,13 @@ and main_loop_core oc opt t state pre_lut_output = ( ...@@ -223,12 +232,13 @@ and main_loop_core oc opt t state pre_lut_output = (
!Solver.clear_snt (); !Solver.clear_snt ();
match MainArg.max_steps opt with match MainArg.max_steps opt with
| None -> main_loop oc opt (t+1) next_state lut_output | None -> main_loop oc opt (t+1) init_state init_pre_lut_output
next_state lut_output
| Some max -> ( | Some max -> (
if (t < max) then ( if (t < max) then (
(* next pre's are current vals *) (* next pre's are current vals *)
(* let next_state = LutProg.memorize_data next_state lut_input lut_output loc in *) (* let next_state = LutProg.memorize_data next_state lut_input lut_output loc in *)
main_loop oc opt(t+1) next_state lut_output main_loop oc opt(t+1) init_state init_pre_lut_output next_state lut_output
) else ( ) else (
if noo then Rif.write oc "\n#end\n" else Rif.write oc "\nq\n"; if noo then Rif.write oc "\n#end\n" else Rif.write oc "\nq\n";
Rif.flush oc) Rif.flush oc)
...@@ -257,7 +267,7 @@ let to_exe oc infile mnode opt = ( ...@@ -257,7 +267,7 @@ let to_exe oc infile mnode opt = (
in in
let noo = not (MainArg.only_outputs opt) in let noo = not (MainArg.only_outputs opt) in
let rec do_step cpt ctrl ins pres = ( let rec do_step cpt init_ctrl init_ins init_pres ctrl ins pres = (
(* Clean-up cached info that depend on pre or inputs *) (* Clean-up cached info that depend on pre or inputs *)
Formula_to_bdd.clear_step (); Formula_to_bdd.clear_step ();
...@@ -328,11 +338,14 @@ let to_exe oc infile mnode opt = ( ...@@ -328,11 +338,14 @@ let to_exe oc infile mnode opt = (
Rif.write oc step_str; Rif.write oc step_str;
Rif.flush oc Rif.flush oc
); );
let pres' = LutExe.make_pre exe ins outs locs in try
let ins' = Rif.read (Verbose.level()>0) stdin let pres' = LutExe.make_pre exe ins outs locs in
(if noo then Some oc else None) in_vars in let ins' = Rif.read (Verbose.level()>0) stdin
MainArg.event_incr opt; (if noo then Some oc else None) in_vars in
do_step (cpt+1) ctrl' ins' pres' MainArg.event_incr opt;
do_step (cpt+1) init_ctrl init_ins init_pres ctrl' ins' pres'
with RifIO.Reset ->
do_step (cpt+1) init_ctrl init_ins init_pres init_ctrl init_ins init_pres
) )
) )
| LutExe.Raise x -> ( | LutExe.Raise x -> (
...@@ -379,7 +392,7 @@ let to_exe oc infile mnode opt = ( ...@@ -379,7 +392,7 @@ let to_exe oc infile mnode opt = (
in in
(* HERE: init input/output pres *) (* HERE: init input/output pres *)
let pres = LutExe.get_init_pres exe in let pres = LutExe.get_init_pres exe in
do_step cpt ctrl ins pres do_step cpt ctrl ins pres ctrl ins pres
) )
(* TEST (* TEST
......
let str="2.56" let str="2.57"
let sha="a7040a2" let sha="847a16d"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment