Unformatted text preview: ed by the number of bits allocated to 18 An Introduction to Processor Design the displacement in the binary format; the assembler should report an error if the required branch is out of range. Conditional branches A Digital Signal Processing (DSP) program may execute a fixed instruction sequence for ever, but a general-purpose processor is usually required to vary its program in response to data values. Some processors (including MU0) allow the values in the general registers to control whether or not a branch is taken through instructions such as: Branch if a particular register is zero (or not zero, or negative, and so on). Branch if two specified registers are equal (or not equal). Condition code register However, the most frequently used mechanism is based on a condition code register, which is a special-purpose register within the processor. Whenever a data processing instruction is executed (or possibly only for special instructions, or instructions that specifically enable the condition code register), the condition code register records whether the result was zero, negative, overflowed, produced a carry output, and so on. The conditional branch instructions are then controlled by the state of the condition code register when they execute. Sometimes a branch is executed to call a subprogram where the instruction sequence should return to the calling sequence when the subprogram terminates. Since the subprogram may be called from many different places, a record of the calling address must be kept. There are many different ways to achieve this: The calling routine could compute a suitable return address and put it in a stand ard memory location for use by the subprogram as a return address before exe cuting the branch. The return address could be pushed onto a stack. The return address could be placed in a register. Subprogram calls are sufficiently common that most architectures include specific instructions to make them efficient. They typically require to jump furthe...
View Full Document
This document was uploaded on 10/30/2011 for the course CSE 378 380 at SUNY Buffalo.
- Spring '09