Simple Controller continued
Last Edit October 10, 1996; May 1, 1999; July 9, 2001
It is sometimes desireable to terminate a microroutine in one of
several different ways depending on one or more conditions. For
example, the conditions tested could be the various status bit outputs
of the ALU based on the result of an operation. Status outputs can
Only one condition is testable at a time. Hardware could be used to
combine a number of conditions to supply one test bit if that combination
is expected to occur frequently. A program Flow diagram for a conditional
branch is shown in Figure 2-12.
- Z=1 if ACC=0
- S=1 if ACC < 0
- Cout=1 if | ACC | > range
- OVR (overflow)=1 if error
- on the result of a compare operation
Figure 2-12 Conditional Branch Flow Diagram. "IF-THEN-ELSE"
- the conditional branch (CJP, conditional jump)
The ability to test a condition and to branch if the condition
is TRUE is provided by adding a MUX at the counter load control.
The load control filed in the microword is changed to a branch condition
select, which selects
The CCU is shown in Figure 2-13, with its microword format
shown in Figure 2-14.
- ground (count; no branch)
- condition 1 or condition 2 (load branch address into counter
- Vcc (unconditional branch, load counter).
Figure 2-13 CCU with Conditional Branch Capability
Figure 2-14 Microword Format for Conditional Branch (A) Detail
of Load Control MUX
Figure 2-14 Microword Format for Conditional Branch (B) Detail
of Microword Format
| o o o
A sample piece of microcode is shown in Figure 2-15 that
has both unconditional and conditional branches. As with most programming
languages, if a conditional test fails (FALSE), execution continues
sequentially, as shown in statements at addresses 30 and 31. The
branch condition select field is 2 bits wide in this example. A
wider field would allow a larger MUX and threrfore would allow more
conditions to be tested.
Figure 2-15 Microcode, Demonstrating Conditional Jumps