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.  Many of these designs have "duplex I/O" -- the same locations can be used to read or set the latch state.
 * 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.
 * Other devices can also be involved. Pistons can be used to physically toggle a block's location, while hoppers or droppers can pass around an item entity.  These circuits can be very fast and small, with little redstone dust.

RS-NOR Latches
Designs B and D are the most fundamental RS-NOR latches. In both cases, their inputs and outputs are "duplex" -- the latch state can be read (Q) or set (S) on one side of the circuit, while on the other side, the latch can be reset (R), or the inverse output read (Q&#x305;). If separate lines for input and output are needed, opposite ends of B can be used, or D can be elaborated into D' with separate locations for all four lines.

These can be modified to provide separate, even isolated, input and output. A and I use torches and repeaters respectively to isolate the outputs, though the inputs can still be read. F expands the circuit slightly to isolate all four I/O lines.

Design P provides a vertical (1-wide) option; again, the I/O is duplex, though isolated outputs can be taken at alternate locations.

Input Stabilization with Reset
An "Input-Stabilizing Circuit" responds to an input pulse by turning its input on and leaving it on. This can be built up into an RS Latch by adding a means to turn it off. These circuits usually don't offer a "natural" Q&#x305; output. Design J adds a pair of NOT gates, with the reset going to the second torch. (The NOT gates can also be added to the upper redstone loop.) Design K uses its piston to block the circuit where it goes up onto the solid block. Design L shows the reverse approach, breaking the circuit by withdrawing a power-carrying block. Note that L can easily be rearranged to L', which is 4x4 instead of 3x6.

RS NAND Latches
An RS latch can also be designed using NAND gates. In Minecraft, these are less efficient than the RS NOR latch, because a single Redstone torch acts as a NOR gate, whereas several torches are required to create a NAND gate. However, they can still be useful for specialized purposes.

Such an "RS NAND latch" is equivalent to an RS NOR, but with inverters applied to all the inputs and outputs. The RS NAND is logically equivalent to the RS NOR, as the same R and S inputs give the same Q output. However, these designs take inverse R and S (R&#x305;, S&#x305;) as inputs. When S&#x305; and R&#x305; are both off, Q and Q&#x305; are on. When S&#x305; is on, but R&#x305; is off, Q&#x305; will be on. When R&#x305; is on, but S&#x305; is off, Q will be on. When S&#x305; and R&#x305; are both on, it does not change Q and Q&#x305;. They will be the same as they were before S&#x305; and R&#x305;  were both turned on.

Pistons and other devices
A pair of non-sticky pistons can be used to physically push a block back and forth. This can make or break a circuit from a torch, producing an RS latch with no inverse output. If the block being pushed is a block of redstone, the circuit can be even smaller, with dual outputs. Both of these have isolated inputs and outputs. Putting two blocks between the pistons produces an SRT latch, with an extra input to toggle the latch state.

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 (or equivalently, clocks) the RS latch itself.  Note that for the given design, the outputs are not isolated, and a signal to them can set the latch regardless of the clock.
 * As noted above, if it is possible to add a "toggle" input, the RS latch becomes an RST latch. If the "forbidden" state is used for the toggle, then it's a JK latch.

RS Latch Tables
These tables are rather out of date -- they refer to deleted designs, omit new designs, and the dimensions are not consistent/ They are included for future updating.