COEN20 Programming Lab #4a Solving Quadratics solution

$24.99

Original Work ?

Download Details:

  • Name: Lab-4-ztmr2i.zip
  • Type: zip
  • Size: 191.66 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (5 votes)

Topics: Instructions for integer arithmetic, calling a C function from assembly.
Prerequisite Reading: Chapters 1-5
Create a single ARM Cortex-M4 assembly source code file
containing four functions. (Note that functions π‘…π‘œπ‘œπ‘‘1 and
π‘…π‘œπ‘œπ‘‘2 should both contain calls to functions π·π‘–π‘ π‘π‘Ÿπ‘–π‘šπ‘–π‘›π‘Žπ‘›π‘‘
and π‘†π‘žπ‘’π‘Žπ‘Ÿπ‘’π‘…π‘œπ‘œπ‘‘.) Functions π·π‘–π‘ π‘π‘Ÿπ‘–π‘šπ‘–π‘›π‘Žπ‘›π‘‘, π‘…π‘œπ‘œπ‘‘1, π‘…π‘œπ‘œπ‘‘2
and π‘„π‘’π‘Žπ‘‘π‘Ÿπ‘Žπ‘‘π‘–π‘ are called by a main program (download
from here) that will test your functions for three test cases. All
of the parameters and return values are of type int32_t:
1. π·π‘–π‘ π‘π‘Ÿπ‘–π‘šπ‘–π‘›π‘Žπ‘›π‘‘(π‘Ž, 𝑏, 𝑐) = 𝑏
2 βˆ’ 4π‘Žπ‘
2. π‘…π‘œπ‘œπ‘‘1(π‘Ž, 𝑏, 𝑐) =
βˆ’π‘+π‘†π‘žπ‘’π‘Žπ‘Ÿπ‘’π‘…π‘œπ‘œπ‘‘(π·π‘–π‘ π‘π‘Ÿπ‘–π‘šπ‘–π‘›π‘Žπ‘›π‘‘(π‘Ž,𝑏,𝑐))
2π‘Ž
3. π‘…π‘œπ‘œπ‘‘2(π‘Ž, 𝑏, 𝑐) =
βˆ’π‘βˆ’π‘†π‘žπ‘’π‘Žπ‘Ÿπ‘’π‘…π‘œπ‘œπ‘‘(π·π‘–π‘ π‘π‘Ÿπ‘–π‘šπ‘–π‘›π‘Žπ‘›π‘‘(π‘Ž,𝑏,𝑐))
2π‘Ž
4. π‘„π‘’π‘Žπ‘‘π‘Ÿπ‘Žπ‘‘π‘–π‘(π‘₯, π‘Ž, 𝑏, 𝑐) = π‘Žπ‘₯
2 + 𝑏π‘₯ + 𝑐
Note: Function SquareRoot is a function written in C
implemented in the same source code file as the main program.
It requires a single unsigned integer parameter and returns an
unsigned integer result. It should be called from your assembly
language functions Root1 and Root2.
If your code is correct, the three
test cases should look similar to the
image above. Incorrect values will
be displayed as white text on a red
background.