User:MentalMouse42/Sandbox/Memory Restored

About RS Latches
An RS latch has 2 inputs, S and R. The output is conventionally labeled Q, and there is often an optional "inverse output" Q&#x305;. (Having both Q and Q&#x305; is called "dual outputs"). When a signal comes into S, Q is set on and stays on until a similar signal comes into R, upon which Q is reset to "off". Q&#x305; indicates the opposite of Q -- when Q is high, Q&#x305; is low, and vice versa. Where a Q&#x305; output is available, you can often save a NOT gate by using it instead of Q.

Note that the proper name for this category of latch is "SR latch". However, in real-world electronics as in Minecraft, the classic implementation of such latches starts by inverting the inputs; such a latch is the proper "RS latch", but they're so common that the term is commonly used also for what "should" be called SR latches.

Typical uses include an alarm system in which a warning light stays on after a pressure plate is activated until a reset button is pushed, or a rail T-junction being set and reset by different detector rails. RS latches are common parts of other circuits, including other sorts of latches.

Setting both inputs high simultaneously is a "forbidden" condition, generally something to avoid. In the truth table, S=1, R=1 breaks the inverse relationship between Q and Q&#x305;. If this happens, you will get "undefined behavior" -- various designs can do different things, and especially, Q and Q&#x305; can be high or low at the same time.

If the forbidden state is co-opted to toggle the output, the circuit becomes a JK latch, described in its own section. If there is instead a third input which toggles the output, the circuit becomes an "RST latch".

Any RS latch with dual outputs is functionally symmetrical: pulsing each input turns on "its" output, and turns off the other one. Thus R and S are interchangeable, if you also swap the outputs: Which input you pick as S chooses which of the outputs is Q, then the other input will be R and the other output will be Q&#x305;. (If the original circuit only had a Q output, then swapping the inputs will turn it into Q&#x305;.) In several designs (A, B, D, F, I) the functional symmetry is reflected by the circuit's physical symmetry, with each input energizing the torch it leads to, while turning off the other.

RS latches can be built in a number of ways:
 * Two NOR gates can be linked so that whichever is lit, the other will be off. The RS NOR latch is the "original" RS latch, and still among the smallest memory devices that can be made in vanilla Minecraft.  While they can be built with just torches and redstone dust, repeaters can also be used.
 * It is also possible to construct an RS NAND latch, using NAND gates instead of NOR gates. These will be larger and more complex than an RS NOR latch, but may be useful for specialized purposes.
 * Other RS latches can be created by fitting an "input sustaining circuit" with a reset switch, say by adding a pair of NOT gates or a piston, placed so as to interrupt the circuit when triggered. Such a construction can be nearly as compact as an RS NOR latch (and often with better I/O isolation and/or timing), but they will usually not have a natural Q&#x305; output.
 * Pistons can be used to physically toggle a block's location. Use of a Block of Redstone allows 4&times;1&times;1 design that is fast and flexible, but expensive -- besides the redstone block, it requires two pistons.


 * Variations:
 * An RS latch can easily be expanded into a monostable circuit, which automatically disables itself some time after being activated. To do this, split the output redstone path into 2 parts.  The new path should run through some repeaters, and in to the reset input. When you turn on the latch, the redstone will run through the delay before turning off the latch.  (This works not only for Q and R, but for Q&#x305; and S as well.) You can also use a more complex delay mechanism instead of repeaters, e.g. a water clock.)
 * An "Enable/Disable RS latch" can be made by adding a pair of AND gates in front of the inputs, testing each of them against a third input, E. Now if E is true, the memory cell works as normal.  If E is false, the memory cell will not change state.  That is, E latches the RS latch itself.

RS-NOR Latches
Designs A and B are compact and simple. A's output lines are isolated by the torches, but otherwise the I/O is not isolated. However, non-isolated inputs can be useful! B's inputs and outputs can be switched, or even used duplex: that is, sending a signal into Q will turn it on, and if there's no competing signal, S can be read from the Q output. If separate lines are desired, input and output can be taken from opposite ends of the circuit; otherwise the "extra" lines can be ignored.

Design D shows a slightly different arrangement, also full-duplex for input and output. It is longer but narrower than B. For separate input and output lines, the design can be elaborated into D'