Tutorials/Redstone computers

This article examines the design and implementation of computing systems within Minecraft.

Computers facilitate the implementation of ideas which are communicated from humans through programming.

All computer systems have accessible memory and at least one processing unit. During operation, processing units execute instructions stored in the computer's memory.

Planning a Redstone computer
When designing a computer ( Redstone or otherwise ) key design decisions that will affect the organization, size and performance of your prospective computer should be made concretely prior to the construction of specific components.

Some things to consider:


 * Execution model ( The computer's organization of memory relating to program storage and execution )
 * Word-size ( The size of the information blocks which your computer will operate on )
 * Instruction Set ( That set of operations which your computer will execute )

Having a selection decided upon will provide strong guidance during the design of various components in your computer.

Execution Model
The technique of storing blocks of instructions called programs within memory is what allows computers to perform such a variety of tasks.

The apparatus employed by a computer for storing and retrieving these programs is the computer's Execution Model.

Two of the world's most successful Execution Models, Harvard and von Neumann, run on nearly 100% of the computers available today.

Harvard
The Harvard architecture physically separates the apparatus for retrieving the instructions which makeup an active program from that of the data access apparatus which the program accesses during execution.

Programs written for computers employing a Harvard architecture may perform up-to %100 faster for tasks which access the main memory bus. Note however that certain memory circuitry is necessarily larger for those who select a Harvard architecture.

von Neumann
The von Neumann architecture uses a two-step process to execute instructions. First, memory containing the next instruction is loaded, then the new instruction just loaded is allowed to access this same memory as it executes, using a single memory for both program and data facilitates Meta-Programming technology like compilers and Self modifying Code.

The von Neumann architecture was the first proposed model of computation and almost all real-world computers are von Neumann in nature.

Word sizes
Word-size is a primary factor in a computer's physical size.

In Minecraft, machines from 1-bit all the way up-to 32-bits have been successfully constructed.

Common word-size combinations :

Data-Word
The amount of information a computer can manipulate at any particular time is representative of the computer's Data Word-size.

In Digital Binary, the computer's Data-Word size ( measured in bits ) is equal to the width of or number of channels in the computers main bus.

Data-Words commonly represent integers, or whole numbers encoded as patterns of binary digits.

The maximum sized number representable by a Binary encoded integer is given by 2 ^ Data-Word width in bits - 1.

Some common Integer data sizes are:

Data-Word size also governs the maximum size of numbers which can be processed by a computers ALU (Arithmetic and Logic Unit).

Instruction-Word
The amount of data a computer needs in order to complete one single instruction is representative of a computers Instruction Word-size.

The Instruction-Word size of a computer is generally a multiple of its Data-Word size, This helps minimize memory misalignment while retrieving instructions during program execution.

=Designing a Computer=

Variables
Variables are numbers, strings (sets of characters) or booleans (true or false) stored in RAM for the purposes of running a program. For instance, booleans can be used to keep information for if the program has reached a certain state. The following information needs to be kept about a variable: Its name, type (number, string or boolean), and value. A variable's value can, as its name suggests, change. Operations can be done on variables. Variables are created while running the program and deleted from memory once the program closes. When a program is re-opened, the variables are re-created. It is the same in Minecraft.

Arithmetic Logic Unit


The ALU is one of the most important components in a computer, both in real life and in Minecraft. First, you must choose the functions you want to be able to achieve. Most often, those are addition,  subtraction and a set of logic options such as AND, OR,  NAND and the likes. You must then build the unit with all the logic gates and math functions you want and a way to choose which one's output to display.

Storage
Register

Random Access Memory


RAM is a kind of memory used by programs and is volatile. Most often, making it volatile has no use in Minecraft, so the easiest way to make some is to use d-flip flops and to add a reading and writing function. Making one is simple. You can make 1 flip-flop and then just stack it for as long as needed, with one block taken of each byte. See the following plan for help:

(redstone schematic to be done) Reference the picture if not sure (click on it to get it larger) r=wire p=repeater b=block t=torch on side of block 0=air

Layer 1 00trb00 rpb0tr0

Layer 2 0b0t00b tbbbbtb

Layer 3 0r0t00r 0rprr0r

Program Memory


Program memory is, most basically, ROM (Read-only Memory). ROM is most often used to perform a series of task remotely (such as a program, hence the name). It can be made to be used on user control (as in the picture) or with a clock and sufficient delay between each line so 2 aren't on at the same time. One of the simplest and most efficient design is the one in the picture, which may or may not be coupled with a decoder. It can be enlarged easily, which is another advantage.

Clock


Clocks are used to synchronize components or to time them. In most (Minecraft) cases, it is possible to avoid the use of one but sometimes it is necessary for the computer's functioning. It can be either made from redstone torches in basically a line/circle of NOT gates (an odd number is recommended or your output will have to be NOT'ed), or from repeaters, as in the picture above.

Redstone-Schaltkreise/Rechner