Scrap Mechanic

Scrap Mechanic

Not enough ratings
Pseudo CPU (Central processor)
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
238.238 KB
23 Nov, 2021 @ 12:03am
6 Mar, 2022 @ 10:43am
2 Change Notes ( view )

Subscribe to download
Pseudo CPU (Central processor)

In 1 collection by smailovtimofey
TimCPU and other machines
23 items
Description
cpu what can:
store values(bytes),
make some math(add, sub, and, or, not, xor),
immediate value write

Made by Turing complete cpu design
Turing complete in steam:
https://steamhost.cn/app/1444480/

Codes

code is instruction.

last two bytes in code is mode

00 - nothing
01 - copy
10 - calculate
11 - immediate

Copy

7, 8 - mode
4, 5, 6 - arg2
1, 2, 3 - arg1

Copy(01) - copies from arg1 to arg2

list of arguments:

000 - reg0
001 - reg1
010 - reg2
011 - reg3
100 - reg4
101 - reg5
111 - input/output

Examples
01 111 001 - copy from input to reg1
01 010 000 - copy from reg2 to reg0
01 111 111 - copy from input to output
01 101 111 - copy from reg5 to output

Calculate

Calculate(10) - make math with reg1 and reg2 and return answer to reg3

7, 8 - mode
4, 5, 6 - nothing
1, 2, 3 - arg1

list of arg1:

000 - add
001 - sub
010 - and
011 - or
100 - not(take only reg1)
101 - xor

Examples
10 000 001 - sub reg0 and reg1
10 000 010 - reg0 and reg1
10 000 000 - add reg0 and reg1
10 000 101 - xor reg0 and reg1

Immediate

Immediate(11) write value to reg0 from code
7, 8 - mode
1, 2, 3, 4, 5, 6 - number

Examples
11 000 001 - write 1 to reg0
11 010 001 - write 17(00010001) to reg0
11 010 101 - write 21(00010101) to reg0
11 001 011 - write 11(00001011) to reg0

6.3.22: fixed little adder bug

CPU [en.wikipedia.org]