Branch Unit

The Branch Unit is the part of the CPU which allows the program to make decisions, and also to perform jumps (changes to the PC) and procedure calls. The branch unit operates under the control of the Dispatch Unit.

Jump/Branch instructions

The simplest branch instruction is


where LABEL is an absolute address.

For example,


will jump to the instruction at address 10. As a result, the program counter is loaded with the new value, and the next instruction is the one found at that address. Note that the JMP instruction causes the instruction pipeline to be cleared, and therefore may take longer to execute than a normal instruction.

In the C programming language, the GOTO statement has approximately the same function as a JMP in assembly language or JMP machine code instruction. Hence one can write:

goto start;

Conditional jumps

An important class of instructions are the conditional jumps (or conditional branches); these are instructions where the jump may or may not take place. This corresponds to statements in a high level language like "if" , where something may or may not happen, where the flow of the program depends on some condition. The program counter contains the address of the next instruction; thus we need instructions which can load the program counter with a value, which depends on some condition.

if (a>b) {printf"a is the largest number\n");

See also:

EG2069 Home Page

Authot: Gorry Fairhurst (Email: