Flow control is the flow of program execution. The "normal program execution flow" is sequential, i.e., after executing one instruction, you execute the following one.
Branching alters the "normal program execution flow". You have learned this in CS255.
To understand how the CPU run/execute the micro-porgram, we need to understand how the micro program flow control....
Recall that a micro-program is a sequence of micro-instructions that controls the behaviour of the datapath (and thus also the CPU)
Recall also that the CPU has one single purpose: to fetch assembler instructions from memory, decode and execute them.
Therefore, the micro-program is very specific
Normally, programs are stored in the memory. But it would not be practical to store the micro-program in memory because it would be too slow to fetch micro-instructions from memory.
Fortunately, the micro program is very small (because all it does is to instruct the CPU to perform the steps in the assembler instruction execution cycle, which only consists of a few steps).
Thus, the micro-program is stored inside the CPU:
The next micro-instruction is found at address MPC + 1
give us the ability to update the MPC to
How this works:
The last 8 bits in the micro-instruction is a branch address
The mechanism to determine the next micro-instruction is very similar to how the CPU fetch the next instruction from memory:
Make a note that: computation is performed in phase 3.
In assembler programming (in CS255), you have learned to alter the flow of control by using:
We could have use the same approach in micro-programming...
Difference is: the compare and updating the MPC is performed by 1 (micro) instruction
As I have emphasized before:
Therefore, we can correctly perform a conditional branch operation in phase 4 using the values of the flags !
|Thus: the MPC can be updated in phase 4|
In assembler programming, here are the possible branches that an instruction can perform:
We want realise all these control flows in micro-programming as well.
Recall from CS255 that the way that the control flow is realised is by updating the program counter:
The following figure shows how the next micro-instruction is selected.
So every micro-instruction may contain a branch instruction.
The selection signal of the multiplexor is the output of a branch logic circuit. This branch logic circuit will output 0 if no branching is desired and will output 1 if the micro-program will branch.
I trust that you all can wire a circuitry that will perform this logic function with little problem by now...