CONTENT

xRISC 3L

This computer has been designed and built over one weekend in ~2013/05 by two excited ~16 year olds: me, and one M. Dreef.

Grotesquely silly and inefficient in design in retrospect, it was nonetheless whipped up very quickly, and we still happen to be somewhat proud of it all these years later. :3

Not RISC-like whatsoever.

A glorious printout showing fibonacci numbers

Perhaps OneDay™ there will be a v2, addressing all the mistakes mentioned here while retaining most of the soul of the previous design.

This article is quite unfinished

Features

Design

The Silly Architecture

Microarchitecture of the x3L

The Silly Instruction set

The instruction set of the x3L is very simple, containing only 8 mushy instructions:

The general bitwise structure of each instruction word is described by this pattern: AAABBBDDDDDDDD, where:

The opcodes are the following:

The Silly Register map

All registers are readable and writeable, there is 8 that are accessible by the B index:

There’s also the moderately useless W-register, serving as an intermediary for all moves. Not sure how necessary W-register’s existence was at all, it only slows down moves even more…

ALU Operation Codes

The bits of the ALU operation bits (coming from D) are mapped like so:

These function of the ALU is identical to the one mentioned in nand2tetris chapter 2. This also mentions useful configurations of the ALU operation bits.

Some code samples

These code samples are provided as-is, as they have been found from the ages long passed.

Some assembler quirks:

Fibonacci Numbers

Sources available here:

MVLR 4, 00		;Setup initial values
MVLR 5, 01
ALUO 40			;Add X and Y
MVRW 5			;Move Y to X
MVWR 4
MVRW 6			;Move OUT to Y
MVWR 5
WPRT			;Output
JUMP 02

Multiplier

Source available here:

MVLR 0,03			;stuff you want to multiply
MVLR 1,08			;stuff you want to multiply with - 1
MVLR 2,00			;clear the output register
	MVRW 1			;LOOP:
	JIWZ 12			;JIWZ END
	MVRW 0
	MVWR 4
	MVRW 2
	MVWR 5
	ALUO 08			;00001000 - X+Y
	MVRW 6
	MVWR 2
	MVRW 1
	MVWR 4
	ALUO 31			;00111000 - X-1
	MVRW 6
	MVWR 1
	JUMP 03			;JUMP LOOP
	MVRW 6			;END:
	WPRT
	JUMP 14			;DEAD, JUMP DEAD

The code above is said to be equivalent to the C pseudocode below:

;while(r1 != 0){
;	r2 = r2 + r1;
;	r1--;
;}
;print(r2);

The Silly Assembler

One may use an extremely simple Java 7-based assembler to assemble the .x3 files above.

To use it, call it from the command line like so: java -jar xrisc3Lcompiler.jar [path to .x3 file]

The result will be .x3hex file created in the same directory as the .x3 file. This file will contain assembled binaries used as a template for manual placement of redstone torches into the program memory.

Sample output with the Fibonacci program above:

001 100 00000000
001 101 00000001
101 000 01000000
010 101 00000000
011 100 00000000
010 110 00000000
011 101 00000000
100 000 00000000
110 000 00000010

Possible Revamps?

There are quite some small tweaks that could’ve made this machine a bit less painful to use and somewhat more powerful.

Perhaps one day we’ll pick this up again and tweak it?

This article is unfinished

A few things are missing: