![](http://datasheet.mmic.net.cn/380000/-PD98501_datasheet_16745028/-PD98501_86.png)
CHAPTER 2 V
R
4120A
86
Preliminary User’s Manual S14767EJ1V0UM00
2.3.3 ISA mode
MIPS16 ASE supports procedure calling, and returns from the MIPS16 instruction length mode or the 32-bit MIPS
instruction length mode to the MIPS16 instruction length mode or the 32-bit MIPS instruction length mode.
The JAL instruction supports calling to the same ISA.
The JALX instruction supports calling that inverses ISA.
The JALR instruction supports calling to either ISA.
The JR instruction supports also returning to either ISA.
MIPS16 ASE also supports a return operation from exception processing.
The ERET instruction, which is defined only in 32-bit instruction length mode, supports returning to ISA when
an exception has not occurred.
The ISA mode bit defines the instruction length mode to be executed. If the ISA mode bit is 0, the processor
executes only 32-bit MIPS instructions. If the ISA mode bit is 1, the processor executes only MIPS16 instructions.
2.3.3.1 Changing ISA mode bit by software
Only the JALX, JR, and JALR instructions change the ISA mode bit between the MIPS16 instruction mode and the
32-bit instruction length mode. The ISA mode bit cannot be directly overwritten by software. The JALX changes the
ISA mode bit to select another ISA mode. The JR instruction and JALR instruction load the ISA mode bit from bit 0 of
the general register that holds the target address. Bit 0 is not a part of the target address. Bit 0 of the target address
is always 0, and no address exception is generated.
Moreover, the JAL, JALR, and JALX instructions save the ISA mode bit to bit 0 of the general register that acquires
the return address. The contents of this general register are later used by the JR and JALR instruction for return and
restoration of the ISA mode.
2.3.3.2 Changing ISA mode bit by exception
Even if an exception occurs, the ISA mode changes. When an exception occurs, the ISA mode bit is cleared to 0
so that the exception is serviced with 32-bit code. Then the ISA mode status before the exception occurred is saved
to the least significant bit of the EPC register or the error EPC register. During return from an exception, the ISA
mode before the exception occurred is returned to by executing the JR or ERET instruction with the contents of this
register. Moreover, the ISA mode bit is cleared to 0 after cold reset and soft reset of the CPU core, and the 32-bit
instruction length mode returns to its initial state.
2.3.3.3 Enabling change ISA mode bit
Changing the ISA mode bit is valid only MIPS16EN is set to active when the RTCRST is selected, and the MIPS16
instruction mode is enabled. The operation of the JALX, JALR, JR, and ERET instructions in the 32-bit instruction
mode, differs depending on whether the MIPS16 instruction mode is enabled or prohibited. If the MIPS16 instruction
mode is prohibited, the JALX instruction generates a reserved instruction exception. The JR and JALR instructions
generate an address exception when bit 0 of the source register is 1. The ERET instruction generates an address
exception when bit 0 of the EPC or error EPC register is 1. If the MIPS16 instruction mode is enabled, the JALX
instruction executes JAL, and the ISA mode bit is inverted. The JR and JALR instructions load the ISA mode from bit
0 of the source register. The ERET instruction loads the ISA mode from bit 0 of the EPC or error EPC register. Bit 0
of the target address is always 0, and no address exception is generated even when bit 0 of the source register is 1.