P32A 001000 |
rt |
rs |
rd |
x |
1010010 |
101 |
6 |
5 |
5 |
5 |
1 |
7 |
3 |
MODSUB rd, rs, rt |
DSP |
Modular Subtraction on an Index Value |
Modular Subtraction on an Index Value
Do a modular subtraction on a specified index value, using the specified decrement and modular roll-around values.
rd = (GPR[rs]==0 ? zero_extend(GPR[rt]23..8) : GPR[rs] - GPR[rt]7..0)
The 32-bit value in register rs is compared to the value zero. If it is zero, then the index value has reached the bottom of the buffer and must be rolled back around to the top of the buffer. The index value of the top element of the buffer is obtained from bits 8 through 23 in register rt; this value is zero-extended to 32 bits and written to destination register rd.
If the value of register rs is not zero, then it is simply decremented by the size of the elements in the buffer. The size of the elements, in bytes, is specified by bits 0 through 7 of register rt, interpreted as an unsigned integer.
This instruction does not modify the ouflag field in the DSPControl register.
No data-dependent exceptions are possible.
The operands must be values in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.
ValidateAccessToDSPResources() decr7..0 = GPR[rt]7..0 lastindex15..0 = GPR[rt]23..8 if ( GPR[rs]31..0 = 0x00000000 ) then GPR[rd]31..0 = 0(GPRLEN-16) || lastindex15..0 else GPR[rd]31..0 = GPR[rs]31..0 - decr7..0 endif
Reserved Instruction, DSP Disabled