This analogy makes debugging an embedded system or any sort of processor system remarkably straightforward. If it isn't operating, it's because something is wrong with the fuel (power), air (code / data), or the spark (clock.) A voltmeter can quickly tell you if the power rail has the approximately correct DC voltage, and an oscilloscope will reveal transient deviations in voltage. A 'scope will also let you check your clock signal, both for frequency and electrical quality. And if you have an external address/data bus, you can watch the memory transaction directly. For an embedded system with all internal memory, your examination of the code / data may need to be more indirect. But if you get all three things, fuel (power), air (code), and spark (clock), together, and the hardware is not fundamentally broken, then the processor will run.
Sunday, August 20, 2017
"Fuel, Air, and Spark" as a processor analogy.
One EE I worked with years ago used an analogy that has stuck with me when debugging embedded systems. He said, "A processor is like a car engine, it only needs three things to run: fuel, air, and spark." The fuel is power: you need the correct voltage on all the rails. In some more complex systems, you need to carefully respect the power sequencing rules, but more generally you need the correct power. The air in this analogy is the code and data, drawn in from memory and through the engine of the processor in the unending march of the program counter. Sure, the analogy is imperfect because you loop back through and jump around within the code, but it needs to be there, or the processor never has anything to execute. And finally, the spark is the clock. In an engine, the spark triggers the combustion in the cylinders, and in a processor the clock advances the sequential logic of all the state machines that together make up the overall state machine of the processor. Without spark, the fuel-air mixture in an engine never burns. Without the clock, a processor never advances.
Labels:
Air,
Analogy,
Clock,
Code,
CPU,
Debugging,
Electrical Engineering,
Embedded Systems,
Fuel,
MCU,
Power,
Proessors,
Spark,
Squential Logic,
Technofear
Subscribe to:
Posts (Atom)