NEC V20 Microcode Extracted from Die Photos with a CNN
MartyPC's author decodes the NEC V20's microcode from 5.6-gigapixel die photography, using a convolutional neural network to classify 29,928 ROM bits—a milestone for cycle-accurate emulation of the V20 CPU.

In 2020, reenigne's disassembly of the 8088 microcode opened the door to extremely accurate emulation of Intel's foundational CPU. Now, the same approach is being applied to the NEC V20—a faster, 8088-compatible chip that powered many clones and even the original IBM PC's successor. MartyPC's author, who had previously emulated the V20 as an 8088 with extra instructions, wanted true cycle accuracy. That required the V20's microcode, which NEC never documented.
To get it, the author commissioned InfoSecDJ to photograph the V20 die (a Sharp second-source version). The resulting photomosaic is a staggering 5.6 gigapixels—70,478 × 80,672 pixels—too large for the JPEG format. The main microcode ROM appears as a rectangular block just below the die's center. The ROM array is 258 × 116, containing 29,928 bits—evenly divisible by 29, the V20's microcode word length, implying 1,032 words instead of the expected 1,024. That discrepancy remains to be explained.
Reading the bits by eye would be tedious, so the author turned to MaskRomTool to define bit positions. However, its threshold-based detection failed due to insufficient contrast between bits and non-bits, caused by the bright metal layer. The tool could still export bit positions to JSON, which the author used to write a Python script that extracted 42×42 pixel PNGs for each bit—a 105MB ZIP of tiny images.
The plan was to train a convolutional neural network (CNN) to classify each image as 0 or 1. The author had no prior CNN experience but completed the task in an afternoon using PyTorch. After manually classifying about 1,000 bits with a quick tkinter tool, they trained a CNN that achieved 99.56% validation accuracy and an F1 score of 0.9891 in just ten epochs—a few minutes on a CUDA GPU. The model's confidence scores flagged ambiguous bits for manual review.
This work is a testament to how accessible deep learning has become. It also highlights the value of die photography for reverse engineering legacy hardware. The extracted microcode will enable cycle-accurate V20 emulation in MartyPC, benefiting retrocomputing enthusiasts and researchers alike.
We just have to sort images into two buckets, 0s or 1s. The problem is quite literally 'Hotdog or Not Hot Dog.'
Discussion
0 Comments
Be the first to start the discussion.