Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

Redstone Logic Gates and FAQs Compendium


  • Please log in to reply
2218 replies to this topic

#1

trunksbomb
    trunksbomb

    Glowstone Miner

  • Retired Staff
  • 3065 posts
  • Location: Under the bridge

Posted 21 December 2010 - 04:51 AM

Redstone Logic Gates and FAQs Compendium

We all need a place to discuss our deepest and darkest redstone secrets ... er, circuits.

So here goes! Post your Redstone circuits if you've got them! Feel free to ask questions and have them answered by our resident redstone experts!

Table of Contents

Logic Gates

2-wide XOR Gate (2x6x5) by Banjobeni (schematic)
    Increases height to save on width. Inputs are on layer 0 and 2, making attaching it to two buses very easy
    Posted Image
    Redstone: 10/6
    Inputs Isolated: Yes
    Outputs Isolated: Yes


Latches and Flip Flops

Vertical RS NOR Latches Design A by raken, Design B by trunksbomb

Posted Image

The first one is Design H in the Wiki, and the second one is one that I came up with (as far as I know). The lower block in Design A can be pushed back any arbitrary length and the middle block of Design B can be stretched outward any arbitrary length to suit your needs. Of course, the inputs are not isolated, so S is also Q and R is also ~Q.

Compact D Flip-flop (3x6x3) by Hanyou Hottie
Posted Image

Compact D Flip-flop (2x4x4) by icks
Posted Image

Compact Vertical D Latch (1x5x6) originally by Howlingmonkey, optimized by Majiir
Posted Image

D-FlipFlop (3x7x6) by Banjobeni (schematic)
    Edge-triggered D Flip-Flop that has both input D and output Q on the same side. Based on two of howlingmonkey's vertical level-triggered D Flip-Flops.
    Posted Image
    Trigger: Store on rising edge, load on falling edge
    Redstone: 15 torches, 18 wire
    Inputs Isolated: C only
    Outputs Isolated: Yes

Compact T Flip-Flop (5x5x2) originally by Cadde, optimized by VincentLaw
Posted Image

Compact TFF (5x8x3) originally by Warillusen, optimized by trunksbomb (schematic)
    RET-TFF. Most efficient use of redstone (34 total) of all the horizontal ET-TFFs on the Wiki, and the only ET-TFF with accessible !Q. T and Q aligned for easy chaining. Cannot be built with the short side going N/S because of the ET.
    Posted Image
    Redstone: 22/12
    Inputs Isolated: Yes
    Outputs Isolated: Yes

Modified Vertical TFF (12x1x7) originally by Zorac, modified by trunksbomb (no schematic)
    The design by Zorac did not work when built N/S because the edge-trigger would not pulse long enough. This design fixes that. The blue blocks are the modified edge-trigger.
    Posted Image
    Redstone: 15/14
    Inputs Isolated: Yes
    Outputs Isolated: Yes

Earle Latch (5x8x3) Originally by Sukasa, optimized by icks (no schematic)
    Isolates the clock input instead of using the 15-block limit used in Sukasa's design. Simpler to design than the smaller version. (An Earle Latch is a level-triggered D Latch with a uniform propagation delay for changes in Q)
    Posted Image
    Redstone: 25/6
    Inputs Isolated: Yes
    Outputs Isolated: Yes

Earle Latch (5x7x3) Originally by icks, optimized by trunksbomb (no schematic)
    Shrinks icks' design by 1 and uses 3 fewer redstone. No other differences.
    Posted Image
    Redstone: 22/6
    Inputs Isolated: Yes
    Outputs Isolated: Yes

Clocks, Counters, and Edge Triggers

3x3x3 5-clock by trunksbomb
Posted Image

3x3x3 5-clock by Towel
Posted Image

4x4x1 5-clock by Towel
Posted Image
This clock is very flexible, and is scalable to any odd n-clock.

4-clock (5x3x2) by Rekkonin (no schematic)
    Two 3 clocks combined to make a 4-clock. Good for an even tempo on note blocks.
    Posted Image
    Redstone: 8/6
    Inputs Isolated: N/A
    Outputs Isolated: N/A

