Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question: Write the meaning of each instruction by commenting beside each line o

ID: 3585319 • Letter: Q

Question

Question: Write the meaning of each instruction by commenting beside each line of code, as follows:

.data

N_COEFFS: .word 5

coeff: .double 0.25 , 0.5 , 1.0 , 0.5 , 0.25

N_SAMPLES: .word 5

; sample: .double 1.0 , 2.0 , 1.0 , 2.0 , 1.0

; result: .double 0.0 , 0.0 , 0.0 , 0.0 , 0.0

list: .word 15, 0, 1, 2, 6, -2, 4, 7, 3, 7

listxx: .word 5, 0, 1, 2, 6, -2, 4, 7, 3, 7

.text

main:

ld $t5, listxx(r0)

ld $t1, N_SAMPLES(r0)

ld $t2, N_COEFFS(r0)

; slt r5, r4, r3 ; if N_COEFFS < N_SAMPLES $t2 = 1, else $t2 =0;

; bnez r5, printresult ; if t2 != 0, jump to printresult

dsub $t3, $t1, $t2

;sd $t3, result(r0)

daddi r1, r0, 0

ld r2, list(r1); load arrays

daddi r1, r1, 8

ld r2, list(r1)

daddi r1, r1, 8

ld r2, list(r1)

daddi r1, r1, 8

ld r2, list(r1)

halt

; bltz r5, printresult

; smooth:

; printresult:

; j Exit

; Exit:

; halt

Explanation / Answer

.data

N_COEFFS: .word 5 ; coefficients count

coeff: .double 0.25 , 0.5 , 1.0 , 0.5 , 0.25 ; all coefficients

N_SAMPLES: .word 5 ; samples count

; sample: .double 1.0 , 2.0 , 1.0 , 2.0 , 1.0 ; sample1

; result: .double 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ; sample2

list: .word 15, 0, 1, 2, 6, -2, 4, 7, 3, 7 ; sample 3

listxx: .word 5, 0, 1, 2, 6, -2, 4, 7, 3, 7 ; sample 4

.text

main:

ld $t5, listxx(r0) ; $t5 <- listxx(r0)

ld $t1, N_SAMPLES(r0) ; $t1 <- N_SAMPLES(r0)

ld $t2, N_COEFFS(r0) ; $t2 <- N_COEFFS(r0)

; slt r5, r4, r3 ; if N_COEFFS < N_SAMPLES $t2 = 1, else $t2 =0; ; if $t2 < $t1 then $t2 = 1 else $t2 = 0

; bnez r5, printresult ; if t2 != 0, jump to printresult; if r5 !=0 then printresult else

dsub $t3, $t1, $t2 // subtrat $t2 from $t1

;sd $t3, result(r0) // store $t3 in result

daddi r1, r0, 0 ; i=0

ld r2, list(r1); load arrays; load arrays

daddi r1, r1, 8 ; increment by 8

ld r2, list(r1) ; load list(r1) to r2

daddi r1, r1, 8 ; increment by 8

ld r2, list(r1) ; load list(r1) to r2

daddi r1, r1, 8 ; increment by 8

ld r2, list(r1) ; load list(r1) to r2

halt ; stop

; bltz r5, printresult ; if r5 < 0 then printresult

; smooth:

; printresult: ; printresult

; j Exit ; exit from loop

; Exit: ; exit

; halt ; stop

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote