Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose: This prorgam is in Armv 8 assembly. In this assignment you will write an ARM assembly program that implements integer addition, subtraction, and multiplication.

Purpose: This prorgam is in Armv8 assembly.
In this assignment you will write an ARM assembly program that implements integer addition, subtraction, and multiplication. For multiplication, you'll implement the shift-and-add algorithm described in class. You may not use any of the ARM arithmetic instructions, for any part of your program, no exceptions (e.g.. add, sub, mul, div, neg, or any variants)!
For manipulating the stack pointer, you may use the stp and Idp instructions, as well as the Idr and str instructions with pre- and post-indexing.
You should implement your addition, subtraction, and shift-and-add functions using only logical/move operations (and, eor, orr, cmp, mov, Isl, asr, Isr, mvn, etc.), memory operations (stp, Idp, str, Idr, stm, Idm, etc., automatic stack pointer updating allowed), and branch instructions (conditional, unconditional, and function calls). Your program must also be modular.
The addition function (named intadd), subtract function (named intsub) and multiplication function (named intmul) must be in separate files, with those functions being the only function defined in their respective files. I will test the proper use of procedures and register usage conventions by replacing any of your files with my own implementations, and your program must work. The only assumptions you may make about my implementations is that I will properly follow the ARM register usage convention. Strive to make your program efficient (only storing and loading when necessary), and robust.
I should be able to compile your program with the provided Makefile simply by typing make
You may assume that the intermediate and final results can be represented using 32 bits (overflow does not occur). The input operands will be integers and the output operand (the result) will be integers. Your program should handle positive, negative and zero values.
You should also write user-interface routines to prompt for two values, the operation to be performed, and to output the final result. Your program should repeat until the user terminates the program.
Sample interface:
Enter Number 1: 17
Enter Number 2: 9
Enter Operation: **
Result is: 153
Again? y
Enter Number 1: 8
Enter Number 2: 9
Enter Operation: -
Result is: -1
Again? y
Enter Number 1: 11
Enter Number 2: 10
Enter Operation: +
Result is: 21
Again? y
Enter Number 1: 0
Enter Number 2: 1
Enter Operation: ?
Invalid Operation Entered.
Again? n
Example C version of input:
int main(int argc, char* argv[])
{
int a,b, result;
char c;
printf("Enter Number 1: ");
scanf("%d", &a);
printf("Enter Number 2: ");
scanf ("%d", &b) ;
printf("Enter Operation: ");
scanf("%c", &c);
printf("The numbers were %d %d %c?
,a,b,c;
printf("Again?");
scanf("%c", &c);
printf("Make a decision based on '%c'??
, c);
}
return 0 ;
Example.c
The repository also contains an example.c program. This program contains some of the calls to scanf that you will need to use in order to take input from the user. It is a good idea to understand how this program works before implementing your assembly version.
Submission Instructions:
Commit your complete and fully documented files (main.s intadd.s intsub.s intmul.s), Makefile and
README.md:
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Privacy In Statistical Databases International Conference Psd 2022 Paris France September 21 23 2022 Proceedings Lncs 13463

Authors: Josep Domingo-Ferrer ,Maryline Laurent

1st Edition

3031139445, 978-3031139444

More Books

Students also viewed these Databases questions

Question

to encourage a drive for change by developing new ideas;

Answered: 1 week ago

Question

4 What are the alternatives to the competences approach?

Answered: 1 week ago