soegaard2
2020-1-13 12:58:34

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.


sorawee
2020-1-13 13:36:43

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:

  1. 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?
  2. 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?

soegaard2
2020-1-13 13:38:21

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.


soegaard2
2020-1-13 13:39:02

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


sorawee
2020-1-13 13:39:29

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


sorawee
2020-1-13 13:41:19

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?


soegaard2
2020-1-13 13:43:41

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.


soegaard2
2020-1-13 13:44:44

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


soegaard2
2020-1-13 13:46:41

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


sorawee
2020-1-13 13:48:59

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


soegaard2
2020-1-13 13:50:42

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.


sorawee
2020-1-13 14:01:59

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


sorawee
2020-1-13 14:04:36

I guess I do have some outstanding questions


soegaard2
2020-1-13 14:06:04

Uh-oh. Probably something tricky.


sorawee
2020-1-13 14:06:50
  1. 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.

soegaard2
2020-1-13 14:08:21

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


sorawee
2020-1-13 14:08:47

Gotcha


sorawee
2020-1-13 14:10:31
  1. Just to confirm my understanding, the “invalid state” is an undesirable state but it is reachable. Is this correct?

sorawee
2020-1-13 14:11:20

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


soegaard2
2020-1-13 14:12:57

Not sure. Let’s look it up.


soegaard2
2020-1-13 14:14:46

soegaard2
2020-1-13 14:15:49

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.


sorawee
2020-1-13 14:23:44

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


sorawee
2020-1-13 14:24:03

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


wdobias
2020-1-13 20:13:12

@wdobias has joined the channel


samdphillips
2020-1-14 01:29:59

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


samdphillips
2020-1-14 03:04:00

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