aspng: application-specific PNG
Introduction
Have you ever wanted to design a CPU with Paint? Well now you can!
aspng lets you draw out transistor-level digital circuits using pixels, and then simulate (and interact with!) those circuits.
To give you an idea of what's possible, here's a full ripple adder:
(Note: if your browser doesn't support WASM, you will see a black square here. Sorry!)
Design guide
First, your background must be entirely black (#000000). aspng ignores black pixels.
Source pixels are white (#ffffff) and drive a high voltage. Sink pixels are dark gray (#303030) and drive a low voltage.
It is an error to connect a source to a sink directly.
Bridge pixels (#79443b) allow you to cross wires without connecting them.
Transistor pixels (#ff00f2) let themselves be connected on three sides with copper, forming a T. The copper forming the cross of the T conducts if the third lead is driven high, otherwise it does not conduct.
You can create pull-ups and pull-downs using a yellow (#fff200) pixel paired with either a source or a sink. These "weak" sources and sinks drive a high or low voltage, but can be overruled by the presence of a conventional source or sink.
Finally, there are a few "template devices" such as input, switch, and LED. These must be reproduced exactly as shown or aspng will not recognize them.
Why does this exist? .. and design decisions
ASICs are crazy complicated. Every ASIC is a careful arrangement of n- and/or p-channel MOSFETs, pullups, pulldowns, clocks, latches, etc., implementing arbitrarily complicated relationships between input and output pins.
And yet, in the early days all decisions about the logic and the layout of these circuits were made by humans, and the lithography masks were drawn out by hand. Microprocessors like the Intel 4004 and the MOS 6502 were designed this way.
Today, digital ASICs are much too large and complicated to be designed by humans. Instead, hardware description languages like Verilog or VHDL are used to describe the behavior of the ASIC, and then very heavily researched computer programs figure out the exact layout of physical devices to realize the design ("logic synthesis").
aspng exists so that I can attempt to experience, and capture some of the satisfaction those early ASIC designers must have felt when their artisanal circuits worked.
At the same time, I don't have a lifetime of experience managing power consumption, switching delays, parasitic capacitances, capacitance delays, leakage, and so on that true ASIC designers must have to make a functioning circuit. I'm lazy! I just want the fun parts that make me feel smart.
For the sake of keeping "ASIC design" fun (?) and feasible for the amateur, aspng greatly simplifies all electrical properties: