3 ms·
How do microcode changes actually work? My mental model of a CPU is hard baked logic paths.
by topbanana 7y ago
How do microcode changes actually work? My mental model of a CPU is hard baked logic paths.
- deleted 7y ago[deleted]
- edude03 7y agoI recently learned about how microcode works from this video actually https://youtu.be/Zg1NdPKoosU https://youtu.be/Zg1NdPKoosU. It might not be the state of the art anymore but is probably a good basis
- gmueckl 7y agoMy personal "Aha!" moment about this was in front of an old Zuse Z5 in a museum with a block diagram of the CPU hanging next to it. That diagram showed which bits toggled which functional unit within the CPU. The comtrol panel on the operator desk had the same bit labels on the data input buttons. This early machine had no modern instruction decoder at all. Each bit in an instruction word was used directly. This becomes wasteful when the number of functional units grows and not all bit combinations are reasonable. So the next reasonable thing to do is to introduce a lookup table from shorter coded instructions to the actual control bit patterns. The CPU in this video adds an internal step counter that allows splitting an instruction over multiple cycles with a different control word for each cycle. Modern CPUs are probably conceptually similar, but much more complex. Optimizations like pipelining and multiple ALUs make the whole decoding and checking process more complex and more dynamic.
- CriticalCathed 7y ago>Think of microcode like a firmware for your computer’s CPU. Microcode translates the instructions the CPU receives into the physical, circuit-level operations that happen inside the CPU. In other words, an updated microcode can send different instructions to the circuits inside the CPU. This can prevent certain Spectre attacks by changing the way the CPU functions. Microcode updates can also fix bugs and other errors, without requiring complete replacement of CPU hardware.
- iforgotpassword 7y agoModern CPUs are more like VMs. The actual architecture is totally different from x86 and just pretending to be x86 to the outside world. X86 instructions get translated to the native instruction set of the CPU which is more or less "secret". This makes it very easy to patch issues with the CPU through microcode, as seen in this case.
- nwallin 7y agoI would go so far as to say that modern CPUs are emulators, not even VMs. Something like 20% of the die area is devoted to instruction decoding. It's the only reason I'm interested in RISC-V or advanced arm stuff. Even there's a metric fuckton more effort going into the latest Intel x86_64 chip, there's a lot of silicon left on the table.