riscv-software-src / riscv-pk

RISC-V Proxy Kernel
Other
570 stars 304 forks source link

pk running v-extension problem #293

Closed adamsir32 closed 1 year ago

adamsir32 commented 1 year ago

my code is as followed:

include

define SIZE 10

int main() { int arr1[SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int arr2[SIZE] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; int arr3[SIZE];

for (int i = 0; i < SIZE; i++) { arr3[i] = arr1[i] + arr2[i]; }

printf("Result:\n"); for (int i = 0; i < SIZE; i++) { printf("%d ", arr3[i]); } printf("\n");

return 0; } The following is some of the assembly code, which contains V-extension instructions: .L2: vsetvli a6,a5,e32,m1,ta,mu vle32.v v24,(a0) vle32.v v25,(a1) sub a5,a5,a6 vadd.vv v24,v24,v25 vse32.v v24,(a4) add a0,a0,a2 add a1,a1,a2 add a4,a4,a2 bne a5,zero,.L2 lui a0,%hi(.LC2) addi a0,a0,%lo(.LC2) call puts addi s2,s0,40 lui s1,%hi(.LC3) but when i ues: riscv64-unknown-linux-gnu-gcc -O3 test.c spike --isa=RV64GCV $( which pk) a.out have fault: Access exception occurred while loading payload a.out: Memory address 0x10730 is invalid