Question: Write a RISC - V assembly function to search for a specified integer in an integer array. The function should take the base address of
Write a RISCV assembly function to search for a specified integer in an integer array. The function should take the base address of the array, the number of elements in the array, and the specified integer as function arguments. The function should return the index number of the first array entry that holds the specified value. If no array element is the specified value, it should return the value Basically this is a linear search function pseudoinstructions are not allowed except j targetlabel and jr ra
int linearsearchint array int n int x
Going through array sequencially
for int i ; i n; i
if arrayi x
return i;
return ;
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
