SHOW HARD WORK Your task is to implement ARM Assembly functions using the REV an
ID: 2268641 • Letter: S
Question
SHOW HARD WORK
Your task is to implement ARM Assembly functions using the REV and RBIT instructions. Your solutions should execute as fast as possible, so implementing them with loops is not acceptable. Instead, you need to find the shortest possible straight-line sequence of instructions that will do the reversal. Hint: You may find the .rept directive to be useful. Create an assembly language file containing three functions. The first is used for run-time performance comparisons and is to be implemented exactly as shown below: exttt{CallReturnOverhead: BX LR} You are to code the other two without using the RBIT, REV, REV16 or REVSH instructions: exttt{uint32_t ReverseBits(uint32_t word) ;} Returns a result that corresponds to reversing the order of all the bits in its input. exttt{uint32_t ReverseBytes(uint32_t word) ;} Returns a result that corresponds to reversing the order of all the bytes in its input.
Explanation / Answer
#Include <Iostream>
#Include <cmatch>
Using Namespace std;
Int Main() {
Float a, b, c, x1, x2, Discriminant, Realpart, Imaginarypart;
Cout < < "Enter Coefficients a,b and c:";
Cin > > a > > c;
Discriminant = b*b-4*a*c;
If (discriminant > 0) {
X1 = (-b +
sqrt(discriminant) / (2*a);
X2 = (-b -
sqrt(discriminant) / (2*a);
Cout <<
"Roots are real and different." <<
end1;
Cout << "x1
= "<<x1 << end1;
Cout << "x2
="<< x2 << end1;
}
Else if (discriminant ==0)
{
cout <<
"Roots are real and same." << end1;
X1 = (-b+
sqrt(discriminant)) / (2*a);
cout << "x1
=x2 = "<<x1 << end1;
}
else {
realpart =
-b/(2*a)
imaginarypart
=sqrt (discriminant)/(2*a);
cout <<
"Roots are complex and different."
<< end1;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.