Fresh block (low P/E) Worn block (high P/E) Free / erased

Flash Wear-Leveling Ring & Wear-Inequality Index (2D)

This 2D companion to the 3D flash-storage simulator arranges a small NAND block array around an erase ring and streams a live mix of hot (constantly overwritten) and cold (write-once) data into it while the flash controller's garbage collector runs in real time — the same independently-coded FTL mechanics as the 3D version, so results are directly comparable. What's new here is a quantitative wear-inequality readout: a genuine Gini coefficient computed every frame from the ring's erase-count distribution, plotted alongside a live histogram of how many blocks sit at each P/E-cycle level. Toggle static wear leveling on and off to watch the histogram collapse into a single tight band (Gini near 0) versus spreading into a long tail of red, near-dead blocks sitting beside untouched blue ones (Gini climbing toward 1) — a direct numerical view of why relying on garbage collection alone shortens a real device's life even when it "isn't full."