Question: The subroutine delay sub uses a simple loop to implement a delay. The assembly listing of this subroutine is 0 0 0 0 0 2

The subroutine delay sub uses a simple loop to implement a delay. The
assembly listing of this subroutine is
000002f4 :
2f4: 004080 mov.w count, w0
2f6: f1 ff 2f mov.w #0xffff, w1
000002f8 :
2f8: 008040 add.w w1, w0, w0
2fa: 000000 nop
2fc: fd ff 3a bra NZ,0x2f8
2fe: 000006 return
Assume an instruction frequency of 16 MHz for an an instruction cycle time of 62.5 ns.
(a) How many bytes of program memory does this subroutine, delay sub, occupy? How many
bytes of data memory are used?
Program memory = bytes, Data memory = bytes.
(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, 10 ms? Complete the following to initialize count with this value.
.data
count: .word
(c) To make this delay exactly 10 ms we may need to add nop instruction(s). Where in the code
and how many nop instructions, if any, should be added

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!