yeolyi.comSeongyeol's CS

D Latch

The SR latch remembers 1 bit, but when S and R were both 1 and then returned to 0 together, Q couldn’t be predicted. Is there a way to keep such inputs from ever coming in?

D latch

The circuit that solves this problem is the D latch. It takes a single input, D, and feeds D into S and the inverted D into R. That way S and R are always opposite, so they can never both be 1. On top of that, the value only goes in when E is 1. In the circuit below, the SR latch is drawn as a single box.

  1. Click D to make it 1. E=0, so Q doesn’t change.
  2. Click E to make it 1, and the value of D (1) shows up in Q.
  3. Click E to make it 0, and Q is locked. Now changing D doesn’t change Q.

A D latch has only two inputs: Data (D) and Enable (E). Only while E is on does the value of D show up in Q, and once E is off, it keeps the previous value. E works like a lock on Q.

Wrapping up

A D latch remembers D from the time E is on. But if D is connected to the result of a calculating circuit, when should E be turned on? In the next post, let’s look at the clock, which sets that timing.

Challenge

The output Q of a D latch is inverted with a NOT and wired back into D. At first Q=0 and E=0. Hoping for a light switch where Q flips with every press, you raise E to 1, then lower it to 0 a moment later. What happens to Q?