Remove this ad
avatar

jonajames

Fully Fledged

Posts: 2 Member Since: 25 February, 2015

Lead

25 February, 2015 14:19:57

Tags : : , , ,

=========SurCpu==========
A simple, yet powerful survivalcraft CPU
image

Introduction
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!

Features:
    • 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

Screens:
image
Front Side

image
Back


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.
image

DESCRIPTION
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

ISA
OPCODEHEXASSEMBLYNAMERRHIREGPC
00000ADDIADD IMMEDIATERR+I  PC+1
00011ADDADDRR+REGRR+REG/16 PC+1
00102MULMULTIPLYRR*REGRR*REG/16 PC+1
00113DIVDIVIDERR/REGRR%16 PC+1
01004ANDBITWISE ANDRR AND REG  PC+1
01015ORBITWISE ORRR OR REG  PC+1
01106NOTINOT PLUS IMMEDIADE~RR+REG  PC+1
01117LILOAD IMMEDIATEREG  PC+1
10008SLTSET LESS THAN1 IF RR  PC+1
10019MFHIMOVE FROM HIHI  PC+1
1010ASRRSAVE RRREG RRPC+1
1011BLRRLOAD RRREG  PC+1
1100CCHRCHANGE REGISTER   PC+1
1101DSPISERIAL PHERIFERIAL INTERFACESIN  PC+1
1110EBZRBRANCH ON ZERO   IF RR=0PC+I ELSE PC+1
1111FJALJUMP AND LINK REGISTERPCLOWPCHI PCLOW=RR PCHI=REG

GET IT OR BUILD IT!
All resources Can be found here:
https://www.dropbox.com/sh/26cj5i5sxwtcoia/AAB0DquCFK_78AtcvunIIZm9a?dl=0
DOWNLOAD
As soon as I've done some testing i will publish a surcpu.scworld containig the CPU with all MEM blocks alredy programmed

MAKE ONE
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:
//SURCPU.scworld
     + - - - Chunks.dat
     + - - - Project.bak
      \ - - - Project.xml
Open  the "Project.xml" file with a text editor (ex: notepad) and find the  section starting with:
image
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:
https://www.dropbox.com/sh/26cj5i5sxwtcoia/AAB0DquCFK_78AtcvunIIZm9a?dl=0
RELEASE HISTORY
v0.2.0 26/02/2015
*first release

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...

Creations
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

Quote    Reply   
Remove this ad
Remove this ad
avatar

Stanimus

City Founder
Old Timer

Posts: 1,350 Member Since:19 July, 2014

#1 [url]

2 March, 2015 04:17:11

Yes, I agree the Memory Bank is the most amazing block in all of SC universe.
This looks incredible and it's all on one wall! Please keep us informed on how your testing goes...?
 

————————————————————
"[The future] is a place about 70 miles east of here - where it's lighter." - Laurie Anderson


Stanimus

Quote    Reply   
avatar

Awesome Sauce

Survivalist
Fully Fledged

Posts: 284 Member Since:26 December, 2014

#3 [url]

18 July, 2015 17:23:29

It depends. I find python to be easier, and more similar to javascript, but C opens up a lot of powerful, mobile based options.


Quote    Reply   
avatar

Stanimus

City Founder
Old Timer

Posts: 1,350 Member Since:19 July, 2014

#4 [url]

18 July, 2015 18:42:03

Both. To the purists, Python isn't a true language. It's more like a scripting language than a programming language. One of the variants of C is good. I've learned at least 6 cpls and forgot much of each of them. Now I just refresh whichever one I want, when I need it.

————————————————————
"[The future] is a place about 70 miles east of here - where it's lighter." - Laurie Anderson


Stanimus

Quote    Reply   
Add Reply

Quick Reply

bbcode help