Since command blocks are great, I have been making a 4 bit CPU based around command block logic. Using testforblock and setblock in vanilla, I was able to so far create on a basis for a CPU with 4 usable registers, 2 temp registers, resiable program memory, 3 internal commands (ld d,r[f], ld r[f],d, inc pc), and one user op (ld r,imm).

Registers Left-to-right: User registers a, b, x, y, temp register d for internal commands, temp register f for flags to internal commands.


Program memory. Has ld a,6 (00nn / nnrr)


Instruction decoder is first two command blocks (00xx is ld r,imm), next 2 are block copies that move xxnn to d, next lone command block calls inc pc, next 4 block copies move nnxx to d and xxrr to f, next block calls read, last block calls inc pc.


internal commands' calling blocks and f register decoders in front.


back of internal commands.


Other op codes will just be added to on the decoder chain. Op codes include
Code:
ld r,imm Register load
ld r,r Register copy
in p  IO input to port #p
out p IO output to port #p
bz n  Branch if a == 0
cmp.t r Compare r with a using mode t (eq, neq, gt, lt), store result in a
add a,r
sub a,r
or a,r
and a,r
xor a,r
(inc/dec or rotates?)


<edit>I made a fast full adder (testing, not added to the CPU yet) that is 5 to 9 ticks per slice, depending on the logic.
Made a 4 bit full adder (add a,r) into the CPU, so far it works fine. Next for a not instruction and I will have subtraction.



<edit>

Ran a bunch of programs, works well, although slow. I wasn't aiming for speed, but this seems pretty fast for being unoptimized. Sample:
Code:
(a == 0)
ld b,0b0011
ld x,0b1100
ld y,0b0001
add a,b
add a,x
add a,y
(a == 0)
Hi,

Is your CPU "world" available for download ?

I'm currently playing with the "Commandore 32", to see how he's used the command blocks.

Before that I spent a lot (too much !) of time playing with RedStoneChips (on bukkit). I built a large part of a virtual CPU, but then got "stuck" trying to figure out how to make a micro-coded control section.

One of the only (*the only ?*) good examples I found of how to make a simple micro-code control unit was "Warren's Microcoded CPU" (made in Logisim).

I never made anything substantial with "raw" redstone, didn't have the patience to create a "bazillion" flip flops Wink

Mike
Yes, can you please put your world up for download?

I've been wanting to make a command block computer for months. It has been among my most important projects occupying my scarce free time. And until now, I thought that nobody had ever made one before in vanilla Minecraft and without programming from outside Minecraft (like Commandore 32). I see I was mistaken.

I would be very interested to look at your computer architecture. You would be doing everyone a favor to post your world.
> without programming from outside Minecraft (like Commandore 32)

Commandore is vanilla Minecraft.

The "outside Minecraft" is just for the compiler, which produces [ /scoreboard players set XX ] "Assembly language statements".

But as I look at it, so far, the command blocks don't seem to have made it that much smaller (if at all) from the usual vanilla-redstone computers. There still seems to be a large amount of "torch circuitry" in it.

Mike
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement