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.
12 thoughts on “A PNG Based Circuit Simulator”
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.
Colour seems like an easy thing to change. As for speed, oh well.
If you want real speed, use SPICE.
This isn’t a circuit simulator as Spice it’s a logic simulator.
You can simulate logic netlists with SPICE too.
There are 7400 series logic libraries available for LTspice , HCMOS & TTL families if memory serves. Check the files area of the LTspice Groups.io reflector. 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:
2. LTspice on Groups.io:
“* It’s very slow, because I prioritized code quality and readability over speed
* The code quality and readability is poor”
Quoting the part [Drone] chose to omit:
“Ew, right?! This means that Reso is software made entirely for fun! And it isn’t even a video game!”
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!
Reminds me a lot of Falling Sand/Burning Sand/Burning sand 2/The Power Toy/etc.
Very much like Piet programming language. I enjoy a good esoteric language.
Not so much a circuit simulator as a logic simulator?
Seems like it’s just manipulating the palette. I’m not sure I would declare it to be PNG based because there are lots of image formats to support palettes.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)