Question

I have a piece of (assembly) code, in which i want to count the number of dynamic instructions

a1=99

Loop:
a1=a1-1
branch a1>0, Loop
halt

I think the instructions in loop are executing for 100 times. So I guess the number of dynamic instructions in the code are 102. But I am not sure, whether or not we also consider branch instructions as dynamic? In that case, shouldn't I have double instruction count? Thanks in advance to anybody who is willing to help.

Was it helpful?

Solution

dynamic instructions is not a commonly used term, so it is unclear what it is supposed to mean. Branch instructions are always included in the instruction count, because they take at least one clock cycle to execute.

So the answer should be 200 instructions are executed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top