SPRUI04F july 2015 – april 2023
_dot: .cproc a, b
.reg sum0, sum1, I
.reg val1, val2, prod1, prod2
MVK 50,i ; I = 100/2
ZERO sum0 ; multiply result = 0
ZERO sum1 ; multiply result = 0
loop: .trip 50
LDW *a++,val1 ; load a[0-1] bank0
LDW *b++,val2 ; load b[0-1] bank2
MPY val1,val2,prod1 ; a[0] * b[0]
MPYH val1,val2,prod2 ; a[1] * b[1]
ADD prod1,sum0,sum0 ; sum0 += a[0] * b[0]
ADD prod2,sum1,sum1 ; sum1 += a[1] * b[1]
[I] ADD -1,i,i ; I--
[I] B loop ; if (!I) goto loop
ADD sum0,sum1,A4 ; compute final result
.return A4
.endproc