Advanced computer concepts for the (not so) common Chef
So far, we’ve talked about the components of a computer system, e.g. the core, memory hierarchy, and program. Let’s now get into the guts (sic) of the core itself, also called the micro-architecture or as I write it, the uArchitecture. Recall that the core is equivalent to a Chef working in his kitchen. (See Not So Common Chef: The Home Kitchen.) So what we’re doing here is looking more closely at how the Chef uses his kitchen (i.e. the components of a computer system) to go through the steps of a recipe.
The most important part of the uArchecture is the pipeline. OK, I agree that there are many other components to the CPU, all of which are fundamental to the operation of the processor. Those components, though vital, play supporting roles to the pipeline. The pipeline is perhaps the heart and soul of the computer as it does the actual execution of instructions, and so, of programs. The pipeline is something that is fundamental to computer processing and has existed arguably since the 1950s, and some would say dates from the 2nd commercially available computer, the UNIVAC I.
A CPU has to do some basic things to execute a program. It has to fetch that instruction from memory (IF – Instruction Fetch), read the instruction (ID – Instruction Decode), get the data the instruction needs (MEM – Memory access), perform the operation specified by the instruction (EX – Execute), and store the result (WB – Write Back). See Figure PHYSICAL for a rough functional layout of a pipeline. For the uninitiated, these are all acronyms and words that are obscure in their meaning. As I will show below, these steps map to how a chef performs one step in a recipe: he reads the step, gathers the ingredients, performs the recipe step, and then puts aside what the step produced in preparation for the next step.
Figure PHYSICAL Pipeline circuitry rough functional layout
Before we get more into the CPU pipeline, let’s look at our chef as he once again delves into the art of creation. Instead of looking at everything the chef does, let’s narrow in on just one step of a recipe. We are not looking at the creative processes of our epicure, just the mechanics.
Gazing down from on high into the kitchen, we look at the Chef when he is in the middle of preparing one of his amazing appetizers. Pulling the cookbook closer, he identifies the next step in the recipe, say, step 3. Finding the step, he reads it carefully, noting in particular, (1) what he needs to use from the previous steps, (2) any new ingredients, (3) what he needs to do with those ingredients, and (4) what he needs to do with the result.
It turns out that almost everything done by the Chef has an analogy in how the processor performs one instruction. See Table EQUIVALENCE. This is because the Chef, like the uArchitecture pipeline, is the one who actually follows the recipe, doing each step in order.
Done by the CPU/microcode
Done by the Chef
Instruction Fetch (IF)
Get the program’s instruction from memory
Find and read the next step in the recipe
Instruction Decode (ID)
The computer’s pipeline circuitry decodes the instruction into a series of electrical signals that will execute the instruction
Understand* the recipe step
Memory access (MEM)
Get the data from memory that the instruction needs to operate on
Gather the ingredients needed for the step
Perform the instruction on the data (e.g. ADD)
Do what the recipe step says
Write Back (WB)
Save the result of the operation in the memory hierarchy. If the result isn’t needed soon, write it back to actual memory.
Put the result to the side so that you can perform the next step in the recipe; if the result isn’t needed immediately, put it back (write back) into the Pantry or refrigerator until it’s needed.
TABLE EQUIVALENCE. Pipeline stages and the cooking equivalent
NEXT: Pipeline parallelism
*Yes, indeed. Reading is different from understanding. As an engineer, I can read a section from one of the great existentialist Chefs, but understanding it is a totally different cup of tea.