ucb-bar / riscv-mini

Simple RISC-V 3-stage Pipeline in Chisel
Other
538 stars 110 forks source link

riscv-mini doesn't support print and declare the float data type variable #14

Closed jtxiao82 closed 3 years ago

jtxiao82 commented 6 years ago

Hi,

I try to use the test.ld, syscall.c and crt.S from (riscv-tools and checkout to 4635ab67966c763a84f7217bc2c20b65dcabc7ec. Those sources exist in riscv-tests/benchmarks/common/. These two steps follow riscv-mini/build-riscv-tools.sh) for building the custom-bmark.

It would be success for compiling program and execute simulation with no any warning like (TOHOST: XXXX).

The simulation warning will occur during execution the system call (like printf) or floating variable computation. The screenshot shows the warning during the previous two scenarios.

main.c

int add(int a, int b);

int main(int argc, char** argv) {
  int res = add(3, 2);

  // Simple float variable computation
  float a = 1.0;
  for(int i = 0; i < 10; i++) {
    a += 0.5;
  }

  return res == 5 ? 0 : -1;
}

image

Environment

There is an another question. Could riscv-mini team provide the some source code (riscv-mini/src/test/resources/) and its corresponding crt.S, syscall.c, util.h, linker sciprt (test.ld).

Thanks you very much!!

hz0ne commented 3 years ago

Riscv-mini just support the basic RV32I ISA, so that float type will report error. This issue should be closed.