DDSim Devlog
I’m building a chip simulator from scratch. Today I got it to simulate a MOS capacitor, a silicon slab with a thin glass layer and a metal plate on top. It’s the heart of every transistor ever made.
What I built:
I stacked two grids together: a fine one near the silicon surface where all the action is, and a coarse one for the glass where nothing happens. Then I wrote one function that builds the whole sandwich.
I wrote every test before the code. This kind of maths loves to give you wrong answers that look perfectly reasonable, so I only trust it when it matches something I can work out on paper.
I’m happy that the “flatband” voltage came out exact to 15 decimal places. The threshold voltage matched the textbook to 0.13 millivolts, 50 times better than I needed.
I also identified a few problems; the solver was getting slower and slower at high voltage, then giving up. The starting guess was asking “what makes glass electrically neutral?”, a meaningless question, since glass has no charges. I gave it a proper answer instead and the slowdown vanished completely.
Then I deliberately broke my own code ten ways to check the tests would catch it. Nine got caught. One didn’t. Chasing that turned up a real bug: the bottom-contact voltage setting was silently doing nothing. One line to fix.
Current Position: 1339 tests passing, everything clean, C-V curve working across all three regimes.