Skip to content

Commit

Permalink
allow config of riscv-to-calyx binary + riscv-as location
Browse files Browse the repository at this point in the history
  • Loading branch information
sgpthomas committed Aug 16, 2024
1 parent dc7b9d0 commit 3831638
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<path to riscv-to-calyx binary>"
# for development on riscv-to-calyx
# exe = "cargo run --manifest-path=<path to riscv-to-calyx Cargo.toml>"
#+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
Expand Down
7 changes: 5 additions & 2 deletions fud2/riscv.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 3831638

Please sign in to comment.