35.3.1.3. INTEGER ARITHMETICAL ON HP-PA
ADD,cond r1,r2,t ADDL,cond r1,r2,t
+---------------------------+
| Len Value |
| 6 02 | 02
| 5 r2 | r2
| 5 r1 | r1
| 3 c | c
| 1 f | f
| 6 xx | 28
| 1 0 | 0
| 5 t | t
+---------------------------+
Command xx
ADD,cond r1,r2,t 18 Add, set C/B flag
ADDL,cond r1,r2,t 28 Add, not set C/B flag
ADDO,cond r1,r2,t 38 Add, set C/B flag, trap on overflow
ADDC,cond r1,r2,t 1C Add with carry, set C/B
ADDCO,cond r1,r2,t 3C Add w/carry, set C/B, trap on overflow
GR[t] <- GR[r1] + GR[r2];
PSW[C/B] <- carry_borrow; (set C/B flag only)
if (cond_satisfied) PSW[N] <- 1
Command xx
SH1ADD,cond r1,r2,t 19 Shift one and Add, set C/B
SH1ADDL,cond r1,r2,t 29 Shift one and Add, not set C/B
SH1ADDO,cond r1,r2,t 39 Shift one and Add, set C/B, trap on OVF
SH2ADD,cond r1,r2,t 1A Shift two and Add, set C/B
SH2ADDL,cond r1,r2,t 2A Shift two and Add, not set C/B
SH2ADDO,cond r1,r2,t 3A Shift two and Add, set C/B, trap on OVF
SH3ADD,cond r1,r2,t 1B Shift 3 and Add, set C/B
SH3ADDL,cond r1,r2,t 2B Shift 3 and Add, not set C/B
SH3ADDO,cond r1,r2,t 3B Shift 3 and Add, set C/B, trap on OVF
GR[t] <- lshift(GR[r1],shift_val) + GR[r2]
if (Overflow)
{
Overflow flag)
} else {
PSW[C/B] <- carry_borrow; (set C/B flag only)
if (cond_satisfied) PSW[N] <- 1
}
Command xx
SUB,cond r1,r2,t 10 Subtract, set C/B
SUBO,cond r1,r2,t 30 Subtract, set C/B, trap on OVF
SUBB,cond r1,r2,t 14 Subtract with borrow, set C/B
SUBBO,cond r1,r2,t 34 Subtract with borrow, set C/B,
trap on Overflow
SUBT,cond r1,r2,t 13 Subtract and trap on condition
SUBTO,cond r1,r2,t 33 Subtract and trap on condition or
overflow
GR[t] <- GR[r1] + ~GR[r2] + 1;
PSW[C/B] <- carry_borrow; (set C/B flag only)
if (cond_satisfied) PSW[N] <- 1
DS,cond r1,r2,t 11 Divide Step
(Primitive Operation for Integer
Diision)
if (PSW[V])
{
GR[t] <- cat(GR[r1]<<1, PSW[C/B]{0}) + ~GR[r2] + 1;
} else
GR[t] <- cat(GR[r1]<<1, PSW[C/B]{0}) + GR[r2];
}
PSW[C/B] <- carry_borrow
PSW[V] <- xor(carry_borrows{0},GR[r2]{0});
if (cond_satisfied) PSW[N] <- 1;
+---------------------------+
| Len Value |
| 6 zz |
| 5 r |
| 5 t |
| 3 c |
| 1 f |
| 1 z |
| 11 im11 |
+---------------------------+
zz.z
ADDI,cond i,r,t 2D.0 Add Immediate
ADDIO,cond i,r,t 2D.1 Add Immediate and Trap on Overflow
ADDIT,cond i,r,t 2C.0 Add Immediate and Trap on Condition
ADDITO,cond i,r,t 2C.1 Add Immediate and Trap on Condition
or overflow
SUBI,cond i,r,t 25.0 Sub Immediate
SUBIO,cond i,r,t 25.1
OTHER INSTRUCTION IMPLEMENTATION
Multiply is Superpositions of Add and shifts
Division is used special instruction DS (Divide Step)
// ----------------------------------------------------------------------
Index Prev Next