<> <> <> <> 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.