Analysis scientist Nicholas Carlini has celebrated the delivery of the microprocessor with a gate-level emulation of Intel’s basic 4004 chip — distributed, for good measure, as 4004 bytes of obfuscated C code.
“The Worldwide Obfuscated C Code Contest outcomes had been introduced this final weekend, and I used to be thrilled to see that my entry was among the many winners,” Carlini writes. “[It’s] a feature-complete gate-level emulator for the Intel 4004 that is able to emulating the unique Busicom 141-PF calculator ROM — the appliance for which the 4004 was initially designed.”
It would appear to be a corrupt supply file, however that is in reality a gate-level simulation of Intel’s 4004 microprocessor. (📷: Nicholas Carlini)
Intel’s 4004 was launched again in 1971, and is usually acknowledged as the primary commercially-successful microprocessor constructed utilizing large-scale integration (LSI) — although its success got here outdoors the undertaking for which it was designed, a printing calculator from Busicom. Whereas a four-bit design, it will lay the groundwork for what would turn into the x86 structure and Intel’s rise to one of many greatest names in computing.
Carlini’s recreation works as a simulation on the stage of particular person gates — able to operating, he says, at a couple of a whole bunch of directions per second on trendy {hardware} or sufficient to finish a calculation in round three to 10 minutes, “which is definitely quick sufficient to be usable, simply so long as you are not in a rush.” The way it’s made, although, is the fascinating half: the emulation comes courtesy of a design written in miniHDL, a Python-based domain-specific language (DSL), which is then compressed down right into a 4004-byte C program of seeming gibberish intentionally designed to cover its supposed function to function an entry to the IOCCC.
Squeezing the simulation into simply 4004 bytes required some trickery, together with the implementation of customized compression for the circuit itself. (📷: Nicholas Carlini)
“If one had been to rank applications by human-hours-per-byte, this program could be actually high the rating for the all of the code I’ve ever written,” Carlini guesses. “I did not maintain good observe of this, however I would estimate I spent most likely a couple of hundred hours during the last 4 years engaged on it. (Actually I felt type of empty after submitting the code again in June. I have been engaged on this since virtually the beginning of the pandemic, and at any time when I felt like I needed to take a break from my massive (principally Python) precise work this was the right place to return and fiddle with the bytes of a program that matches comfortably on a single piece of paper.)”
The undertaking is documented intimately on Carlini’s web site; the supply code is on the market on GitHub underneath the reciprocal GNU Normal Public License 3.
Important article picture courtesy of Thomas Nguyen, CC-BY-SA 4.0 Worldwide.