mirror of
https://github.com/Sosokker/RISC-V-asm-programming.git
synced 2025-12-19 14:04:05 +01:00
Update dot_product_recursive.s
This commit is contained in:
parent
86cb0c811a
commit
9890260730
@ -13,7 +13,6 @@ main:
|
|||||||
j exit
|
j exit
|
||||||
|
|
||||||
dot_product_recursive:
|
dot_product_recursive:
|
||||||
# We will store only a2( size )
|
|
||||||
addi sp sp -16 # Prepare Stack Pointer
|
addi sp sp -16 # Prepare Stack Pointer
|
||||||
sw ra 0(sp) # Save ra into stack
|
sw ra 0(sp) # Save ra into stack
|
||||||
sw a0 4(sp) # Save ra into stack
|
sw a0 4(sp) # Save ra into stack
|
||||||
@ -21,6 +20,7 @@ dot_product_recursive:
|
|||||||
sw a2 12(sp) # Save ra into stack
|
sw a2 12(sp) # Save ra into stack
|
||||||
addi t0 x0 1 # t0 = temporary 1
|
addi t0 x0 1 # t0 = temporary 1
|
||||||
bne a2 t0 return # If size != 1 then we will call function recursively
|
bne a2 t0 return # If size != 1 then we will call function recursively
|
||||||
|
# Base Case
|
||||||
addi sp sp 16 # Reset stack pointer
|
addi sp sp 16 # Reset stack pointer
|
||||||
lw t1 0(a0) # a[0]
|
lw t1 0(a0) # a[0]
|
||||||
lw t2 0(a1) # b[0]
|
lw t2 0(a1) # b[0]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user