Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 6. The following fragment of C code i=0; while(i <100) { i++;} compiles to the following assembly code 0x314: CLR W0 0x316: MOV W0,

Problem 6. The following fragment of C code i=0; while(i<100) { i++;} compiles to the following assembly code 0x314: CLR W0 0x316: MOV W0, [W14+6] 0x318: BRA 0x320 0x31A: MOV [W14+6], W0 0x31C: INC W0, W0 0x31E: MOV W0, [W14+6] 0x320: MOV [W14+6], W1 0x322: MOV #0x63, W0 0x324: SUB W1, W0, [W15] 0x326: BRA LE, 0x31A Each line begins with the program memory address on the left followed by the assembly code instruction at that address.

(a) How many bytes of physical program memory does this code occupy?

(b) How long does it take this code to execute?

(c) The assembly code shown above uses the stack. Here W14 is the frame pointer and W15 is the stack pointer. The assembly code can be simplified if we dont use the stack. Rewrite the assembly code shown to eliminate W14 and W15.

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

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago