IeeeMode.mesa
Last Modified: January 14, 1984 4:55 pm
IEEE float mode control and exceptions
DIRECTORY
IeeeInternal USING [BitOn, IResultEnable, IResultSticky, MicroSticky, stickyFlags],
Real USING [ExceptionFlags, Extended, Microcode, NoExceptions],
RealOps USING [DefMode, InfinityMode, Mode, NormalizationMode, RoundingMode];
IeeeMode:
CEDAR
PROGRAM
IMPORTS IeeeInternal
EXPORTS IeeeInternal, Real, RealOps =
BEGIN
userMode: RealOps.Mode ← RealOps.DefMode;
SetStickyFlags:
PUBLIC
PROC [new: Real.ExceptionFlags ← Real.NoExceptions]
RETURNS [old: Real.ExceptionFlags] = {
IF Real.Microcode THEN MicroStickySet[];
old ← IeeeInternal.stickyFlags;
IeeeInternal.stickyFlags ← new;
};
GetStickyFlags:
PUBLIC
PROC
RETURNS [Real.ExceptionFlags] = {
IF Real.Microcode THEN MicroStickySet[]; RETURN[IeeeInternal.stickyFlags]; };
SetMode:
PUBLIC
PROC [new: RealOps.Mode]
RETURNS [old: RealOps.Mode] = {
old ← userMode; userMode ← new; MicroStickySet[]; };
GetMode: PUBLIC PROC RETURNS [RealOps.Mode] = {RETURN[userMode]; };
MicroStickySet:
PUBLIC
PROC =
TRUSTED {
IF Real.Microcode
THEN {
xx:
CARDINAL ←
IF userMode.traps[inexactResult] THEN IeeeInternal.IResultEnable ELSE 0;
xx ← IeeeInternal.MicroSticky[xx];
IF IeeeInternal.BitOn[xx, IeeeInternal.IResultSticky]
THEN
IeeeInternal.stickyFlags[inexactResult] ← TRUE;
};
};
RealException:
PUBLIC
SIGNAL [
flags: Real.ExceptionFlags, vp: REF Real.Extended]
RETURNS [clientFixup: BOOLEAN ← FALSE] = CODE;
RealError: PUBLIC ERROR = CODE;
END.
L. Stewart, July 6, 1980 4:13 PM, Microcode sticky bit stuff added.
August 25, 1980 4:42 PM, LStewart; Formatting
September 28, 1980 8:06 PM; Stewart, Deleted individual twiddle procs.
17-Nov-81 1:12:39, Stewart, userMode uninitialized
June 3, 1982 11:41 am, L. Stewart, RealException REF
August 27, 1982 1:02 pm, L. Stewart, CEDAR
January 14, 1984 4:55 pm, L. Stewart, change to IeeeInternal