Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[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.cimage text in transcribedimage text in transcribed. 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

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago