A PNG Based Circuit Simulator

We’re sure thousands of hours have been spent in Minecraft implementing digital logic. Inspired by that, [lynnpepin] created a digital logic simulator named Reso that is based on pixels rather than voxels.

There are a few clever things here. First, different colors represent different parts. There are three different colors of wire, output and input wires, XOR gates, and AND gates. OR gates are just output wires, which or all the input wires together. By implementing these gates, Reso is, by definition, Turing complete. Since it’s just a PNG, it is trivial to open it up in GIMP and copy and paste one bit of the circuit multiple times. The different color wires are mainly to help route in a 2d plane, as you don’t have vias. Currently, the image compiles into a graph that is executed. [Lynn] chose code readability and ease of prototyping over premature optimization, so the code isn’t particularly fast. But it is pretty fun, squinting at the pixels that make up the adders and clocks he has on his blog. After giving Reso your image, it outputs a series of images that enumerate the state for several states.

The code is available on Github, and a Rust version has already been written that offers some impressive speed improvements at the expense of not being at feature parity yet. If MS-Paint isn’t your IDE of choice, perhaps a more Javascript-based digital logic simulator might be more to your taste.

12 thoughts on “A PNG Based Circuit Simulator

  1. Well, at least [Lynn Pepin] is honest and forthcoming. Quoting…

    Reso is bad because:

    * It’s inaccessible to those who are blind
    * It’s inaccessible to those who are colorblind
    * It’s inaccessible to those who have full color vision, because I foolishly chose colors for elements that are way too similar on most monitors. (Lime and teal).
    * It’s very slow, because I prioritized code quality and readability over speed
    * It’s very slow, because I used Python
    * The code quality and readability is poor
    * It is not interactive, unlike actually useful digital logic design software.

    Pffft, color me stoked.

        1. There are 7400 series logic libraries available for LTspice [1], HCMOS & TTL families if memory serves. Check the files area of the LTspice Groups.io reflector.[2] Install/use instructions are included.

          1. LTspice is a free full featured SPICE electronic circuit simulation program. LTspice is Windows native but it works fine under Wine in Linux. Download LTspice here:

          http://www.analog.com/LTspice

          2. LTspice on Groups.io:

          https://groups.io/g/LTspice

    1. I bet she also hates brainfuck because it is impractical as a production programming language. And she thinks it is dumb that someone built a ws2812 driver with 555 timers because it is difficult to configure and produces unpredictable output. Cool projects don’t necessarily have to be 100% practical, and I’d argue many are better for it!

Leave a Reply to L Cancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.