It is a joke with the title of a book I am reading: "But how do it Know? - The Basic Principles of Computers to Anyone".
The author is explaining a basic unit of memory with NAND gates:
I think I get the idea behind this component. 's' is what determines when memory is set, and 'i' is what gets "stored". So if it starts with both inputs on, the changes in 'i' are relevant, because the output 'o' mirrors 'i'. If 's' is switched off, no change in 'i' is relevant. The result being the previous state of 'i' is stored in 'o', in other words, its state when 's' was on.
Now, my question. Let's say I start with both 'i' and 's' on, 'o' will be the same as 'i'. And after that, if I switch 's' off, the author says 'o' will retain its previous state:
I have trouble understanding what happens in gates 3 and 4 in the second point in time. I am assuming there's no current left in the wire connecting 'o' to gate 4, so I am picturing the following:
- wires a and b are on
- the wire connecting 'o' to gate 4 and wire c are off
- gate 4 outputs off, so c is still off, and gate 3 also outputs off
- the output 'o' gets changed from on to off, and nothing is stored from the previous point in time.
I'm sort of visualizing a "racing condition" between 'a' and 'b', but that's most likely not the right mindset. What is missing in my line of thought? How does wire 'o' remember it was previously on? I hope my question is not too confusing.
At earlier points in the book, the author says two things about gates that caught my attention:
“(...) how do you get electricity at the output if both inputs are off?” Well, that is an excellent question, and the excellent answer is that every one of these devices is also connected to power.
Scott, J Clark. But How Do It Know? - The Basic Principles of Computers for Everyone (p. 18). John C Scott. Kindle Edition.
A computer gate generates a third bit from two other bits, it doesn’t open and close or stop or let anything through. The meaning of this computer term “gate” doesn’t seem to fit into the common meaning of the word, but sorry, I didn’t make up the name, that’s just what it is called.
Scott, J Clark. But How Do It Know? - The Basic Principles of Computers for Everyone (p. 19). John C Scott. Kindle Edition.
Does it mean that each gate does not depend only on the current that comes from the inputs, that if needed, it can be powered by a third source, which keeps it on, preserving the previous state of 'o' that gets to gate 4?
I really hope this is not too confusing. I'm giving my first steps into this topic and I'm not a native-speaker.