在用Python的unittest时,我得到了如下错误:  

在汇编测试里,我的代码运行结果是正确的,但s6的地址也发生了变化  (lw 时加载的不是存进去的值)

我想知道是哪里出了问题
以下为我的代码:
.globl dot
.text
# =======================================================
# FUNCTION: Dot product of 2 int vectors
# Arguments:
#   a0 (int*) is the pointer to the start of v0
#   a1 (int*) is the pointer to the start of v1
#   a2 (int)  is the length of the vectors
#   a3 (int)  is the stride of v0
#   a4 (int)  is the stride of v1
# Returns:
#   a0 (int)  is the dot product of v0 and v1
# Exceptions:
# - If the length of the vector is less than 1,
#   this function terminates the progra,m with error code 57
# - If the stride of either vector is less than 1,
#   this function terminates the progra,m with error code 58
# =======================================================
#a0:size a1:time return a0 
multi:
    
    add t1 a0 x0
    bne a1 zero loop
    mv a0 zero
    j mul_end
    
    loop:
    addi a1 a1 -1
    ble a1 zero mul_end
    add a0 a0 t1
    j loop
    mul_end:
    jalr zero ra 0
#ret a0; arg:a0,a1 find max value 
max:
    bge a0, a1, max_return # if a0 > a1 then max_return
    mv a0 a1
max_return:
    jalr zero ra 0
dot:
    addi sp sp -30
    sw s0 0(sp)
    sw s1 4(sp)
    sw s2 8(sp)
    sw s3 12(sp)
    sw s4 16(sp)
    sw s5 20(sp)
    sw s6 24(sp)
    sw ra, 26(sp)
    # Prologue
    ble a2, zero, error_len # if a2 <= zero then err
    ble a3, zero, error_str
    ble a4, zero, error_str
    jal zero loop_prepare
error_len:
    li a1 57
    call exit2
error_str:
    li a1 58
    call exit2
loop_prepare:
    #s0 - firstAdd
    #s1 - secAdd
    #s2 - firStr
    #s3 - secStr
    #s4 - largestStr
    #s5 - vecInd
    #s6 - sum
    mv s0 a0
    mv s1 a1
    mv s5 a2
    li a0 4
    mv a1 a3
    jal ra, multi
    mv s2 a0
    
    li a0 4
    mv a1 a4
    jal ra, multi
    mv s3 a0
    mv a0 a3
    mv a1 a4
    jal ra, max
    mv s4 a0
    li s6 0
    
loop_start:
    lw a0 0(s0)
    lw a1 0(s1)
    
    jal ra, multi
    add s6 s6 a0
loop_continue:
    sub s5 s5 s4
    ble s5 zero loop_end
    add s0 s0 s2 
    add s1 s1 s3 
    j loop_start
loop_end:
    mv a0 s6
    lw s0 0(sp)
    lw s1 4(sp)
    lw s2 8(sp)
    lw s3 12(sp)
    lw s4 16(sp)
    lw s5 20(sp)
    lw s6 24(sp)
    lw ra, 26(sp)
    addi sp sp 30
    # Epilogue
    jr ra
ps:感觉测试有个小坑
在变量表述中:a2 应该是2个数组的长度  

但stride_test里,步长大的到了数组外依旧可以运算,以至于结果为22  

  
实际上应该为7