riscv_vhdl
riscv_vhdl copied to clipboard
problem compilation with options: -march=rv64imafd -DFPU_ENABLED
Здравствуйте! Попробовали пересобрать helloworld с функцией сложения двух чисел типа double. Использовали компилятор riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14 от SiFive с опциями -march=rv64imafd -DFPU_ENABLED. В helloworld.dump в разделе функции fadd присутсвует недокументированная команда fmv.d. При моделировании в данном месте возникает исключение из-за нелегальной операции.
Как можно решить данную проблему?
Листинг модифицированной части helloworld.c прилагаю:
double fadd(double a, double b){ double c=a+b; return c; }
void helloWorld() { char ss[256]; int ss_len; ss_len = sprintf(ss, "Hellow World - %d!!!!\n", 1); print_uart(ss, ss_len); fadd(10,10); }
I can reproduce this exception. CPU module doesn't support Compressed version of the instruction FLD (load double value from memory), so there's several options:
-
Add this instruction into simulation
-
Disable hardware FPU
-
Disable compressed instruction set. It can be done by adding at the beginning of the any *.cpp file the following option so that Compressed instruction set will be disabled only for this file:
asm(".option norvc");
-
Wait until I will add this instructions into RTL and simulation.