Q. Describe Program Control Instructions?
These instructions specify conditions for altering the sequence of program execution or we can say in other words that the content of PC (program counter) register. PC points to memory location which holds the subsequent instruction to be executed. The alteration in value of PC as a result of execution of control instruction such as BRANCH or JUMP causes a break in sequential execution of instructions. The most common control instructions are as following:
JUMP and BRANCH may be unconditional or conditional. JUMP is an unconditional branch used to implement simple loops. JNE jump not equal is conditional branch instruction. The conditional branch instructions like BRP X and BRN X causes a branch to memory location X if the result of most recent operation is positive or negative correspondingly. If the condition is true PC is loaded with branch address X and next instruction is taken from X otherwise PC is not changed and the subsequent instruction is taken from location pointed by PC. Figure below displays an unconditional branch instruction and a conditional branch instruction if content of AC is zero.
MBR←0; Assign 0 to MBR register
X←2001; Assume X to be an address location 2001
READ X; Read a value from memory location 2001 into AC
BRZ 1007; Branch to location 1007 if AC is zero (Conditional branch on zero)
ADD MBR; add the content of MBR to AC and store result to AC
TRAS MBR; Transfer the contents of AC to MBR
INC X; Increment X to point to next location
JUMP 1001;Loop back for further processing.