5-bit synchronous counter with reset by icks (.gif) (schematic) (17x5x8) (.gif with count up/count down selection) (schematic)

8-bit Synchronous Counter (18x8x7) by icks (schematic)
    Clock needs to be slower than 16 to allow the input to propogate along the line.
    Posted Image
    Redstone: 179/102
    Inputs Isolated: Yes
    Outputs Isolated: Yes

Rising Edge Triggers (RETs) (various sizes) (no schematic)
    Rising Edge Triggers are used to send an output pulse on the rising edge of an input. The output will be triggered only when the input turns from OFF to ON. I/O aligned on first two. Long side (on all) must be built facing E/W, else the signal burns out after three torches.
    Posted Image by trunksbomb
    Redstone: 3/4
    Inputs Isolated: Yes
    Outputs Isolated: Yes, output held HIGH, pulsed LOW
    Posted Image by trunksbomb
    Redstone: 5/6
    Inputs Isolated: Yes
    Outputs Isolated: Yes
    Posted Image by Rekkonin
    Redstone: 4/5
    Inputs Isolated: Yes
    Outputs Isolated: Yes

Arithmetic

Full Adder(5x6x3) by howlingmonkey (schematic)
Posted Image

Full Adder (4x6x4) by Banjobeni (schematic)
    All inputs and outputs have more than one direction they can enter/leave the circuit. Cin lines up with Cout for chaining (from right-to-left).
    Posted Image
    Redstone: 15/12
    Inputs Isolated: Yes
    Outputs Isolated: Yes

Full Adder (3x8x5) by Banjobeni (schematic)
    Full adders can be placed next to each other, having one space in-between, connecting the carry.
    Posted Image
    Redstone: 16 torches, 15 wires
    Inputs Isolated: Yes
    Outputs Isolated: Yes


Multiplexers, Demultiplexers, and Decoders

3-bit multiplexer by nou (schematic) (.gif)

5-bit decoder by icks (schematic) (.gif) (video of decoder in use with a 7-segment display)
This multiplexer is easily scalable to suit any need.

5-bit decoder originally by icks, optimized by Rekkonin (.gif) (schematic)


Storage/Memory

Paralell In/Serial Out (PISO) 8-bit Shift Register by Cadde (schematic) (.gif)

16-bit shift register with Write/!Shift select by icks (.gif for SIPO/PISO/SISO/PIPO) (schematic) (.gif for SISO/SIPO) (schematic)

SISO/SIPO 16-bit Shift Register with left/right select (18x13x13) by icks (schematic)
    16 bit shift register with select for left/right shifting.
    http://img171.imageshack.us
    Redstone: 527/252
    Inputs Isolated: Yes
    Outputs Isolated: Yes

Locks

Simple Levers Lock by Warillusen

Example:
Posted Image

The concept is simple. Place a torch on the block for each lever you want to be ON for the correct code, and redstone for any lever you want OFF. The output torch will only light up when all the levers with torches are ON and the ones without torches are OFF. Easily expandable for larger locks. In the example, the code (from left to right) is 1-2-4.

Simple PIN-style combo lock with monostable timer by Fireside (post)


Other/In-depth Designs

How to make a parallel bus bend with no delay by paj2323 (schematic) (.gif)

FAQs

Ask, and ye shall be answered!

How can I make buttons act like levers?
Solution by howlingmonkey and Laogeodritt - Attach the buttons to the input of a T Flip-Flop. Typically, T Flip-Flops are edge-triggered, meaning that the output toggles when the input changes states. With this set up, Pushing the button once turns the output on, and pushing it again turns the output off, exactly the same as flipping a lever. Some T Flip-Flops are level triggered, meaning they will constantly toggle as long as the input is HIGH. Be sure to pick a design that is edge-triggered for your own ease-of-use.

Design Posting Guide

If you've got a design to post and you want to make my life easier, might I suggest using this posting guide:

