Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (40 points) You are given the following function containing a delay loop: Ten

ID: 3716937 • Letter: 1

Question

1. (40 points) You are given the following function containing a delay loop: Ten 1 decfsz COUNTL, FInner loop goto Ten 1 fsz COUNTH, F outer 1oop Ten 1 goto return a. (20 points) If COUNTL is initially 100, COUNTH is initially 10, the clock frequency is 500 kHz, and each instruction takes 4 clock cycles, how long does the whole delay loop take? You must show your work for full credit (20 points) What are the maximum and minimum possible delays this function can generate? What initial values would COUNTL and COUNTH have in each case? b.

Explanation / Answer

a)

INNER_LOOP :- It will loop for 100 times ;
OUTER_LOOP :- It will loop for 10 times ; causing inner loop also
RETURN :- It will execute only 1

So; total number of instruction executed is 10*100 + 1 = 1001.

So,if each instruction takes 4 clock cycles; then total clock cycles required = 1001*4 = 4004 cycles

Frequency = 500 Khz ; Time period = 1/500K = 2*10^-6 seconds.

So,total clock delay = 4004* 2 micro seconds = 8.008 ms delay


b)

MAXIMUM DELAY :-

COUNTL = 255
COUNTH = 255

CLock time period = 2*10^-6 seconds.

So,total clock delay = 0.520 seconds

MINIMUM DELAY :-

COUNTL = 1
COUNTH = 0

CLock time period = 2*10^-6 seconds.

So,total clock delay = 0.000016 seconds