TI C66x DSP instruction set jump instruction B[Copy link]
Jump instructions are used to implement program flow jumps. In ARM (also in TI C66x DSP) programs, there are two ways to implement program flow jumps: -Use special jump instructions (such as B instructions). -Directly write the jump address value to the program counter PC. By writing the jump address value to the program counter PC, you can implement any jump in the 4GB address space. Before the jump, you can use MOV LR, PC and other similar instructions to save the future return address value, thereby implementing a subroutine call in the 4GB continuous linear address space. The jump instructions in the ARM instruction set can complete the jump from the current instruction to the 32MB address space forward or backward, including the following 4 instructions: - B jump instruction (TI C66x DSP instruction set also has this instruction) The format of the B instruction is: B target address; //The program jumps to the target address to execute B Label //The program unconditionally jumps to the label Label to execute The B instruction is the simplest jump instruction. Once a B instruction is encountered, the ARM processor will immediately jump to the given target address and continue execution from there, and the PC (program counter) needs to be reloaded to interrupt the execution pipeline. Note that the actual value stored in the jump instruction is an offset relative to the current PC value, not an absolute address. Its value is calculated by the assembler (refer to relative addressing in addressing mode). It is a 24-bit signed number, which is sign-extended to 32 bits after being shifted left by two bits, and represents an effective offset of 26 bits (32MB of address space before and after).