
I used a select to choose between the new and old value. The “loop” must refer to the wire from the old value (select out) to the input of the select.

what I don’t understand is its semantics when an input depends on output. Like, to get an output, you must have an input first, so how does this make sense? I guess there are two ways that could make sense:
- There is a “default” value, like 0, for the initial input that depends on output. But then what will happen if the output is actually 1. Will it use the second iteration (which uses the output from the first iteration as an input) instead? What if in the third iteration it flips back to 0? And so on?
- The “input that depends on output” could be either 0 or 1. Just try both. Any of them that is “stable” (doesn’t flip in the next iteration) works. But then what will happen if both are stable? What will happen if none is stable?

We are talking electronics, so we have a voltage from 0v to 5v. Voltages close to 0v is interpreted as 0 and close to 5v is interpreted as 1.

If initially there is no voltage, then we begin with a 0.

I see. But then what about the flipping situation I described above? Is that a problem?

I guess I could also frame the question in terms of stability. Is it the case that the output must be stable? What about eventually stable?

The output of the select doesn’t change instantaneously, but as long as the st (short for “set”) doesn’t change, then there is time for the circuit to switch the output.

Hmm. There is got to some oscilloscope graphs of this situation somewhere.

This is a Ben Eater video on latches. https://www.youtube.com/watch?v=KM0DdEaY5sY Do you know the series?

Nope, but this looks really fantastic. Thanks :slightly_smiling_face:

It’s a great series. I binge watched it when I discovered it. He starts from basic electronic components and ends of building a small computer.

Just finished the video. It really did answer every question I have :slightly_smiling_face:

I guess I do have some outstanding questions

Uh-oh. Probably something tricky.

- I know it’s very unlikely, but for S-R latch, what will happen if both gates compute the output exactly in the same time, and feed it to the next loop at the very same time as well. It looks like the output will alternate between on and off indefinitely, correct? But I think physics would make probability of this event happening equal to 0.

I think the “physics would make probability of this event happening equal to 0.” is the the right answer.

Gotcha

- Just to confirm my understanding, the “invalid state” is an undesirable state but it is reachable. Is this correct?

Meaning to make things correct, we probably should impose additional precondition to rule it out.

Not sure. Let’s look it up.

I think this answers your question: https://www.allaboutcircuits.com/textbook/digital/chpt-10/s-r-latch/

The astute observer will note that the initial power-up condition of either the gate or ladder variety of S-R latch is such that both gates (coils) start in the de-energized mode. As such, one would expect that the circuit will start up in an invalid condition, with both Q and not-Q outputs being in the same state. Actually, this is true! However, the invalid condition is unstable with both S and R inputs inactive, and the circuit will quickly stabilize in either the set or reset condition because one gate (or relay) is bound to react a little faster than the other. If both gates (or coils) were _precisely identical_, they would oscillate between high and low like an astable multivibrator upon power-up without ever reaching a point of stability! Fortunately for cases like this, such a precise match of components is a rare possibility. It must be noted that although an astable (continually oscillating) condition would be extremely rare, there will most likely be a cycle or two of oscillation in the above circuit, and the final state of the circuit (set or reset) after power-up would be unpredictable.

Ah, so illegal states are fine if it’s unstable.

Very cool. Thanks for sharing all of these. I learned a lot

@wdobias has joined the channel

@gknauth I always thought that “To Dissect a Mockingbird” (http://dkeenan.com/Lambda/index.htm) would be an interesting teaching game for Lambda.

I spent a lot of time a few years ago messing around with Logisim http://www.cburch.com/logisim/index.html