In: Computer Science
assume the following instruction frequencies/composition in the
program:
load (lw) 22%
sub / compare 21%
conditional branch 20%
store (sw) 12%
add / move 12%
and 6%
4.
How long would it take to run a 100 instruction program on a single cycle datapath architecture, assuming a cycle time of 50ns?
(14)
5.
How long would it take to run the same 100 instruction program
on a multi-cycle datapath architecture, assuming a cycle time of
8ns. Further assume that “lw” takes 6 cycles, “sw” takes 4 cycles,
and all other instructions take 3 cycles to execute.
(14)
Total number of cycles needed to run a program will be equal to sum of product of number of instructions of each type and number of cycles needed to execute the instruction of that type.
4. In a single cycle datapath where every instruction will take only one cycle to execute, then since there are 100 instructions, therefore it will take 100*1 = 100 cycles to execute all the instructions.
Since cycle time is 50 ns, therefore time taken to execute all instructions = 100*50 ns = 5000 ns
5. Here "lw" instructions are total 22 in number where each of them takes 6 cycles, then "sw" instructions are total 12 in number and each takes 4 cycles. Remaining instructions are 100 - 22- 12 = 66 in number where each takes 3 cycles.
Hence total number of cycles needed to execute the program = 22*6 + 12*4 + 66*3 = 378 cycles.
Since cycle time is 8 ns, hence total time to execute = 378*8 ns = 3024 cycles.
Please comment for any clarification.