Question
[Step 1] 1. Download calc.c . This will be your driver code. DO NOT MODIFY THIS CODE ! 2. Create a file called calc.S. You
[Step 1]
1. Download calc.c. This will be your driver code. DO NOT MODIFY THIS CODE!
2. Create a file called calc.S. You will be compiling calc.c and calc.S together using the following command: aarch64-linux-gnu-gcc -o calc calc.c calc.S
[Step 2]
1. Create the following function labels: Add, Sub, Mul, Div, ShiftLeft, ShiftRight, SetGlobal, and GetGlobal
[Step 3]
1. Add takes two parameters (left and right) and returns an integer that is left + right.
2. Sub takes two parameters (left and right) and returns an integer that is left - right.
3. Mul takes two parameters (left and right) and returns an integer that is left * right.
4. Div takes two parameters (left and right) and returns an integer that is left / right.
5. ShiftLeft takes two parameters (left and right) and returns an integer that is left
6. ShiftRight takes two parameters (left and right) and returns an integer that is left >> right.
[Step 4]
1. Create a global variable with 10 integers in the .data section. Initialize integer[0] to 0x11111111, integer[1] to 0x22222222, ..., integer[9] to 0xaaaaaaaa.
2. SetGlobal will take two parameters (index and value). Index will be 0-9. This function will set the integer given by the index to the given value.
[Step 5]
1. GetGlobal will take a single parameter (index) and return an integer. Index will be 0-9. This function will return the global integer based on the index. For example, SetGlobal(1, 155) will set the 2nd integer (index 1) to 155. GetGlobal(1) will then return 155.
[Testing Your Code]
After running the program with ./calc, type "h" for a list of commands and how to use them. NOTE: calc.c was modified during lab. The most recent version has the help command. If your version does not, simply download calc.c again.
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