[SOLVED] COEN20-Programming Lab 4a

30.00 $

Programming resource
Digital learning resource
Category:
โœ“ Practical programming resource
โœ“ Suitable for guided study and reference
โœ“ Tutor guidance available when needed

Description

5/5 - (1 vote)

Programming Lab 4a

Solving Quadratics

 

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๐‘Ž

  1. ๐‘…๐‘œ๐‘œ๐‘ก2(๐‘Ž, ๐‘, ๐‘) =

โˆ’๐‘โˆ’๐‘†๐‘ž๐‘ข๐‘Ž๐‘Ÿ๐‘’๐‘…๐‘œ๐‘œ๐‘ก(๐ท๐‘–๐‘ ๐‘๐‘Ÿ๐‘–๐‘š๐‘–๐‘›๐‘Ž๐‘›๐‘ก(๐‘Ž,๐‘,๐‘))

 

2๐‘Ž

  1. ๐‘„๐‘ข๐‘Ž๐‘‘๐‘Ÿ๐‘Ž๐‘ก๐‘–๐‘(๐‘ฅ, ๐‘Ž, ๐‘, ๐‘) = ๐‘Ž๐‘ฅ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.

 

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.