CPU Architecture – Can a CPU Execute Fetch-Execute Cycle Without Microsequencer?

control systemcpuduty cyclestate-machines

VERY SPECIFIC QUESTION, PLEASE READ THROUGH ALL OF IT

From wikipedia:

"The sequence of operations that the control unit goes through to process an instruction is in itself like a short computer program, and indeed, in some more complex CPU designs, there is another yet smaller computer called a microsequencer, which runs a microcode program that causes all of these events to happen."

My question is: Before the microsequencer and the microcode, how did they make CPUs to physically step from one point of the sequence to another? What was going on in those CPU designs BEFORE the "more complex" ones we have today? If that "sequence of operations the control unit goes through to process an instruction is in itself a short computer program", like Wikipedia claims, then who's executing it? Answering "The CPU itself" won't help cause the CPU executes user-defined programs exploiting the fetch-execute cycle, so it can't execute the fetch-execute cycle itself too, right? I mean, this piece of hardware responsible for creating the fetch-execute cycle should still be located somewhere inside the CPU, but it's not what people refer to when they say "the CPU". It's at a lower level of abstraction, it's what's given for granted in EVERY, EVERY, EVERY resource about CPU's internal functioning (at least the non-academical ones) that I've found so far. I can't find this information anywhere.

Please don't answer "The program counter points to the memory address to fetch the next instruction from". I know that, I just don't know how this sequentiality is actually/electrically/physically implemented. I would need a more straight up electrical answer. I know what a finite state machine is and I know that at its core the CPU is one. But that still doesn't answer "how is a FSM realized in a CPU without a microsequencer?". The microsequencer should still rely on this "sequential automation device" (the thing I'm asking about) to work.

My only mental approximation of how such automated sequenciality could work is only mechanical, not electrical (it's the piano player), and I know there are no moving parts on a computer. The Jacquard loom isn't a good example here either because it was not automated, the weaver would have to manually pull the wire that made the metal drum rotate so that the machine could read the set of punched holes in the next card. I'm also not asking anything about the clock pulse nor synchronisation.

Notice that this isn't even a very technical question and as such shouldn't require a too technical answer too, as those I was given earlier. Literally, in the most intuitive sense, when you read "this machine is automatic" you wonder by which means it's automated. The same I'm asking in regards of computers. If you say "the CPU automatically steps through a sequence of always-the-same processes, a loop", I'll be tempted to ask you "How is this loop realised?". This should be a technology invented somewhere in the 50s, because that's about the time people stopped manually plugging/unplugging wires into those room-sized mainframes just to tell the machine to add stuff. As such an old technology, it suggests me it shouldn't be that complicated to understand even for me as a chemistry student. But it also should have been a very revolutionary discover, so it baffles me how I wasn't able to find it anywhere. Is it really that complicated that it's only talked about between engineers?

Thank you very much for reading!

Best Answer

Several have commented on the use of finite state machines. At the heart of a finite state machine is a register. Its contents—a number—identify the current state of the machine. The processor designer adds logic around this register. This logic considers the current state (and possibly inputs) and then creates outputs based on all the data it is considering. Among the outputs is the next state to be loaded into the state register. Other outputs are used to control such devices as an arithmetic logic unit, a memory device, and so on. The whole process is synchronized by the leading edge of the clock. When the clock strikes, the desired next state is loaded into the state register, and the cycle repeats, generally with different results since both computer instruction and data change over time.

It might take several clock cycles before a single computer instruction has been fully processed. In one architecture, the computer instruction stays in place while over multiple steps the logic examines its contents—addresses, data, etc.—and executes it. In another, the computer instruction can be passed down through a series of registers in a pipeline, like a factory assembly line. At each stage in its progression through the pipeline, additional work is done to complete the execution of the computer instruction. In either case, the finite state machine keeps on chugging along like a worker bee tending the queen bee.

The pipeline arrangement can give the impression that one instruction takes one clock cycle. This is a bit of an illusion, since multiple instructions are resident simultaneously in the several stages of the pipeline, yet one result is completed every cycle. This is analogous to Henry Ford's assembly line: there might be 100 or 200 cars in work at any moment, but one pops out every hour, giving the superficial impression that it only takes an hour to build a car.

Microcode is a variation on all this. Instead of calculating the outputs in each cycle, the logic simply looks up what those outputs should be, drawing them from a special-purpose memory that holds them. Want action A? Take the memory word that matches it and use it to supply the desired outputs. To create the memory code, jam the correct bits in the correct locations. Today the main reason microcode is out of favor is because memory is slower than logic. If that should change when some new technology emerges, you might see microcode again, since it then would be faster.

Superscalar processors use multiple pipelines in parallel, with logic used to dispatch a computer instruction to the appropriate pipeline. One—or multiple— pipelines might handle multiplication, for example, while others handle memory access. As instructions exit the pipeline, the results need to be put back together again in the appropriate sequence so that you get the right answer whether there are parallel pipelines or not.

But as one commenter said, the study of processor architecture spans many books and is deep. I support the recommendation that you get a good book. I would recommend Heuring, Vincent P., Harry Frederick Jordan, and Miles Murdocca. Computer systems design and architecture. Addison-Wesley, 1997. This is a clearly written introduction to computer architecture and gives detailed explanations of everything you're asking about.

After that try Shen, John Paul, and Mikko H. Lipasti. Modern processor design: fundamentals of superscalar processors. Waveland Press, 2013. It's not as well written, but it covers a wide range of techniques used in modern processors.

Related Topic