58. Implement SR Latch

Loading simulator…

Active-High Inputs: Since a cross-coupled NAND SR latch requires active-low inputs, S and R are first passed through NOT gates to generate the required active-low signals.

Cross-Coupled Feedback: The output of each NAND gate is fed back to an input of the other, forming a regenerative feedback loop that stores the latch state.

State Behavior:

  • Hold (S = 0, R = 0): Both NAND inputs remain high, so the latch retains its previous state (Q_n+1 = Q_n).
  • Reset (S = 0, R = 1): The lower NAND output becomes ~Q_n = 1, forcing Q_n = 0.
  • Set (S = 1, R = 0): The upper NAND output becomes Q_n = 1, forcing ~Q_n = 0.
  • Invalid (S = 1, R = 1): Both outputs become 1, violating complementarity. Returning directly to the Hold state may cause a race condition, making the final state unpredictable.