User:MentalMouse42/Sandbox/Memory Restored - minecraft.fandom.com

Jump to navigation Jump to search
Treść tej podstrony pochodzi z artykułu „User:MentalMouse42/Sandbox/Memory Restored” w domenie minecraft.fandom.com na licencji CC BY-NC-SA 3.0

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̅. (Having both Q and Q̅ 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̅ indicates the opposite of Q -- when Q is high, Q̅ is low, and vice versa. Where a Q̅ 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̅. If this happens, you will get "undefined behavior" -- various designs can do different things, and especially Q and Q̅ 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̅ . (If the original circuit only had a Q output, then swapping the inputs will turn it into Q̅.) 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̅ 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[]

Basic 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̅). 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.

Isolated RS-NOR Latches 

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.

Vertical RS-NOR Latches 

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[]

Input Stabilization Circuit

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̅ 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̅, S̅) as inputs. When S̅ and R̅ are both off, Q and Q̅ are on. When S̅ is on, but R̅ is off, Q̅ will be on. When R̅ is on, but S̅ is off, Q will be on. When S̅ and R̅ are both on, it does not change Q and Q̅. They will be the same as they were before S̅ and R̅ 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. There is also an example of using droppers to pass an item back and forth. The droppers need to be indirectly activated rather than directly powered, but the activation blocks can of course be placed at any of several locations. Even the block under the comparator can be used to set the latch.

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̅ 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.

Enable/Disable RS 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.

Design A B A' C D E F G H
Size 4×2×3 3×2×3 4×4×3 2×3×3 2×3×2 2×4×2 1×4 5×3×3 6×3×3
Torches 2 2 2 2 2 2 2 4 6
Redstone wire 6 4 10 4 0 4 3 6 8
Repeaters 0 0 0 0 2 0 0 0 0
Inputs isolated? Duplex Duplex Duplex Duplex Yes Yes Duplex Yes Yes
Outputs isolated? Duplex Duplex Duplex Yes Yes Yes Duplex/Yes No Yes
Input orientation opposite adjacent opposite opposite opposite opposite opposite perpendicular perpendicular
Design J K L M N O P Q
Size 2×3×3 4×3×3 4×4×2 4×3×2 1×1 5×3×3 1×2 5×5×3
Torches 2 0 1 1 0 1 0 7
Dust 7 4 6 0 9 4 0 7
Repeaters 1 1 1 1 0 1 0 0
Other devices -- 1 sticky piston 1 sticky piston 2 normal pistons 2 normal pistons 2 normal pistons 2 droppers, 1 comparator --
Inputs isolated? Yes, No No Yes Yes No Yes Yes
Outputs isolated? Yes No No Yes Yes Yes Yes No
Q&#x305 available? No No No No Yes No No Yes
Input orientation Perpendicular Perpendicular Adjacent Opposite Opposite Opposite Adjacent Adjacent
Design M N
Size 6x3x3 6x2x3
Torches 6 6
Redstone 9 7
Input orientation adjacent opposite