Reilab

Minecraft 5 bit adder–subtractor
A 5 bit adder–subtractor implemented in Minecraft vanilla. Made completely out of basic redstone logic gates using real digital circuit concepts.
The basics: Redstone logic gates

First of all, to implement any kind of digital circuit in Minecraft we need to design the logic gates we will be using.
Redstone torches have the property that can be turned off when a HIGH signal is applied to the block who are attached to. This by itself is a NOT gate. If we combine the output of 2 of this NOT gates, we get a NAND. With a NAND we can do any other gate, but in Minecraft we can get simpler gates with some tricks, so let’s continue designing logic gates. Attach another torch to the output of a NAND and is now an AND gate. For an OR gate we just need to combine 2 signals, but one input can pollute another one, so we add a redstone repeater to make the input unidirectional.
Circuit design

The circuit flow is the following:
- An input in BCD is given by the player.
- The BCD signal is sent to a 7-segment decoder to display the inputted value.
- The same BCD signal is also sent to two BCD to binary converters, one for each number.
- The two binary signals are used as input for the adder–subtractor.
- The player has the option to add or subtract from the control panel.
- The output of the adder–subtractor is sent to a Two's complement.
- The signal is sent to a binary to BCD converter.
- The BCD signals are then converted by the 7-segment decoder to display the output value.