DynaBusInterfaceImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Gasbarro August 6, 1986 4:47:03 pm PDT
Last Edited by: Gasbarro January 23, 1987 12:22:15 pm PST
DIRECTORY
BitOps, DynaBusInterface;
DynaBusInterfaceImpl: CEDAR PROGRAM
IMPORTS BitOps
EXPORTS DynaBusInterface
~ BEGIN
OPEN DynaBusInterface;
ExtractCmd:
PUBLIC PROC [q: Quad]
RETURNS [Cmd] ~ {
RETURN[VAL[BitOps.ECFQ[q, FIRST[CmdField], LAST[CmdField] - FIRST[CmdField]+1]]];
};
InsertCmd:
PUBLIC PROC [q: Quad, cmd: Cmd]
RETURNS [Quad] ~ {
RETURN[BitOps.ICIQ[LOOPHOLE[cmd], q, FIRST[CmdField], LAST[CmdField] - FIRST[CmdField]+1]];
};
ExtractModeError:
PUBLIC PROC [q: Quad]
RETURNS [ModeError] ~ {
RETURN[VAL[BitOps.ECFQ[q, FIRST[ModeErrorField], LAST[ModeErrorField] - FIRST[ModeErrorField]+1]]];
};
InsertModeError:
PUBLIC PROC [q: Quad, m: ModeError]
RETURNS [Quad] ~ {
RETURN[BitOps.ICIQ[LOOPHOLE[m], q, FIRST[ModeErrorField], LAST[ModeErrorField] - FIRST[ModeErrorField]+1]];
};
ExtractShared:
PUBLIC
PROC [q: Quad]
RETURNS [Shared] ~ {
RETURN[VAL[BitOps.ECFQ[q, FIRST[SharedField], LAST[SharedField] - FIRST[SharedField]+1]]];
};
InsertShared:
PUBLIC
PROC [q: Quad, s: Shared]
RETURNS [Quad] ~ {
RETURN[BitOps.ICIQ[LOOPHOLE[s], q, FIRST[SharedField], LAST[SharedField] - FIRST[SharedField]+1]];
};
ExtractDeviceID:
PUBLIC PROC [q: Quad]
RETURNS [DeviceID] ~ {
RETURN[VAL[BitOps.ECFQ[q, FIRST[DeviceIDField], LAST[DeviceIDField] - FIRST[DeviceIDField]+1]]];
};
InsertDeviceID:
PUBLIC PROC [q: Quad, d: DeviceID]
RETURNS [Quad] ~ {
RETURN[BitOps.ICIQ[VAL[d], q, FIRST[DeviceIDField], LAST[DeviceIDField] - FIRST[DeviceIDField]+1]];
};
ExtractAddress:
PUBLIC PROC [q: Quad]
RETURNS [Address] ~ {
mask: Quad ← [0, 07fffh, 0ffffh, 0ffffh];
RETURN[BitOps.QAND[q, mask]];
};
InsertAddress:
PUBLIC PROC [q: Quad, a: Address]
RETURNS [Quad] ~ {
mask: Quad ← [0ffffh, 08000h, 0, 0];
nMask: Quad ← [0, 07fffh, 0ffffh, 0ffffh];
RETURN[BitOps.QOR[BitOps.QAND[a, nMask], BitOps.QAND[q, mask]]];
};
END.