DanPC is a simplified Minecraft version of the HACK hardware architecture specified in the book The Elements of Computing Systems: Building a Modern Computer from First Principles.
Download (V2, 2013-03-26, 863 KB)
The ALU, or arithmetic and logic unit, performs aritmetic and logical operations on inputs.
ALU (comp) instruction set when the Address register* is being used:
*Notationally, A is replaced with M when the RAM output is being used. (This is chosen by the A/M Multiplexor.)
**These instructions are not yet implemented. They will probably never be added, as more logic gates would be required.
Inputs: A/M Multiplexor, Data Register, Microcode Decoder; Outputs: Data Register, RAM (Input), ROM/ALU Multiplexor
The RAM, or random-access memory, stores data for future retrieval.
Inputs: ROM (Write control), Address Register (Selection), ALU (Input); Outputs: A/M Multiplexor
The ROM, or read-only memory, stores preloaded instructions or programs.
Inputs: Program Counter; Outputs: ROM/ALU Multiplexor (for A-instructions), Address Register (for A-instructions), RAM (Write control), Microcode Decoder (ALU instructions), Jump Logic
The address register has three purposes: to select a memory cell, to provide a second operand to the ALU, to specify a target ROM address for a jump.
Inputs: ROM/ALU Multiplexor; Outputs: Address Register (Selection), A/M Multiplexor, A/PC-incrementer Multiplexor
The data register stores an operand or result for ALU.
Inputs: ALU; Outputs: ALU
The PC register stores the ROM address of the current instruction.
Inputs: A/PC-incrementer Multiplexor; Outputs: ROM, Program Counter Incrementer
The program counter incrementer increments the current instruction by one.
Inputs: Program Counter; Outputs: A/PC-incrementer Multiplexor
The ROM/ALU Multiplexor selects between storing the ALU output into the register and storing the ROM output into the Address Register (A-instruction).
Inputs: ROM, ALU; Outputs: Address Register
The A/M Multiplexor selects between sending the RAM output to the ALU or sending the address register output to the ALU.
Inputs: Address Register, RAM (Output); Outputs: ALU
The A/PC-incrementer Multiplexor selects between the incremented PC value, and the value of the address register for jumps.
Inputs: Program Counter Incrementer, Address Register, Jump Logic; Outputs: Program Counter Register
The jump logic contains gates that decide whether or not a jump condition has been satisfied.
Inputs: ROM (Control), ALU; Outputs: A/PC-incrementer Multiplexor
Decodes instructions from ROM and sends control signals to ALU.
Inputs: ROM; Outputs: ALU