Subv - Hitachi SH7750 Programming Manual

High-performance risc engine superh (sh) 32-bit risc mcu/mpu series
Hide thumbs Also See for SH7750:
Table of Contents

Advertisement

10.97

SUBV

Binary Subtraction
with Underflow Check
Format
Summary of Operation
Rn-Rm → Rn, underflow → T
SUBV Rm,Rn
Description
This instruction subtracts the contents of general register Rm from the contents of general register
Rn, and stores the result in Rn. If underflow occurs, the T bit is set.
Operation
SUBV(long m, long n) /* SUBV Rm,Rn */
{
long dest,src,ans;
if ((long)R[n]>=0) dest=0;
else dest=1;
if ((long)R[m]>=0) src=0;
else src=1;
src+=dest;
R[n]-=R[m];
if ((long)R[n]>=0) ans=0;
else ans=1;
ans+=dest;
if (src==1) {
if (ans==1) T=1;
else T=0;
}
else T=0;
PC+=2;
}
SUBtract with (V flag)
underflow check
Arithmetic Instruction
Instruction Code
0011nnnnmmmm1011 1
Rev. 2.0, 03/99, page 379 of 396
Execution
States
T Bit
Underflow

Advertisement

Table of Contents
loading

Table of Contents