-
So, apologies in advance if this question is too "Noob" or obvious, I tried a few things before I resorted to asking. How to actually run Sail code ? For context, I want to to modify How to actually execute this new main and see the actual output from the As a wider context: I made (as part of GSoC and the wonderful people at https://github.com/rizinorg/rizin/ and https://github.com/capstone-engine/capstone/) a generator tool that generates comprehensible C code for the As part of testing the generated code, mainly So, tldr; I want to run sail code, and I can't. What I tried: (1) I tried running (2) There is the C option, but, first, the cgen target in the Makefile is probably buggy, it passes the argument As a bonus question, if I want the bare minimum of additional work besides being able to call Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Did you read https://github.com/riscv/sail-riscv/blob/master/README.md#getting-started? It covers all this. But the TL;DR is that |
Beta Was this translation helpful? Give feedback.
-
So what happens is this:
That can be disabled via the If you are writing code outside of the RISC-V model you can do something like this script that I use as a "Sail playground": #!/bin/bash
set -e
SAIL_LIB=$(sail -dir)
sail main.sail -c -o model
cc model.c -o model -O -I "$SAIL_LIB/lib" $SAIL_LIB/lib/*.c -lgmp -lz
./model If you want to run your own Another option instead of calling
In the long term you would want to add a target that compiles the sail code but without |
Beta Was this translation helpful? Give feedback.
So what happens is this:
function main() -> unit = ...
gets compiled to a function calledzmain
in C, something like this:main()
:That can be disabled via the
--c-no-main
flag. In the RISC-V model I don't believe we usemain()
at all, except maybe formake interp
? I've never used that though tbh.If …