Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started