Answered step by step
Verified Expert Solution
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 Armv assembly.
In this assignment you will write an ARM assembly program that implements integer addition, subtraction, and multiplication. For multiplication, you'll implement the shiftandadd algorithm described in class. You may not use any of the ARM arithmetic instructions, for any part of your program, no exceptions eg 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 postindexing.
You should implement your addition, subtraction, and shiftandadd functions using only logicalmove 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 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 userinterface 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 :
Enter Number :
Enter Operation:
Result is:
Again? y
Enter Number :
Enter Number :
Enter Operation:
Result is:
Again? y
Enter Number :
Enter Number :
Enter Operation:
Result is:
Again? y
Enter Number :
Enter Number :
Enter Operation:
Invalid Operation Entered.
Again? n
Example version of input:
int mainint argc, char argv
int result;
char ;
printfEnter Number : ;
scanfd &a;
printfEnter Number : ;
scanf d &b ;
printfEnter Operation: ;
scanfc &c;
printfThe numbers were d d
;
printfAgain;
scanfc &c;
printfMake a decision based on c
c;
return ;
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 mains intadd.s intsub.s intmul.s Makefile and
README.md:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started