Computing Machinery I Assignment 2


5/5 - (2 votes)

Computing Machinery I
Assignment 2

The objective of this assignment is to practice branching and looping in ARMv8 assembly.
Skills Needed for this Assignment:
• Ability to work with basic arithmetic, loops, and if-else constructs in assembly
• Ability to print to standard output using the printf() and scanf() functions
• Ability to optimize assembly code by rearranging loops and using alternate instructions
• Ability to use macros in assembly code
• Ability to assemble programs using gcc and use m4 to process macros
• Ability to use gdb to debug and display assembly language programs
Some of your code, if well designed, can be re-used for Assignment 4.
Your program will simply generate N random numbers and calculate their sum, min, and max.
The program prompts the user for N, generates N random positive integers, then displays these numbers,
their sum, min and max. For reading N, you will need to call the C library scanf() function. Write two
versions of the program:
1. Write the program without macros (i.e. don’t use m4). Use a pre-test loop, where the test is at the top of
the loop.
2. Rewrite the above program by putting the loop test at the bottom of the loop (make sure it is still a pretest loop) and add macros to the above program to make it more readable (use m4). In particular,
provide macros for heavily used registers.
Make sure your code is properly formatted into columns, is readable and fully documented, and includes
identifying information at the top of each file. You must comment each line of assembly code. Your code
should also be well designed: make sure it is well organized, clear, and concise.
• Note: The TA may provide further submission instructions
• Name your programs assign2a.asm (no macros) and assign2b.asm (with macros)
• Create a script file for each version. Call them assign2a.script and assign2b.script
• Submit a README file providing extra instructions or information for your TA (optional)
• Submit your work to the appropriate dropbox on D2L.
Late Submission Policy
Late submissions will be penalized as follows:
-12.5% for each late day or portion of a day for the first two days
-25% for each additional day or portion of a day after the first two days
Hence, no submissions will be accepted after 5 days (including weekend days) of the announced deadline.
Academic Misconduct
This assignment is to be done by individual students: your final submission must be your own original
work. Teamwork is not allowed. Any similarities between submissions will be further investigated for
academic misconduct. While you are encouraged to discuss the assignment with your colleagues, this must
be limited to conceptual and design decisions. Code sharing by any means is prohibited, including looking
at someone else’s paper or screen. The submission of compiler generated assembly code is absolutely
prohibited. Any re-used code of excess of 5 lines in C and 10 lines in assembly (10 assembly language
instructions) must be cited and have its source acknowledged. Failure to credit the source will also result in
a misconduct investigation.
D2L Marks
Marks posted on D2L are subject to change (up or down).
Computing Machinery I
Assignment 2 Rubric
Item Max Points Points
Code compiles 5
Code runs 5
Calculating sum 15
Calculating min 15
Calculating max 15
Random number generation 15
User interface & input validation 15
Code readability (formatting and documentation) 15
Total Points 100

PlaceholderComputing Machinery I Assignment 2
Open chat
Need help?
Can we help?