What is Combinational loop?
A structure in which combinational output feeds back to its own input without a flip-flop. It can oscillate or fail to settle, and static timing analysis cannot handle it as it is, so it is avoided.
Field: HDL & Verification
Japanese name: 組み合わせループ
What kind of structure it is
It is a structure in which following the output of combinational logic leads back to the original input without passing through a flip-flop. Two assign statements in which a determines b and b determines a are an example. So is 'always @(*) sum = sum + in;' written with an accumulator in mind. The output of the adder is connected straight back to its own input. When the output changes the input changes, and the output changes again, so the value does not settle.
When it oscillates and when it holds a value
The behavior depends on the number of inversions around the loop. With an odd number, the value is inverted on each trip around the loop, so it cannot settle and oscillates. Suppose 3 inverting gates, each with a delay of 0.1 ns, are connected in a ring. One trip takes 0.3 ns, and the original value returns after 2 trips, so the period is 0.6 ns. With an even number, both 0 and 1 are stable, and which one appears depends on delay differences and on what happened before. This is a memory function like that of a latch.
Why it is a problem and how to fix it
Static timing analysis examines the delay of paths that have a start point and an end point, such as from one flip-flop to the next. A path that forms a loop has neither, so it cannot be handled as it is. When a tool cuts the loop somewhere for analysis, some paths are left unchecked. In simulation too, evaluation may fail to finish at the same time step, or the value may stay at X. Depending on how the code is written, the simulation may even appear to work as intended and differ only from the synthesized circuit. If feedback is needed, a flip-flop is placed in the path so that the value is updated once per clock. Many lint and synthesis tools warn about loops.
FAQ
A counter also feeds its output back to its input. Is that not a problem?
No. There is a flip-flop in the feedback path. The value is updated once at each clock edge, and the circuit works correctly as long as the value settles before the next edge.
Are combinational loops ever used on purpose?
Yes. A ring oscillator, which makes use of the oscillation, and a latch, which holds a value, are both built from feedback. They are not written into the RTL of an ordinary synchronous design, however, and are handled as dedicated cells or circuits.
Books on HDL & Verification Ad
As an Amazon Associate I earn from qualifying purchases.
Comparisons that include this term
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.
Back to the glossary