How to design advanced logic circuits?

  • aaronshenhao
    18th Nov 2017 Member 0 Permalink

    Hi everyone,

    my goal is to make a simple computer in powder toy. I already know how to build a basic programmable computer out of logic gates from a course I took, but it seems to be very hard implementing it in powder toy, especially using PTCT/NTCT technology.

     

    There seems to be many computers out there that uses FILT, ARAY, SWCH technologies, but I can't seem to find a guide anywhere. I'm currently up to constructing the ALU, but mine takes up the top half of the screen, whereas I've seen many other saves do it in a fraction of the size.

     

    Could someone please briefly outline the current technologies for making computers and their workings, and perhaps provide example saves? It would be great if there was a tutorial for this on the wiki, but there isn't one currently.

    Edited 2 times by aaronshenhao. Last: 18th Nov 2017
  • joaocool123
    30th Dec 2017 Member 0 Permalink

    rip nobody responded

  • aaronshenhao
    21st Jun 2018 Member 0 Permalink

    Bump? It's been half a year :(

    Edited once by aaronshenhao. Last: 21st Jun 2018
  • LBPHacker
    21st Jun 2018 Developer 1 Permalink

    If you're looking for the FILT equivalent of logic gates, the FILT wiki is pretty clear about that. Read that first if you haven't already, because I'll be referring to ideas explained there.

     

    If you're after small, fast and TPT-optimised tech, tutorials and examples are scattered throughout the realm of saves, though not many. These focus on each of the traits emphasised to various degrees. I'll try to explain those traits here and show examples, though of course 

     

    Optimising stuff for TPT is really important. For example, there are a boatload of ways to build a demultiplexer that chooses one thing from 2**n things given n bits. You can build it out of PTCT/NTCT logic or FILT logic or whatever, or you can exploit the fact that pistons exist in TPT and you can tell them how far to extend, and drive n pistons with the n bits. Pretty often these piston demultiplexers are the most simple to build. Example linked below the paragraph.

     

    You have to look out for things like that in TPT. Sometimes they are a pain in the neck and sometimes they help you build efficiently. Another example is how BRAY with a ctype of 0 dies, which means you very often end up building circuitry that tries to keep a few of the MSBs of FILT's ctype set, which loses you those few MSBs from the already quite limited 30-bit ctype; but it also makes it possible to build really small FILT circuits that make decisions.

     

     

    There aren't too many techniques for optimising for speed, and only one of them gets you huge improvements. It is of course the one with the steepest learning curve. We call it subframe, for which there exists a really good tutorial series by mark2222. First lesson linked below the paragraph. I've made one too and a few other tutorials exist, but mark's one is the most recent and most complete. For some reason subframe seems to remain more or less arcane to this day.

     

    Subframe is about exploiting the way TPT executes the simulation logic and particles' update functions, and it allows us to very precisely control how and when logic gets data from, handles and passes data on to other parts of the simulation, basically letting us do much more in a single frame than what would normally seem possible (hence the term subframe or thereabouts). Among other things it eliminates the astronomical times it takes sparks to slug their way from one end of the simulation to another.

     

     

    Optimising for space is probably the biggest hassle of all, especially as complexity increases. Size sort of depends on the other two traits and at the same time it doesn't. Unlike in the case of the other two traits, you can't always just take something in TPT and exploit how it's handled. More often than not it takes a lot of brainpower and drafting paper to come up with a design that's small enough and actually does its job at the same time. No one-for-all technique exists here.

     

    A technique that's definitely not a one-for-all but still proves immensely useful very often is called layering, which is basically a fancy name for moving particles on top of one another and praying that they won't get into a fight. Unfortunately I can't recall a good example of this technique so I'll just link an evolution save of mine. It's not strictly a showcase, rather it's a showcase of the most common techniques used in the TPT computer building scene.

     

     

    This is by no means a complete answer to your question and I may have put too much emphasis on a few things and too little on others. It's probably a good starting point though. 

  • mark2222
    21st Jun 2018 Member 1 Permalink

    To elaborate, making good tutorials is hard (and also time-consuming), so really there doesn't exist a lot out there. In particular, optimizing for space is very much a "research" field, in the sense that new tricks are discovered all the time and any tutorial covering it is bound to be incomplete. For non-subframe electronics there exists the not-so-complete Complete Electronics Tutorial but it's, as mentioned, incomplete, and doesn't cover space optimization that well.

     

    Modern, space-efficient TPT computers primarily exploit the fact that FILT can hold 29 bits of information at once, unlike SPRK that is only either on or off. As LBPHacker mentioned, the FILT wiki entry describes how this works. Going beyond this, however, takes a little work. Your best bet is to reverse-engineer other people's electronics, check the wiki for particles you aren't familiar with, and, when you're really confused, read the TPT source code (this process, incidentally, is how I learn about TPT computing). Also trial and error.

     

    When reverse-engineering, you might want to keep the following in mind:

     

    • Different processors have different bit widths. It's possible to make a significantly smaller computer simply by limiting yourself to 8 bits. (I'm looking at you, NoVIcE.)
    • Many space efficient computers use a technique called stacking (a.k.a. layering). I talked about it a little in my tutorial series (~2245936), but you don't need it to make (relatively) small computers (NoVIcE's 8-bit computer (~2169745) and my old 29-bit computer (~1570768) don't use it, for example). You can tell if stacking is used by ctrl-right-click-dragging over the whole computer and seeing if there are any particles left (if there are particles left, then stacking has been used).
    • TPT mechanics are really finicky. You might have a working component, but after you exit the game and reload it the next day, the whole thing stops working because of some timing issue. You will want to frequently reload particle order, which means, basically, to local save (not stamp) and local load (not reload). I talked aboout it in the context of subframe in my tutorial series as well (~2235222).
    • By now, you might be wondering what subframe is. Most computers don't use subframe, but a few modern ones do. Those work very differently from classical computers, and would confuse you horribly if you don't have basic knowledge about how subframe works. Usually you can tell that a computer uses subframe by looking for the "subframe" tag. It's up to you whether you want to pursue the subframe route, but subframe allows your electronics to be orders of magnitude faster (and, with advanced techniques, possibly more compact), and is a lot more intuitive to work with once you know how it works (though learning it is difficult).

     

    Here are some existing computers that you might want to try to reverse-engineer. Note that you can find all of these by searching "processor" or "computer" in TPT.

     

    Synergy's computer (29-bit, no subframe, no stacking)

     

     

    NoVIcE's computer (8-bit, no subframe, yes stacking)

     

     

    poodiepie's computer (16-bit, no subframe, no stacking)

     

     

    drakide's computer (5-bit, no subframe, no stacking, no FILT data, but I put it here because it uses a totally different design idea to keep small)

     

     

    LBPHacker's computer (29-bit, yes subframe, yes stacking)

     

     

    If you want to chat about TPT electronics, feel free to PM me, or join us on IRC (there's a wiki page for that). Though, I am strongly biased towards subframe electronics, so I might not be able to talk a lot about classical eletronics. Also, as mentioned, there aren't many tutorials around, but you can help to solve that! When you have gotten a better hold of TPT electronics, you should try to write your own tutorials too.

    Edited 4 times by mark2222. Last: 21st Jun 2018