{
file name: FloatSubs.mc
created: T.Tokunaga 28-Mar-85 19:52:40
Last Edited:
}
{ *******************************denormalization code*********************
enter with floatTemp,~Q, holding the 32 bit quantity, L0 prepared for return, temp1Low holding shift count
note: Q is negatived
temp1Low is destroyed
denomalized result in floatTemp,Q , and A[15] is sticky bit
**************************************************************************}
deNormC2:
temp1Low ← - temp1Low - 1, c2;
deNormA:
temp1Low ← temp1Low + 1, NZeroBr, c3;
Ybus ← Q and 1, ZeroBr, BRANCH[deNormA1, $], c1;
floatTemp ← DRShift1 floatTemp, SE ← 0, BRANCH[deNormA, deNormB], c2;
deNormA1: { sticky bit = 0 }
Q ← ~ Q, L3Disp, CANCELBR[$], c2;
RET[deNormRets], c3;
deNormB: { sticky bit will be 1}
temp1Low ← temp1Low + 1, NZeroBr, c3;
BRANCH[deNormB1, $], c1;
floatTemp ← DRShift1 floatTemp, SE ← 0, GOTO[deNormB], c2;
deNormB1:
Q ← ~Q, L3Disp, c2;
Q ← Q or 1, RET[deNormRets], c3;
{****************** divide loop ***************************************
dividend in <floatT,Q>
divisor in <divosrHigh,divisorLow>
bit count in divCount, performs bitCount subtractions
return link = L3
will accumulate bots in divResult, <floatT, Q> will hold th remainder
************************************************************************}
fptDivideLoopC2:
Noop, c2;
fptDivideLoopC3:
divResult ← 0, GOTO[fptDivSubA], c3;
{in this part of the loop, the contents of <floatT,Q> are positive }
fptDivSub:
Noop, c2;
divResult ← LShift1 (divResult), SE ← 1, c3;
fptDivSubA:
Q ← Q - divisorLow, CarryBr, c1; { subtraction of LawHalf of fractional part }
divCount ← divCount - 1, ZeroBr, BRANCH[fptDivSub1, fptDivSub0], c2;
fptDivSub0:
floatT ← floatT - divisorHigh, CarryBr, BRANCH[$, fptDivSubExit1], c3; {subtraction of highhalf,no borrow from Lowhalf}
floatT ← DLShift1 floatT, SE ← 1, { Q.15 ← 0} BRANCH[fptDivAdd, fptDivSub], c1;
fptDivSub1:
floatT ← floatT - divisorHigh - 1, CarryBr, BRANCH[$, fptDivSubExit2], c3; {subtraction of highhalf, borrow from lowhalf}
floatT ← DLShift1 floatT, SE ← 1, {Q.15 ← 0} BRANCH[fptDivAdd, fptDivSub], c1;
fptDivSubExit1:
BRANCH[fptDivAddExit, fptDivSubExit], c1;
fptDivSubExit2:
BRANCH[fptDivAddExit, fptDivSubExit], c1;
fptDivSubExit:
divResult ← LShift1 (divResult), SE ← 1, GOTO[fptDivLoopExit], c2;
{In this part of the loop, the contents of <floatT, Q> are negative ( 2's complement)}
fptDivAdd:
Noop, c2;
divResult ← LShift1 (divResult), SE ← 0, c3;
Q ← Q + divisorLow, CarryBr, c1;
divCount ← divCount - 1, ZeroBr,BRANCH[fptDivAdd0, fptDivAdd1], c2;
fptDivAdd0:
floatT ← floatT + divisorHigh, CarryBr, BRANCH[$, fptDivAddExit1], c3;
floatT ← DLShift1 floatT, SE ← 1,{Q.15 ← 0}, BRANCH[fptDivAdd, fptDivSub], c1;
fptDivAdd1:
floatT ← floatT + divisorHigh + 1, CarryBr, BRANCH[$, fptDivAddExit2], c3;
floatT ← DLShift1 (floatT), SE ← 1, {Q.15 ← 0} BRANCH[fptDivAdd, fptDivSub], c1;
fptDivAddExit1:
BRANCH[fptDivAddExit, fptDivSubExit], c1;
fptDivAddExit2:
BRANCH[fptDivAddExit, fptDivSubExit], c1;
{We have subtracted one too many times, so add back in to ger correct remainder }
fptDivAddExit:
divResult ← LShift1 (divResult), SE ← 0, c2;
Q ← Q + divisorLow, CarryBr, c3;
BRANCH[fptDivAX0, fptDivAX1], c1;
fptDivAX1:
floatT ← floatT + divisorHigh + 1, GOTO[fptDivLoopExit], c2;
fptDivAX0:
floatT ← floatT + divisorHigh, GOTO[fptDivLoopExit], c2;
fptDivLoopExit:
L3Disp, c3;
RET[fptDivLoopRets], c1;