• Labor of Love is here! Visit our Labor of Love thread for a special message from the team, a look at brand new Labor of Love merch, and the changelog (minus a few surprises 😉)

[Projects] Tracktronics CPU

bawr

Terrarian
So, I've finally begun work on a simple 8-bit computer in Terraria, powered by rails.

(Yeah, I know it would be faster with hoiks, you're free to create a similar project with hoiks. ;))

Currently I have a clean number comparer and a full adder implemented, along with a number of logic gates. It's a bit of a problem that I have to thread the cart everywhere, but I expected far worse issues. The basic design is ready, we're going to go with a Harvard architecture, with separate code / stack / data memory.

I still need to implement multiplication and division on tracks, but it shouldn't be a problem.

Screens of WIP to follow, once I clear my test world up, I'll try to create a minimal two-register code-only version of the architecture, which should be enough to, say, run euclid's algorithm on rails.

Has anyone other than ZeroGravitas looked into advanced use of rails? Any tips?
 

ZeroGravitas

The Destroyer
The basic design is ready, we're going to go with a Harvard architecture, with separate code / stack / data memory.
I'm intriguided; big talk. :)

I didn't get much beyond the examples I posted in my 'Cart-tronics'? thread (very glad you were paying attention and decided to go with 'tracktronics', flattered too). I was going for a rail version of the Digi-Comp II (for symmetry with the hoik version), but I was trying to push out another, related project first before this (and a full Tracktonics guide), so this is as far as I got before going dark:
Terraria 2015-02-26 23-55-01-96.jpg

Wiring: Terraria 2015-02-26 23-55-31-31.jpg

Can't remember if it works fully, but that (blue line) distributor should add the binary number on the red line (yellow torches) to the accumulator at top (green torches). Easy enough to extend that into a multiplication by repeated addition (with a second binary counter determining the number of loops). Basic and slow.

Interested to see if you'll manage to short-cut this type of long-winded multiplication (and/or division). Also how you may have implemented memory storage/recall. Although I'm dubious that I'll be able to follow it through mentally; been pretty muddy up there for a long while.
Any tips?
Keep the design as simple and clearly laid out as poisible, even over-simplify to aid understanding (it's very hard to explain these things clearly). Colour code and label, etc. Also, watch out for rail junctions that look right but have slightly different functionality (multiples of same appearance). Fewer pitfalls than using hoiktronics, though; I found it more logical and elegant in it's way, though of course a little more limited, ultimately, with the one cart (multi-player would probably make things crazy unreliable, even if you can get the help!).
 

bawr

Terrarian
Well, my initial plan for multiplication is to implement a shift register (will come in handy in other places, too), and go with Booth's multiplication algorithm, no idea about division... yet.

Memory is really, really horrible at the moment, I'll be happy to show something once I clean it up. ;)

And you did remind me that tracks can be painted, which was in my mental blind spot, so thanks much for that. :D
 

ZeroGravitas

The Destroyer
plan for multiplication is to implement a shift register
Yup, sounds good.
Memory is really, really horrible at the moment
My main idea for a tracktronic memory bus was simply a ribon of parallel wires running up from the appropriate register. E.g. as the lines run up from the accumulator to the reset line in my build, currently. It would then be a case of selecting one of many write/read tracks intersecting this bus to commit/retrieve the binary value. Each memory track would be selectable with a binary coded distributor, with first bit of address value deciding top half or bottom half of the memory registers, each successive bit bifurcating further, etc. Much like DicemanX's design for the 7-Seg decimal look-up tables.
 

keycattie

Terrarian
I think that without hoiktronix it will be SOOOOO slow. It is very fast with hoik, but it takes more time to built and debug.
 

DicemanX

Brain of Cthulhu
I look forward to seeing what you've come up with, and I'm interested in seeing how you end up handling multiplication. As you might already know the reset line that ZeroGravitas posted in his tracktronics thread can be rewired into a feedback mechanism to make the shifter (just like the reset mechanism was adapted into a shifter in the double-dabble binary-to-BCD converter I posted). That same reset line can be adapted to read from and write to memory as well.

It also seems at first glance that all the hoik mechanisms can be replicated with carts, and the only major difference is latency.
 

ZeroGravitas

The Destroyer
and the only major difference is latency.
Certainly the same logic paradigms are interchangeable, so new mechanisms in either field should be possible to use in the other, carrying both forwards. Although, some features in favour of tracks:
  • Carts can double back along the same section (possible shortcuts + simplicity).
  • Tracks can have (non-interacting) cross-roads junctions (diagonal vs diagonal I think), easing routing.
  • Tracks can be more easily actuated for additional switching/routing options. You can even actuate pressure plate track, without plates popping off.
  • Much more compact (vertically) and the more expansive direction fits in with wide screen resolutions.
Against tracks: you can't go straight up vertically (although you could hybridise by adding in a cart hoik).
 

bawr

Terrarian
  • Carts can double back along the same section (possible shortcuts + simplicity).

This, so much this. For example, the number comparer can go through bits in any order, depending on which side you enter the track from. And my adder is made in a way that makes going back through it double as a reset line. ;)
 

DicemanX

Brain of Cthulhu
To be fair though, the listed tracktronics features allow for more compact structures rather than enabling something that cannot be done with hoiks (and the irony is that compactness isn't as important to cart mechanisms as it is with hoik mechanisms due to mob despawn issues). What I'm really curious about is whether carts enable mechanisms that cannot be achieved otherwise.
 
Top Bottom