Question: Using only at most r 0 , r 1 , r 2 , and r 3 , return the middle value of r 0 ,
Using only at most r r r and r return the middle value of r r and r
test bench:
#include
int middle int r int r int r
int t;
if r r
t r; r r; r t;
if r r
t r; r r; r t;
r r r r : r;
return r;
extern int testint r int r int r;
int testharness void
int expected, res;
expected middle;
res test;
if res expected
printfexpected d got d
expected, res ;
return ;
else
printfpassed test
;
expected middle;
res test;
if res expected
printfexpected d got d
expected, res ;
return ;
else
printfpassed test
;
expected middle;
res test;
if res expected
printfexpected d got d
expected, res ;
return ;
else
printfpassed test
;
return ;
my work:
arch armv
syntax unified
arm
text
align
global test
type test, function
test:
cmp rr
movgt rr
movle rr
cmp rr
movle rr
cmp rr
moveq rr
cmp rr
movle rr
movgt rr
mov rr
mov pc lr
not getting the correct value
solve the question based on this test bench and my workchange what need to change
make sure the middle value is the answer
don't use any previous answer or AI generated answers
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
