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

Anybody know how to do this? Here\'s how it works: Assume that you are writing a

ID: 3551281 • Letter: A

Question

Anybody know how to do this? Here's how it works:


Assume that you are writing an interrupt service routine SampleISR (see below) that must execute quickly because it is called 100,000 times per second. How many instructions of the type "mov reg[expr], A" can be executed at the following CPU clock rates: 24MHz, 12MHz, 6MHz?


SampleISR:

push A

push X

mov reg[expr], A // How many of these instructions can be completed

within

// the time constraints?

...

pop X

pop A

reti


For this problem, note the following:


a). Internal interrupt processing takes 13 cycles. This occurs between the time of the interrupt and the time the interrupt vector is looked up.

b). The interrupt vector is a single instruction "ljmp SampleISR" --- do not forget this.

c). You may ignore the time it takes for the interrupted instruction to complete.

Explanation / Answer

Total number of cycles for internal interrupt processing =13 cycles

now we have come to interrupt vector

The interrupt vector is a single instruction "ljmp SampleISR" = 7 cycles

clock cycles for PUSH A =4 cycles

clock cycles for PUSH X =4 cycles

clock cycles for POP A =5 cycles

clock cycles for POP A =5 cycles

clock cycles for RETI =10 cycles

clock cycles for mov reg[expr], A = 5 cycles

let there be n instructions which can be executed hence 5n cycles are required


total cycles = 13+7+4+4+5+5+10+5n cycles

48+5n cycles per interrupt service routine

if the interrupt service routine is called 100,000 times, clock cycles required = 4800000+500000n


let F be CPU clock rate then time required =1/F *(4800000+500000n)

since we want the ISR to be called 100,000 in 1 sec so the above calculated time=1s

1/F *(4800000+500000n)=1

4800000+500000n = F


(i) F=24 Mhz =24000000 hz


4800000+500000n=24000000

n= 38.4

n=38 [ n is an integer]


(ii) F=12 Mhz =12000000 hz

4800000+500000n=12000000

n=14.4

n=14 [ n is an integer]


(iii) F=6 Mhz =6000000 hz

4800000+500000n=6000000

n=2.4

n=2 [ n is an integer]



Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote