Explain the race condition in SR flip flop. Also, explain how SR flip-flop races in the listed situation.


Q.) Explain the race condition in SR flip flop. Also, explain how SR flip-flop races in the listed situation.

Subject: Digital Systems

A race condition in an SR flip-flop is a situation where the outputs change (or "race") to catch up with the changes in the input. This condition occurs when both inputs S and R are set to 0 simultaneously.

The SR flip-flop is a digital circuit that has two inputs, S (Set) and R (Reset), and two outputs, Q and Q' (not Q). The flip-flop is "set" when the output Q is 1 and Q' is 0. It is "reset" when the output Q is 0 and Q' is 1.

The behavior of the SR flip-flop is described by the following truth table:

S R Q (next) Q' (next) Comment
0 0 Q (prev) Q' (prev) No change
0 1 0 1 Reset
1 0 1 0 Set
1 1 0 0 Not allowed

The race condition occurs in the case when both S and R are set to 1. This is a forbidden state because it leads to both Q and Q' being 0, which contradicts the requirement that Q and Q' should always be opposite.

When the inputs change from this forbidden state to the state where S=R=0, the outputs Q and Q' should ideally return to their previous state. However, due to propagation delays in the circuit, one of the outputs may change before the other, leading to an unpredictable result. This is the race condition.

For example, consider the case where the flip-flop is initially in the set state (Q=1, Q'=0) and then both inputs are set to 1. This leads to the forbidden state where Q=Q'=0. Now, if both inputs are set to 0, the outputs should ideally return to the set state. However, due to propagation delays, if the change in R is registered before the change in S, the flip-flop will go to the reset state (Q=0, Q'=1). Conversely, if the change in S is registered first, the flip-flop will return to the set state.

This unpredictability in the final state of the flip-flop is the race condition. It can be avoided by ensuring that the inputs S and R are never set to 1 at the same time.