Question
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
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