From 3831638663d12c2d729cb3deb905fd716edbcf64 Mon Sep 17 00:00:00 2001 From: Samuel Thomas Date: Fri, 16 Aug 2024 15:24:50 -0500 Subject: [PATCH] allow config of riscv-to-calyx binary + riscv-as location --- README.org | 11 +++++++++++ fud2/riscv.rhai | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index ce3b8b4..10b02be 100644 --- a/README.org +++ b/README.org @@ -19,6 +19,17 @@ plugins = [ ] #+end_example +You will also want to set the =riscv.exe= variable either in your config or on the command line. Here's what the config looks like. + +#+begin_example +[riscv] +exe = "" +# for development on riscv-to-calyx +# exe = "cargo run --manifest-path=" +#+end_example + +You will need =riscv64-unknown-elf-as= installed. If the binary isn't located on the path, you can specify it's location in =fud2.toml= under the variable =riscv.assembler=. + You should be able to see =riscv-simulate= and =riscv-decode= operations in the output of =fud2 list=. To simulate the =riscv-to-calyx/data/simple.s= file, you can run diff --git a/fud2/riscv.rhai b/fud2/riscv.rhai index 1516595..1158869 100644 --- a/fud2/riscv.rhai +++ b/fud2/riscv.rhai @@ -26,10 +26,13 @@ fn riscv_sim_setup(e) { } fn riscv_setup(e) { - e.var_("riscv-cmd", "cargo run --manifest-path=../riscv-to-calyx/Cargo.toml"); + e.config_var_or("riscv-cmd", "riscv.exe", "riscv-to-calyx"); + // e.var_("riscv-cmd", "cargo run --manifest-path=../riscv-to-calyx/Cargo.toml"); + e.config_var_or("riscv-as", "riscv.assembler", "riscv64-unknown-elf-as"); + e.rule( "riscv-encode", - "$riscv-cmd encode $in --data ram:16:32:1 --data reg_file:32:32 --data dbg:1:32 > $out" + "$riscv-cmd encode $in -a $riscv-as --data ram:16:32:1 --data reg_file:32:32 --data dbg:1:32 > $out" ); e.rule("riscv-decode", "$riscv-cmd decode $in > $out"); }