Perfect and imperfect loop examples are given in (UG902), and are provided for in the example designs.
When synthesizing these two examples, the perfect loop example has less QOR than the imperfect loop example, even though there should be an improvement.
Why is this?
The imperfect loop example contains conditional logic outside the inner loop which in theory should reduce the performance. The perfect loop example moves this conditional logic inside the inner loop with a conditional statement in order to improve performance.
In general, this methodology is the correct one to follow to improve performance. However, in this example, the synthesis tools have improved in their capability to determines the functionality of the logic.
In this example, the inner loop can be abstracted to a simple single statement equation that does not require a loop:
This is because A[i] is invariant in this lower loop.
However, because the perfect loop example contains conditional logic, this simplification can not be performed, resulting in poorer performance for this example.