Reputation: 39
The program stores an array of 25 integers (words). Then calculate the sum of the positive numbers and the sum of the negative numbers, then print the total of both positive and negative numbers.
Error Messages:
Error in /Users/COD/subtractandadd.asm line 76 column 15: "v0": operand is of incorrect type
Error in /Users/COD/subtractandadd.asm line 80 column 15: "v0": operand is of incorrect type
Error in /Users/COD/subtractandadd.asm line 81 column 12: "la": Too many or incorrectly formatted operands. Expected: la t1,label
Error in /Users/COD/subtractandadd.asm line 85 column 15: "v0": operand is of incorrect type
Error in /Users/COD/subtractandadd.asm line 89 column 15: "v0": operand is of incorrect type
Error in /Users/COD/subtractandadd.asm line 90 column 12: "la": Too many or incorrectly formatted operands. Expected: la t1,label
Error in /Users/COD/subtractandadd.asm line 92 column 11: "v0": operand is of incorrect type
Print and Exit Code:
#exit and print
exit:
#print the positive numbers total
li v0,4
la a0,totalPositive
ecall
#print the +ve sum
li v0,1
la a0,($s1)
ecall
#print the negative total
li v0,4
la a0,totalNegative
ecall
#print the -ve sum
li v0,1
la a0,($s2)
ecall
li v0,10 #end of program exit
ecall
Upvotes: 0
Views: 922
Reputation: 1746
You are using v0 registers which are only available with vector extension. If you toolchain.
The compiler and the "standard" binutils of the gnu toolchain don't seem supporting it yet. There is a dedicated binutils branch https://github.com/riscv/riscv-binutils-gdb/tree/rvv-1.0.x.
LLVM also is not supporting it also. How do I use the RISC-V Vector (RVV) instructions in LLVM IR?
Upvotes: 0