What is the best feature in Survivalcraft? “4bit analog memory bank block”, definitely.
With the MEM block you are able to create:
• A Register, using a clock and a wire through block
• A RAM, 256x4 banks read/write
• A programmable logic block, just fill the memory with the sum of its row and column, and you have an adder!
So what do you do with such things?
An easy to build MIPS inspired CPU!
• Easy, requires just a couple of hours to be built
• Compact, single board, 36x17x7
• Up to 256 8Bits instructions
• 4Bit opcode RISC
• 256 4Bits registers, 16 of which can be addressed directly
• Open Source, free, and customizable
• Sync/Async SPI-like interface to interact with up to 16 different external devices
Datapath and architecture explanation
This section is not really noob-friendly, and is intended for people that knows very well how a single cycle MIPS32 CPU works.
Two MEM blocks acts as a program counter, addressing 2 memories: OPM that contains all the opcodes, and VALM that contains immediate values or addresses the register file.
The register file has two inputs, one is addressed directly by the VALM register, the other one is connected to a counter that lets you change/reset the current REG row.
A special register called Return Register (RR) is used as first operand and return register, so you have to load and save it in order to perform operations
The ALU is divided in 16 different sections; each section handles the return of a single operation
There’s a secondary, smaller, ALU called HIALU that writes on a specific register (HI)
The SPI interface is composed of 4 wires:
1. Clock useful to write to external devices
2. Slave Select, connected to the immediate field can be used to control a multiplexer
3. Master out, always contains the RR
4. Slave in, when the SPI function is called this wire writes to the RR
|0100||4||AND||BITWISE AND||RR AND REG||PC+1|
|0101||5||OR||BITWISE OR||RR OR REG||PC+1|
|0110||6||NOTI||NOT PLUS IMMEDIADE||~RR+REG||PC+1|
|1000||8||SLT||SET LESS THAN||1 IF RR||PC+1|
|1001||9||MFHI||MOVE FROM HI||HI||PC+1|
|1101||D||SPI||SERIAL PHERIFERIAL INTERFACE||SIN||PC+1|
|1110||E||BZR||BRANCH ON ZERO||IF RR=0PC+I ELSE PC+1|
|1111||F||JAL||JUMP AND LINK REGISTER||PCLOW||PCHI||PCLOW=RR PCHI=REG|
GET IT OR BUILD IT!
All resources Can be found here:
As soon as I've done some testing i will publish a surcpu.scworld containig the CPU with all MEM blocks alredy programmed
You can build it by yourself following one of the Schematic files
Once built you need to program each memory block in order to get the cpu work, this means you have to write the right code in some MEM blocks (56 actually)
To do so (obviusly you can go and write them all by hand) just insert the codes "b16b00b5" and "badb00b5" in the two reference MEM banks in the bottom left corner of the cpu.
Download the world to your computer and rename its extension from .scwolrd to .zip and open it. This is the contenent of the package:
+ - - - Chunks.dat
+ - - - Project.bak
\ - - - Project.xml
Open the "Project.xml" file with a text editor (ex: notepad) and find the section starting with:
There you can find all the MEM that contains something search for the two reference MEM and open SurCpu.exe.
Enter "p" and then the position of the two blocks
Copy the result and paste it in Project.xml under the right section
Save, repack and play.
SCSC SurCpu Software Center
This section is dedicated to the utility I'm going to make and expand to manage SurCpu
Download it from here:
TO DO LIST
*direct xml editor
*assembly compiler (with many pseudo-instruction)
*more custom functions (fibonacci, prime number...)
*direct scworld editor (basically it should only unpack automatically)
*simple code compiler (something that is able to translate "if then else endif")
*I have some more ideas, like a cpu spawner (editing shunks.dat) or porting the software to android....but I don't think i'll have so much time...
Codes, Scripts, Worlds and SPI slaves produced by the community will go there...
Last Edited By: jonajames 27 February, 2015 14:47:22. Edited 16 times