assignment 3

profilekhan08
CSCE_2610_Sum21_PA3.pdf

© 2021 Robin Pottathuparambil Page 1 of 2

Programming Assignment #3 CSCE 2610 - Assembly Language and Computer Organization

Summer 2021

100 Points Due: 07/14/2021, 11:55 PM

Instructions: Compile and simulate the assembly programs (.S file) using DS-5 simulator and make sure it’s working. Comment your assembly programs. Create an assignment folder with folder name as euid_PA3 (example: xyz0202_PA3) and add all the source files (.S file) and the readme file to the folder. Please create a zip archive of your assignment folder and upload the zip file to Canvas. Not following the above instructions could result in not accepting your work. Late submissions are not allowed.

1. Summation of a series is given by the equation 𝑦𝑦 = ∑ (𝑛𝑛! + 𝑏𝑏)𝑎𝑎𝑛𝑛=0 . Write an ARMv8 assembly program to compute and store y. Assume the values for the input variables a and b are available in the registers X20 and X21 respectively. The inputs are 64 bits, non-zero positive integers that is always less than eight (8). Store the result y in register X22 and do not use recursion or functions to compute n!. Assemble, test, and simulate the assembly code using DS-5 simulator. Do not upload the entire DS-5 project. Only upload the assembly file (.S file) from the DS-5 project to Canvas. Comment your assembly code. (30 Points)

2. Summation of a series is given by the equation 𝑦𝑦 = ∑ (𝑏𝑏 + 𝑛𝑛)𝑛𝑛𝑎𝑎𝑛𝑛=0 . Write an ARMv8 assembly program to compute and store y. Write an ARMv8 assembly function to compute 𝑥𝑥𝑦𝑦 and use the function to compute the equation. Assume the values for the input variables a and b are available in the registers X20 and X21 respectively. The input to the function 𝑥𝑥𝑦𝑦 is passed using register X1 and the result is returned in register X0. The inputs are 64 bits, non-zero positive integers that is always less than eight (8). Store the result y in X22. Assume all the registers are used by the caller function to store some data before calling the function. Assemble, test, and simulate the assembly code using DS-5 simulator. Do not upload the entire DS-5 project. Only upload the assembly file (.S file) from the DS-5 project to Canvas. Comment your assembly code. (35 Points)

3. Write an ARMv8 assembly function to compute the sum of squares of first n odd natural numbers using recursion. The input n is in X1 and is 64 bits, non-zero positive integer less than 1001. Store the sum in X0. Assemble, test, and simulate the assembly code using DS-5 simulator. Do not upload the entire DS-5 project. Only

© 2021 Robin Pottathuparambil Page 2 of 2

upload the assembly file (.S file) from the DS-5 project to Canvas. Comment your assembly code. (35 Points)

An example assembly code (func_code.S) is posted on canvas that shows how to create a function and call the function.

Deliverables:

1. Commented assembly code for question 1, 2, and 3 2. A readme file that describes how to compile, execute, and test the assembly code.