-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Floating point operations cause unsupported sys call #24
Comments
We can reproduce this issue, but it behaves differently on our system. Actual floating point numbers are processed correctly when using the VP. |
We think the problem described is neither the system-call interface nor any printf issues (which have been resolved). When floating-point operations result in an unsupported system-call, then the reason is likely a trap raised due to an illegal instruction. If that trap is not properly caught, the system-call handler accidentally catches it and, since it is unprepared for such situation, reports "unsupported syscall". Note that a floating-point multiplication is actually illegal in the default setting this riscv-vp comes in. It's unfortunately hidden in the code, but the default ISS is a RV32IMACF (rv32/iss.cpp:1119), or more precisely a rv32 with IMACF + NUS extensions (rv32/csr.h:76). Two more things to note: First, the D extension is not enabled, so floating-point multiplications of type 'double' are not supported (and thus result in raising an illegal instruction trap). See REQUIRE_ISA(D_ISA_EXT) in rv32/iss.cpp:885. So, if you like to execute 'float' and 'double' instructions natively (without the softfloat library), then you need to (1) cross-compile your code with -march=rv32imafd_zicsr -mabi=ilp32d options (or similar), (2) turn on the 'D' extension in the ISS (e.g. csrs.misa.extensions |= D;), and (3) turn on the FPU (e.g. extend ISS::ISS() to also do this: if (csrs.misa.extensions & ((F_ISA_EXT)|(D_ISA_EXT))) csrs.mstatus.fs = FS_INITIAL; With these adjustments, we can explore the benefits of the F and D extensions easily. Hope this helps! |
Executing baremetal C code with floating point numbers causes the VP to throw the following error:
unsupported syscall '0'
Error: (E549) uncaught exception: unsupported syscall '0'
In file: ../../../src/sysc/kernel/sc_except.cpp:101
In process: run0 @ 8940 ns
make: *** [Makefile:5: sim] Error 1
This error is reproducable with the provied printf-float software example in the repository. I'm aware thath printf() can cause strange behaviour, but the error occurs also without calling the printf() function. Just multiplying two floating point numbers causes the same behaviour.
I tested it with the basic riscv-vp an the compiler flags from the printf-float software example function.
The behaviour is the same when I use the --intercept-syscalls command when invoking the riscv-vp.
Tested on Ubuntu 20.04, but also on with the provided Dockerfile. Same issues.
Has someone expirienced something similar or has an ide what could be the problem?
The text was updated successfully, but these errors were encountered: