From c16c1128564d497ac07023f42dae8c6ea2bf3731 Mon Sep 17 00:00:00 2001 From: Griffin Berlstein Date: Mon, 15 Jul 2024 12:03:58 -0400 Subject: [PATCH] tweak the rhai files --- fud2/scripts/cider.rhai | 100 ++++++++++++---------------------------- 1 file changed, 30 insertions(+), 70 deletions(-) diff --git a/fud2/scripts/cider.rhai b/fud2/scripts/cider.rhai index 85ad6e23c5..0aa8a2da42 100644 --- a/fud2/scripts/cider.rhai +++ b/fud2/scripts/cider.rhai @@ -2,58 +2,39 @@ import "rtl_sim" as sim; import "testbench" as tb; import "calyx" as c; -let dbg = state("debug", []); +let dbg = state("cider-debug", []); let cider_state = state("cider", []); fn cider_setup(e) { - e.config_var_or( - "cider-exe", - "cider.exe", - "$calyx-base/target/debug/cider", - ); - e.config_var_or( - "cider-converter", - "cider-converter.exe", - "$calyx-base/target/debug/cider-data-converter", - ); - e.rule( - "cider", - "$cider-exe -l $calyx-base --raw --data data.json $in > $out", - ); - e.rule( - "cider-debug", - "$cider-exe -l $calyx-base --data data.json $in debug || true", - ); - e.arg("pool", "console"); + e.config_var_or( + "cider-exe", + "cider.exe", + "$calyx-base/target/debug/cider", + ); + e.config_var_or( + "cider-converter", + "cider-converter.exe", + "$calyx-base/target/debug/cider-data-converter", + ); + e.rule( + "run-cider-debug", + "$cider-exe -l $calyx-base --data data.dump $in debug || true", + ); + e.arg("pool", "console"); - // TODO Can we reduce the duplication around and `$python`? - e.rsrc("interp-dat.py"); - e.config_var_or("python", "python", "python3"); - e.rule("dat-to-interp", "$python interp-dat.py --to-interp $in"); - e.rule( - "interp-to-dat", - "$python interp-dat.py --from-interp $in $sim_data > $out", - ); - e.build_cmd( - ["data.json"], - "dat-to-interp", - ["$sim_data"], - ["interp-dat.py"], - ); + e.rule( + "run-cider", + "$cider-exe -l $calyx-base --data data.dump $in > $out", + ); - e.rule( - "run-cider", - "$cider-exe -l $calyx-base --data data.dump $in > $out", - ); - - e.rule("dump-to-interp", "$cider-converter --to cider $in > $out"); - e.rule("interp-to-dump", "$cider-converter --to json $in > $out"); - e.build_cmd( - ["data.dump"], - "dump-to-interp", - ["$sim_data"], - ["$cider-converter"], - ); + e.rule("dump-to-interp", "$cider-converter --to cider $in > $out"); + e.rule("interp-to-dump", "$cider-converter --to json $in > $out"); + e.build_cmd( + ["data.dump"], + "dump-to-interp", + ["$sim_data"], + ["$cider-converter"], + ); } op( @@ -71,27 +52,6 @@ op( }, ); -op( - "interp", - [ - sim::sim_setup, - tb::standalone_setup, - c::calyx_setup, - cider_setup, - ], - c::calyx_state, - sim::dat, - |e, input, output| { - let out_file = "interp_out.json"; - e.build_cmd([out_file], "cider", [input], ["data.json"]); - e.build_cmd( - [output], - "interp-to-dat", - [out_file], - ["$sim_data", "interp-dat.py"], - ); - }, -); op( "cider", @@ -123,9 +83,9 @@ op( c::calyx_setup, cider_setup, ], - c::calyx_state, + cider_state, dbg, |e, input, output| { - e.build_cmd([output], "cider-debug", [input], ["data.json"]); + e.build_cmd([output], "run-cider-debug", [input], ["data.dump"]); }, );