Basics32.mesa
For Sun-3, Sun-4, and other big-endian, 32-bit processors
Copyright Ó 1985, 1988, 1989, 1991 by Xerox Corporation. All rights reserved.
Carl Hauser, July 11, 1988 3:10:35 pm PDT
JKF August 26, 1988 11:17:35 am PDT
Willie-s, August 5, 1991 5:01 pm PDT
Doug Wyatt, August 27, 1991 1:18 pm PDT
Michael Plass, September 27, 1991 9:30 am PDT
Basic declarations and operations for 32-bit words.
DIRECTORY Basics;
Basics32: CEDAR DEFINITIONS IMPORTS Basics ~ BEGIN
Commonly-used types and values
bitsPerWord: NAT ~ BITS[WORD32]; -- = 32, of course
bytesPerWord: NAT ~ BYTES[WORD32];
charsPerWord: NAT ~ bytesPerWord;
logBitsPerWord: NAT ~ BITS[[0..bitsPerWord)];
logBytesPerWord: NAT ~ BITS[[0..bytesPerWord)];
logCharsPerWord: NAT ~ logBytesPerWord;
RawWords: TYPE ~ RECORD [PACKED SEQUENCE COMPUTED CARD OF WORD32];
Bounds checking
NonNegative: PROC [value: INT32] RETURNS [NAT31]
~ INLINE { RETURN[value] };
BoundsCheck: PROC [arg, limit: WORD32] RETURNS [WORD32]
~ INLINE { IF arg >= limit THEN Basics.RaiseBoundsFault[]; RETURN [arg] };
Logic utilities
BITAND: PROC [w1: WORD32, w2: WORD32] RETURNS [WORD32]
~ INLINE { RETURN[Basics.BITAND[w1, w2]] };
BITOR: PROC [w1: WORD32, w2: WORD32] RETURNS [WORD32]
~ INLINE { RETURN[Basics.BITOR[w1, w2]] };
BITXOR: PROC [w1: WORD32, w2: WORD32] RETURNS [WORD32]
~ INLINE { RETURN[Basics.BITXOR[w1, w2]] };
BITNOT: PROC [w: WORD32] RETURNS [WORD32]
~ INLINE { RETURN[Basics.BITNOT[w]] };
BITLSHIFT: PROC [value: WORD32, count: [0..bitsPerWord)] RETURNS [WORD32]
~ INLINE { RETURN[Basics.BITLSHIFT[value, count]] };
BITRSHIFT: PROC [value: WORD32, count: [0..bitsPerWord)] RETURNS [WORD32]
~ INLINE { RETURN[Basics.BITRSHIFT[value, count]] };
BITSHIFT: PROC [value: WORD32, count: INT] RETURNS [WORD32]
~ INLINE { RETURN[Basics.BITSHIFT[value, count]] };
Field Extraction
LowHalf: PROC [n: CARD32] RETURNS [CARD16]
~ INLINE { RETURN[Basics.LowHalf[n]] };
HighHalf: PROC [n: CARD32] RETURNS [CARD16]
~ INLINE { RETURN[Basics.HighHalf[n]] };
END.
Carl Hauser, October 13, 1986 11:23:32 am PDT
Working on conversion for Dragon .
changes to:
LongNumber reordered contained words, bytes and bits; renamed the tags and subfields
ShortNumber retyped the subfields; renamed the tags and subfields
UnsafeBlock retyped the base field.
Carl Hauser, June 11, 1987 4:10:57 pm PDT
added the Endian types and operations.
Carl Hauser, March 24, 1988 11:07:21 am PST
Removed VM parameters. Get them from the VM interface.