M2_SETI/T1/TP/TP3/T1-TP3-code/TP3-dist/parity_deroule.s

26 lines
693 B
ArmAsm
Raw Normal View History

2022-11-26 23:34:46 +01:00
;; MIPS program parity check
.data
N: .word 12
A: .double 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
B: .double 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
.text
main:
dadd r1,r0,r0 ; r1=i=0
lw r2, N(r0) ; r2=N
loop:
l.d f1, A(r1) ; f1=A[i]
l.d f2, B(r1) ; f2=B[i]
daddi r1,r1,8 ; i++
sub.d f2, f2, f1 ; f2=B[i]+A[i]
l.d f3, A(r1) ; f3=A[i+1]
l.d f4, B(r1) ; f4=B[i+1]
add.d f4, f4, f3 ; f4=B[i+1]-A[i+1]
daddi r2,r2,-2 ; N--;
s.d f4, B(r1) ; B[i+1] = f4
daddi r1,r1,-8 ; i--
s.d f2, B(r1) ; B[i] = f2
daddi r1,r1,16 ; i+=2
bne r2, r0, loop
nop
halt