Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2.4. The following problems deal with translating from C to ARM. Assume that the variables f, g, h, i, and j are assigned to registers

2.4. The following problems deal with translating from C to ARM. Assume that the variables f, g, h, i, and j are assigned to registers r0, r1, r2, r3, and r4, respectively. Assume that the base address of the arrays A and B are in registers r6 and r7, respectively.

a.

f = g + h + B[4];

b.

f = g A[B[4]];

2.4.1 For the C statements above, what is the corresponding ARM assembly code?

2.4.2 For the C statements above, how many ARM assembly instructions are needed to perform the C statement?

2.4.3 For the C statements above, how many different registers are needed to carry out the C statement?

The following problems deal with translating from ARM to C. Assume that the variables f, g, h, i, and j are assigned to registers r0, r1, r2, r3, and r4, respectively. Assume that the base address of the arrays A and B are in registers r6 and r7, respectively.

a.

ADD r0, r0, r1

ADD r0, r0, r2

ADD r0, r0, r3

ADD r0, r0, r4

b.

LDR r0, [r6, #4]

LDR r1, [r7, #8]

ADD r3, r0, r1

2.4.4 For the ARM assembly instructions above, what is the corresponding C statement?

2.4.5 For the ARM assembly instructions above, rewrite the assembly code to minimize the number of ARM instructions (if possible) needed to carry out the same function.

2.4.6 How many registers are needed to carry out the ARM assembly as written above? If you could rewrite the code above, what is the minimal number of registers needed?

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_2

Step: 3

blur-text-image_3

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

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

ANALYZE the emerging emphasis on employee recognition.

Answered: 1 week ago