MCUtilsImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Last Edited by: Gasbarro November 23, 1987 3:19:46 pm PST
DIRECTORY
Basics, BitOps, MCUtils;
MCUtilsImpl: CEDAR PROGRAM
IMPORTS Basics, BitOps
EXPORTS MCUtils
~ BEGIN
ComposeIOWrite0: PUBLIC PROC [ownerFifoDelay: [0..8), enbCorr: BOOL, enbOpReflect: BOOLTRUE, selRefCk: [0..4), gntDelay, pchgDelay, refDelay, wrDelay, rdDelay: [0..32)] RETURNS [data: LONG CARDINAL] ~{
data ← 0;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[gntDelay]], 27]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[ownerFifoDelay]], 24]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[IF enbCorr THEN 1 ELSE 0]], 23]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[selRefCk]], 21]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[IF enbOpReflect THEN 1 ELSE 0]], 20]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[pchgDelay]], 15]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[refDelay]], 10]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[wrDelay]], 5]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[rdDelay]], 0]].lc;
};
ComposeIOWrite1: PUBLIC PROC [banks: [1..16], ramAddWires: [9..14], bankAdd: [0..16) ← 0, pageAdd: CARDINAL ← 0] RETURNS [data: LONG CARDINAL] ~{
pageMatch: CARDINALBasics.BITAND[Basics.BITSHIFT[0ffffh, (ramAddWires-9)*2 + BitOps.Log2[banks]], 03fffh];
IF BitOps.TwoToTheLog2[banks]#banks THEN ERROR; --no. of banks must be a power of two
IF bankAdd>banks-1 THEN ERROR;
data ← 0;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[pageMatch]], 14]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[pageAdd]], 0]].lc;
};
ComposeIOWrite2: PUBLIC PROC [banks: [1..16], ramAddWires: [9..14], bankAdd: [0..16) ← 0] RETURNS [data: LONG CARDINAL] ~{
lowAdd: CARDINAL ← BitOps.Log2[banks];
highAdd: CARDINAL ← ramAddWires - 9 + BitOps.Log2[banks];
bankMask: CARDINALBasics.BITAND[Basics.BITNOT[Basics.BITSHIFT[0fh, BitOps.Log2[banks]]], 0fh];
IF BitOps.TwoToTheLog2[banks]#banks THEN ERROR; --no. of banks must be a power of two
IF bankAdd>banks-1 THEN ERROR;
data ← 0;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[lowAdd]], 12]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[highAdd]], 8]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[bankMask]], 4]].lc;
data ← Basics.DoubleOr[[lc[data]], Basics.DoubleShiftLeft[[lc[bankAdd]], 0]].lc;
};
END.