DynaBusInterfaceImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Gasbarro August 6, 1986 4:47:03 pm PDT
Last Edited by: Gasbarro August 7, 1986 10:01:45 am PDT
DIRECTORY
BitOps, DynaBusInterface;
DynaBusInterfaceImpl: CEDAR PROGRAM
IMPORTS BitOps
EXPORTS DynaBusInterface
~ BEGIN
OPEN DynaBusInterface;
ExtractCmd:
PUBLIC PROC [q: Quad]
RETURNS [Cmd] ~ {
RETURN[LOOPHOLE[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]];
};
ExtractResult:
PUBLIC PROC [q: Quad]
RETURNS [Result] ~ {
RETURN[LOOPHOLE[BitOps.ECFQ[q, FIRST[ResultField], LAST[ResultField] - FIRST[ResultField]+1]]];
};
InsertResult:
PUBLIC PROC [q: Quad, r: Result]
RETURNS [Quad] ~ {
RETURN[BitOps.ICIQ[LOOPHOLE[r], q, FIRST[ResultField], LAST[ResultField] - FIRST[ResultField]+1]];
};
ExtractDeviceID:
PUBLIC PROC [q: Quad]
RETURNS [DeviceID] ~ {
RETURN[LOOPHOLE[BitOps.ECFQ[q, FIRST[AddressField], LAST[AddressField] - FIRST[AddressField]+1]]];
};
InsertDeviceID:
PUBLIC PROC [q: Quad, d: DeviceID]
RETURNS [Quad] ~ {
RETURN[BitOps.ICIQ[LOOPHOLE[d], q, FIRST[AddressField], LAST[AddressField] - FIRST[AddressField]+1]];
};
ExtractAddress:
PUBLIC PROC [q: Quad]
RETURNS [Address] ~ {
mask: Quad ← [0, 0ffh, 0ffffh, 0ffffh];
RETURN[BitOps.QAND[q, mask]];
};
InsertAddress:
PUBLIC PROC [q: Quad, a: Address]
RETURNS [Quad] ~ {
mask: Quad ← [0ffffh, 0ff00h, 0, 0];
RETURN[BitOps.QOR[a, BitOps.QAND[q, mask]]];
};
END.