Our computers and laptops are literally a big black box with a monitor, keyboard, and mouse. What is going on inside? Circuit diagrams have all the answers…except they are impossible to figure out unless you spend an entire semester trying to understand them. Our solution is to build a CPU in Minecraft, a popular sandbox game in which players can build various types of “blocks” and “objects” which interact with each other and the player.
Our goals for this project are to:
There are three major reasons we wanted to create an 8-bit CPU in Minecraft.
Expect this section to be fairly long. We will explain to you EXACTLY how we did everything. This includes designing our 8-bit architecture, writing assembly language to execute certain tasks, building our designed CPU in Minecraft, and setting up our world so that it is easy for non-specialized individuals to learn about how a CPU works.
Before we started designing our architecture, we needed to decide on the specifications of our architecture. The following describes our CPU using words:
The following is the list of registers we have. We have a total of 8 registers, each having the size of a single byte. The first four registers are reserved for the CPU and each serves a specific purpose for the execution of each instruction. The remaining registers are general purpose registers for the programmer to manipulate however he/she pleases.
Purpose: [ACCumulator] Certain operations, such as adding immediates, can only be done to the accumulator register. This is necessary in order to accomodate all possible operations possible.
Purpose: [Data Memory Pointer] The user will only be able to access the address in the data memory indicated by the Data Memory Pointer.
Purpose: [Jump Pointer] Whenever we need to jump to or branch to a specific point in the data memory, the program counter will change to the value located in $JP.
Purpose:[Zero] This register is always set to 0.
Purpose: General purpose register 0
Purpose: General purpose register 1
Purpose: General purpose register 2
Purpose: General purpose register 3
Our CPU will be able to execute the following instructions. If you want to make a program, the following section will serve as the documentation required to create the program.
Format: | 000aaabb |
Description: [MOVe values (extra A)] Move the value from register $b to $a. $a=$b. Notice that only 2 bits have been allocated for the $b register, even though there are 8 registers. $b registers may only select general registers. (00 selects $G0, 11 selects $G3)
Format: | 001aabbb |
Description: [MOVe values (extra B)] Move the value from register $b to $a. $a=$b. Notice that only 2 bits have been allocated for the $a register, even though there are 8 registers. $a registers may only select general registers. (00 selects $G0, 11 selects $G3)
Format: | 010aaabb |
Description: [Jump if Equal] Jump to a different location in the program if the equal condition is met. The program counter will be set to the value located in $JP when the value at register $a is the same as the value at register $b. Note that because there are 2 bits for b, $b will always be a general register. (00 selects $G0, 11 selects $G3). For an unconditional branch, set $a=$b.
Format: | 011aaaxx |
Description: [ADD Register] Add a register value to the accumulator. $ACC = $ACC + $a.
Format: | 100iiiis |
Description: [ADD] Add an immediate value to the accumulator. If s=0, then $ACC=$ACC+0000iiii. If s=1, then $ACC=$ACC+iiii0000.
Format: | 101xxxxx |
Description: [RESet] Reset the accumulator to zero. $ACC = $Z.
Format: | 110aaaxs |
Description: [Transfer Word] If s = 0, store a byte from the register file to the data memory. The value in register $a will be stored to the address in the data memory indicated by $DMP. If s=1, load a byte from the data memory to the register file. The value stored in the address in the data memory indicated by $DMP will be stored to register $a.
In order to build the world, we used a mod pack called Feed The Beast Ultimate. It contains many different mods which made this project possible. The main mod we used was called RedPower, which contains many different logic gates and other circuit components with which we could build our CPU with. We then used MCedit to copy and paste large chunks of repeatable blocks. The following videos show off our world and CPU, and help give a sense of how we built it.
We spend a lot of time on this, but there is still a lot of work that can be done on this. For this reason, we are releasing all of our documentation and our world. All instructions will be included in this zip file. The following improvements are to be made: