You’ve written a program consisting of 1,000 instructions. Based on instruction type, you’ve estimated that the average cycles per instruction is 4. Further, you’ve estimated the average processor cycles per instruction to be 3, the average number of memory references needed per instruction to be 1, and the ratio between memory cycle time and processor cycle time to be 2. If your system clock is operating at 4 MHz, how much time will your processor need to execute your program? Show your work.
Here, there are two types of cycles are involved which is
i).Processor cycle
Ii).Memory cycle
Each instruction takes 3 processor cycles and 1 memory cycle.
Processor clock time = 1/clock frequency = 1/4 MHz = 0.25 * 10-6 s = 250 * 10-9s = 250ns
Now, memory cycle time/processor cycle time = 2
So, memory cycle time = 250 ns * 2 = 500ns
Execution time required by processor = number of cycles taken by processor * time each processor cycle takes * Number of instructions + number of cycles taken by memory * time each memory cycle takes * number of instructions
Putting all values we get that
Execution time = 3*250ns * 1000 + 1 * 500ns * 1000
= 750 ns * 1000 + 500ns * 1000
= 750 * 103-9 + 500 * 103-9
= 750 * 10-6 + 500 * 10-6
= 0.75 * 10-3 + 0.5 * 10-3
= 0.75 ms + 0.5 ms
= 1.25 ms
Required execution time = 1.25 ms
Get Answers For Free
Most questions answered within 1 hours.