Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

only using add, sub, addi, sw , lw: help me write this code: a [ k ] = ( * p ) - ( a

only using add, sub, addi, sw, lw: help me write this code:
a[k]=(*p)-(a[4*k+7]-6);
# Assume $s0<- a
# Assume $s1<- k
# Assume $s2<- p
add $t1,$s1,$s1 #t1<-2k
add $t1,$t1,$t1 #t1<-4k
add $t2,$t1,$t1 #t2<-8k
add $t2,$t2,$t2 #t2<-16k
add $t3,$t1,$s0 #t3<-address of a[k]
lw $t3,0($t3) # t3<- a[k]
add $t4,$s0,$t2 # t4<- address of a[4k]
sw $t4,28($t4) #t4<- a[4k+7]
addi $t4,$t3,-6 # t4<- a[4k+7]-6
sub $t4,$s2,$t4 # t4<-*p - a[4k+7]-6
sw $t3,0($t4) #a[k]=*p-(a[4*k+7)-6)
please let me know if its correct

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

5. Prepare for the role of interviewee

Answered: 1 week ago

Question

6. Secure job interviews and manage them with confidence

Answered: 1 week ago