[b]Short Name of Circuit[/b] (5x5x5) by You ([url=http://www.box.net]schematic[/url]) [list]
Short description of your circuit. Be sure to include any restrictions, such as if it is orientation-dependent (due to N/S quirk).
[img]http://img171.imageshack.us[/img]
[b]Redstone:[/b] 5/4
[b]Inputs Isolated:[/b]
[b]Outputs Isolated:[/b]
[/list]

For the Redstone entry, the number on the left is the amount of redstone wire, and the number on the right is the number of redstone torches. Don't include any extraneous input or output wires you may have been using for testing. The easiest way to get this information is to open the schematic in Redstone Simulator and check the count at the bottom-right corner. Thanks!


Other Resources
--The Absolute Beginner's Guide to Everything Redstone by trunksbomb - understanding the basics of logic and redstone (self-advertising, yea!)
--"red stuff" logic gates  by casino.doug - The original topic, contains many, many schematics.
--Redstone FAQ and General Tutorial, and the new addition: Part 2, Logic by Rotten194 - two additional guides on redstone with useful information.
--Minecraft Wiki, Circuits - The Minecraft Wiki entry for redstone circuits (see also "Advanced Circuits")
--More redstone quirks (for hardcore redstone fanatics) by bugi74 - Very in-depth discussion about the science (read: programming) behind redstone. Very important concepts for time-sensitive circuits.

Register or log in to remove.

#2

trunksbomb
    trunksbomb

    Glowstone Miner

  • Retired Staff
  • 3065 posts
  • Location: Under the bridge

Posted 21 December 2010 - 05:16 AM

I'll go ahead and pose the first question of the new thread:

I want to use buttons as levers. Basically, pressing the button will toggle the output and keep it that way, the same way a lever would. What I've got so far is a button as the input to a NOR latch that will turn the output ON and leave it ON. What I then want to do is hook that same button up to the reset of the NOR latch (through some series of gates) such that pressing the button again will turn the output off. I haven't been able to figure out the reset part so that the button will act like a lever.

What I was thinking was somehow doing an IF statement that uses the button and the output of the NOR latch as inputs, and have the output be true if both are ON (button is pressed while output of latch is ON). The output of this IF statement would hook straight to the reset, so that pressing the button while the latch output is ON will cause the latch output to be OFF.

*Edit* On an aside, I made a 3x3x3 5-clock generator. I didn't have the patience to make a proper .gif out of it, so here it is in .png form:

Posted Image

#3

howlingmonkey

Posted 21 December 2010 - 06:17 AM

trunksbomb said:

I want to use buttons as levers. Basically, pressing the button will toggle the output and keep it that way, the same way a lever would.
Use a T flip-flop. There are a couple designs in the wiki and a number of better ones in the old thread.

#4

Laogeodritt
  • Location: Montréal, Québec, Canada

Posted 21 December 2010 - 06:19 AM

If there's one thing I really love about the Minecraft community, it's the innovation in architecture and engineering within the game. *subscribes to the topic*

Also, is there any way of importing the animated GIFs directly into a redstone simulator? Or could we start posting the .rdat files? It'd be nice to be able to take one's time studying these without opening up ImageReady (or mess around with them without having to recreate them) =P

As for using buttons as levers, use T flip-flops. They're edge-triggered (when the input goes from off to on); as long as you don't need to hit the button more frequently than the pulse width ("on" time) of the button, you're good.

EDIT: Ninja'd. Bah.

#5

trunksbomb
    trunksbomb

    Glowstone Miner

  • Retired Staff
  • 3065 posts
  • Location: Under the bridge

Posted 21 December 2010 - 06:54 AM

Thanks guys, that's exactly what I needed. I'll admit, I just saw the NOR latch and ran with it.. I didn't even think to look at other memory devices. What I was trying to do was rig a double door such that it could be opened and shut by the press of a button from either side. The traditional way is to use levers, but I didn't like the way the levers were either up or down, because it made it seem like the ON or OFF states of the levers affected the operation of the door. This way is much cleaner looking!

I'll add this in the FAQs section and credit you both.

Also, what did you think of my 3x3x3 5-clock generator?

Posted Image

#6

Laogeodritt
  • Location: Montréal, Québec, Canada

Posted 21 December 2010 - 07:05 AM

Ooh, 3³ 5-clock? That's quite nice, actually! I've had trouble fitting my clocks into some of the design experiments I've made. (Mind you, mostly just messing around in the sim now.) That'll be nice for squeezing it into a spare corner.

#7

trunksbomb
    trunksbomb

    Glowstone Miner

  • Retired Staff
  • 3065 posts
  • Location: Under the bridge

Posted 21 December 2010 - 06:25 PM

Glad you like it. I'll put it in the main post. Also, I'll start linking to the schematics as well as the .gifs, when available.

#8

xgkkp
    xgkkp

    Coal Miner

  • Members
  • 148 posts

Posted 21 December 2010 - 10:24 PM

Thanks for the PM update - In any case, the old thread was massive, full of incredibly out of date information at the beginning (because the way redstone worked had been changed) and no doubt heavily intimidating to any people starting out.

#9

Laogeodritt
  • Location: Montréal, Québec, Canada

Posted 21 December 2010 - 10:43 PM

xgkkp said:

(because the way redstone worked had been changed)
Oh? How has it changed?

I'd actually be rather interested in a history of Redstone.

#10

Towel
    Towel

    Obsidian Miner

  • Members
  • 1332 posts
  • Location: on your favorite chair

Posted 21 December 2010 - 11:16 PM

Laogeodritt said:

xgkkp said:

(because the way redstone worked had been changed)
Oh? How has it changed?

I'd actually be rather interested in a history of Redstone.
When it was initially released, the torches could feed into blocks without any wiring in between, but this lead to massive clusterfuck headaches.
meowmeow

#11

Laogeodritt
  • Location: Montréal, Québec, Canada

Posted 21 December 2010 - 11:45 PM

Oh, I see.

Much as it can save space, I can see how problematic that could be. x_o

#12

xgkkp
    xgkkp

    Coal Miner

  • Members
  • 148 posts

Posted 22 December 2010 - 02:16 AM

Which reminds me, did anyone ever properly work out the rules that led to the annoying trait of pulses being lost when sent down certain chains of repeaters? I know we sort of settled on torches turning off quicker than on in certain configurations, but don't remember anything explicit being worked out.

#13

Cadde
    Cadde

    Gold Miner

  • Members
  • 428 posts
  • Location: Swe

Posted 22 December 2010 - 06:40 AM

xgkkp said:

Which reminds me, did anyone ever properly work out the rules that led to the annoying trait of pulses being lost when sent down certain chains of repeaters? I know we sort of settled on torches turning off quicker than on in certain configurations, but don't remember anything explicit being worked out.

I bet it has everything to do with how torches turn off faster than turning on in certain situations.
But even so, there would be cases where a certain length of wire could cause timing issues as well...
And then there's the N-S W-E quirk to keep in mind. If only there was a way to measure redstone timing accurately to the last tick of the game clock.
OreVeins mod: Get it while it's hot!

#14

Cadde
    Cadde

    Gold Miner

  • Members
  • 428 posts
  • Location: Swe

Posted 22 December 2010 - 06:51 AM

trunksbomb said:

I'll add this in the FAQs section and credit you both.

....

T Flip-Flops are edge-triggered
Not all designs presented are edge triggered. Some are level triggered!
With that said, check the post i link below for a decent design of an edge triggered T-Flop not on the wiki page.

viewtopic.php?p=1287743#p1287743

Also see VincentLaws design below my post, it's supposed to be a smaller version of mine but never tried it. (actually only noticed it now :s)
OreVeins mod: Get it while it's hot!

#15

trunksbomb
    trunksbomb

    Glowstone Miner

  • Retired Staff
  • 3065 posts
  • Location: Under the bridge

Posted 22 December 2010 - 02:00 PM

Thanks, Cadde. I corrected the information in the first post and added VincentLaw's compact version of your T Flip-Flop as well.

#16

sts
    sts

    Tree Puncher

  • Members
  • 27 posts

Posted 22 December 2010 - 05:51 PM

This stores a bit; if S if off, then the O will be given I's value. If S is on, O will keep its value. I've tried messing around with Nor latches to store bits but I found this way easier to wrap my head around what is going on. It is a D Flip Flop and a multiplexor wired to the I, O, and S. However, it seems kind of big, is there a better/smaller way of doing this?

Posted Image
(schematic)

#17

Cadde
    Cadde

    Gold Miner

  • Members
  • 428 posts
  • Location: Swe

Posted 22 December 2010 - 07:14 PM

sts said:

This stores a bit; if S if off, then the O will be given I's value. If S is on, O will keep its value. I've tried messing around with Nor latches to store bits but I found this way easier to wrap my head around what is going on. It is a D Flip Flop and a multiplexor wired to the I, O, and S. However, it seems kind of big, is there a better/smaller way of doing this?

Posted Image
(schematic)

HowlingMonkey knows whats what:

Posted Image

In other words, smallest D-Flip flop I've ever seen and is used in my 8-bit PISO.
OreVeins mod: Get it while it's hot!

#18

trunksbomb
    trunksbomb

    Glowstone Miner

  • Retired Staff
  • 3065 posts
  • Location: Under the bridge

Posted 22 December 2010 - 07:45 PM

I'm making a "creepy" minecart ride underground. I have a minecart that will be boosted through an underground tunnel, and I want the only light source to be redstone torches. Instead of staying on, or flashing to the pulse of a clock, I want there to only ever be 1 torch on. I basically want a clock to send a signal to a latch, and the latch to send a signal to an edge-triggered pulsar that will shoot off 1 signal that will travel down the line of torches and light them sequentially. The last torch will be connected to the reset of the latch, so the clock will send the signal again and start the process over.

I think I could get away with just using a constant input to the latch.. not sure. If this sounds reasonable, let me know.

The torches are placed on a wall, every two spaces.

In the end, it would look like a light-strip on a runway.

#19

Cadde
    Cadde

    Gold Miner

  • Members
  • 428 posts
  • Location: Swe

Posted 22 December 2010 - 07:58 PM

trunksbomb said:

Also, what did you think of my 3x3x3 5-clock generator?

Posted Image

Looks good but...

Posted Image
Schematic

Since i read somewhere that people want a schematic with the gifs for easy insertion into Restone Sim.
I thought a little standardization is in order...

Hence, this gif was originally 84x84 pixels. I increased the canvas to 264 pixels horizontally  (6 pixels gap between each layer in the design.) and pulled the layers out like so.
Then i changed the canvas vertically to 28 + 84 + 28 + 23 to fit the layer denotation (1/3 to 3/3) and the name of the gate (3x3x3 5-Clock) and the author (trunksbomb).
The font used was Arial BLACK @ 24pt and Arial Italic @ 18 pt for the author. The font that is normally used is Arial BLACK @ 24 pt for all inputs and outputs.

In other words, i wish we could get some kind of standardization here. However short of editing the gif files...

The redstone sim has a block called a "shadow" that causes a certain grid not to be drawn in the gif at all. As can be seen above in the picture of the 3x3x3 5-clock.

How to use in Redstone Sim:
Posted Image

Then, using the adjust size window (or holding CTRL and pressing 2, 4, 8, 6 and 3, 9 on the numpad) you can reduce the working area around your gate so that the gif animation isn't obscenely large needlessly.
While i would prefer it if you removed the last frame in any gif that ONLY shows "wire on ground" it's not entirely necessary. All this for easier reviewing of your gates without downloading the schematic file. (Some of us can actually follow the flow of a certain gate just by looking at the gifs)

That is all for now :(
OreVeins mod: Get it while it's hot!

#20

Grizdale
    Grizdale

    Void Walker

  • Members
  • 1527 posts

Posted 22 December 2010 - 08:44 PM

i dont understand the layout of the redstone circuits on the forums since i taught myself how to use them and I created my own method of making a button act as a switch my circuit required a 11*3*11 volume tho so was hardly efficient for the space used.

since im here tho ill try and learn how they work since the t-flip flop method does seem much more compact than my own.

also does any one have any idea how to efficiently create a counting system that increases by 1 for each time a button is pressed the one i had before could only count to 7 and took 23*3*11 volume. the binary-decimal conversion isnt necessary since i dont really plan on using that
Posted Image