Millions of students learn and have fun in Minecraft, punching trees, crafting swords, and blowing up their friends' houses with TNT, but Minecraft has another aspect with serious learning potential: Redstone. In Minecraft, you can build circuits using Redstone that behave very similarly to real digital circuits. Although a lot of the complexity of digital circuit design is hidden away, serious experimenters have been able to create amazing circuits, emulating entire computers in Minecraft. If this skill was easy transferrable to the closest industry equivalent, Verilog programming, these students would be on track to have successful careers. RedSi exists to put these students on learning track to take their Minecraft Redstone knowledge and directly compile those circuits into industry standard Verilog which runs on a FPGA.
What it does
The first step of the RedSi process is to build a circuit in Minecraft. Then, the simple
/redsi command is run on the server, a typical task that most Minecrafters of all ages are able to complete, and this starts the compilation process. A spigot plugin on the server written in Java collects the block data marked out by the user and sends it to a python program that forms the compiler. The Python program first accounts for most of the complexities of the Minecraft Universe to develop a net list and logic gate list which represents all of the operations performed by the Minecrafter’s circuit. Then, these nets and gates are optimized to remove logic gates that have no function, and after this, a Verilog module is synthesized. This module is then placed in a normal FPGA toolchain, and turned loose on an FPGA development board.
How we built it
RedSi connects to an active Minecraft server through a plugin which can be easily installed. In-game, the user is able to build a circuit using Redstone. Once they complete it, they can activate the plugin through a command-line interface (CLI). The plugin gets all of the selected blocks and uploads their metadata to our Linode server.
The server processes all of the blocks and, following the rules of how Redstone works, convert that into equivalent Verilog code. Then, it generates a full Verilog file and returns that URL to the user to download.
Challenges we ran into
Documentation for creating a Minecraft plugin is of varying quality and not always correct. Several dependencies used the same class names and non-standard method names. Additionally, it was challenging to create a Java build-script that would generate the correct type of
jar file for Minecraft to read.
The Minecraft Redstone system has seen many years of development by a highly skilled development team, and we were required to emulate many of the features of the Minecraft Redstone engine. The system is fundamentally a Redstone to Verilog compiler, and carried with it the technical difficulty compiler design is known for.
Accomplishments that we're proud of
The command-line interface has a number of flags for quick debugging without having to restart the plugin. It made development much easier since we could quickly see information.
We’re very excited that we were able to take the full potential of a children’s learning tool and apply it to a platform very few industry professionals can master. To the extent of our research, no one has done this before. 1020 intense lines of code and five programming languages after we started, we’re able to take most of our Freshmen year digital circuits, make them in Minecraft, and then see them on an FPGA with the power of RedSi.
What we learned
We learned a lot about Java build scripts and the differences between Maven and Ant. We were also exposed to the basic building blocks of compiler design through the design of the Redstone to Verilog Converter. The team also exercised a lot of our computer science knowledge as we worked through various algorithmic problems.
What's next for RedSi
The next step for RedSi is to clean up the code so that it can easily be installed and run on other Minecraft servers. The Verilog compiler we developed can also be refined to work with more complex types of systems.