Question: Problem 5 . The subroutine delay sub uses a simple loop to implement a delay. The assembly listing of this subroutine is 0 0 0
Problem The subroutine delay sub uses a simple loop to implement a delay. The assembly
listing of this subroutine is
f :
f: mov.w count, w
f: f ff f mov.w #xffff w
f :
f: add.w w w w
fa: nop
fc: fd ff a bra NZxf
fe: return
Assume an instruction frequency of MHz for an an instruction cycle time of ns
a How many bytes of program memory does this subroutine, delay sub, occupy? How many
bytes of data memory are used?
b What value should be used for the variable count if the delay is to be as close as possible to
but no greater than, ms
c To make this delay exactly ms we may need to add nop instructions Where in the code
and how many nop instructions, if any, should be added?
d On exiting this subroutine, what are the values of the ALU bits N OV Z and C in the
status register?
e Can this subroutine be used to implement a ms delay? Suggest a simple way to do this.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
