Maker Pro
Maker Pro

Minecraft 4-bit CPU.

Mongark

Apr 12, 2016
3
Joined
Apr 12, 2016
Messages
3
Hi everyone!
I want to build a simple 4-bit CPU in minecraft thats executes basic arithmetic, like ADD and SUB and write
this program:
lda 5 ; Load value 5 into register A
ldb 5 ; Load value 5 into register B
addab ; Add the two values
Just this! I've made a instruction set and all the design, except the CPU. If someone could help me wold be grateful.

Mongark.
 

dorke

Jun 20, 2015
2,342
Joined
Jun 20, 2015
Messages
2,342
That is not very complicated.
You need to define the representation method of negative numbers
(Lets assume 2's compliment).
This will usually "eat up" one bit of the 4bits for the sign bit .


You need a 4 bit adder,with a carry input.
Two 4bits registers to hold the values A and B.
The result may be held in another 4 bit register+a carry bit.


For adding A+B :
add A and B with carry-input =0


For subtraction A-B :
Logically invert B ,and add the result to A with carry-input=1
 
Top