DPRosemary.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Gasbarro June 12, 1987 4:50:09 pm PDT
Barth, June 12, 1987 5:49:33 pm PDT
Last Edited by: Gasbarro September 24, 1987 12:25:19 pm PDT
DIRECTORY Ports, Rope, Rosemary;
DPRosemary:
CEDAR
PROGRAM
IMPORTS Ports, Rosemary
= BEGIN
DPEdgeFF
DPEdgeFFName: Rope.
ROPE = Rosemary.Register[roseClassName: "DP.DPEdgeFF.schSeq", init: DPEdgeFFSeqInit, evalSimple: DPEdgeFFSeqSimple];
DPEdgeFFSeqState: TYPE = REF DPEdgeFFSeqStateRec;
DPEdgeFFSeqStateRec:
TYPE =
RECORD [
in, out, ck: Ports.Port ← NIL,
prevCK: Ports.Level,
master, slave: Ports.LevelSequence];
DPEdgeFFSeqInit: Rosemary.InitProc = {
state: DPEdgeFFSeqState;
IF oldStateAny=
NIL
THEN {
size: NAT ← p[Ports.PortIndex[cellType.public, "D"]].ls.size;
state ← NEW[DPEdgeFFSeqStateRec];
state.master ← NEW[Ports.LevelSequenceRec[size]];
state.slave ← NEW[Ports.LevelSequenceRec[size]];
} ELSE state ← NARROW[oldStateAny];
state.ck ← p[Ports.PortIndex[cellType.public, "CK"]];
state.in ← p[Ports.PortIndex[cellType.public, "D"]];
state.out ← p[Ports.PortIndex[cellType.public, "Q"]];
state.out.d ← drive;
state.prevCK ← X;
Ports.SetLS[state.master, X];
Ports.SetLS[state.slave, X];
Ports.SetLS[state.out.ls, X];
stateAny ← state;
};
DPEdgeFFSeqSimple: Rosemary.EvalProc = {
state: DPEdgeFFSeqState ← NARROW[stateAny];
IF ~clockEval THEN {IF state.ck.l=L THEN Ports.CopyLS[from: state.in.ls, to: state.master]
ELSE IF (state.prevCK=L AND state.ck.l=H) THEN Ports.CopyLS[from: state.master, to: state.slave]};
Ports.CopyLS[from: state.slave, to: state.out.ls];
state.prevCK ← state.ck.l;
};
DPTSLatch
DPTSLatchName: Rope.
ROPE = Rosemary.Register[roseClassName: "DP.DPTSLatch.schSeq", init: DPTSLatchSeqInit, evalSimple: DPTSLatchSeqSimple];
DPTSLatchSeqState: TYPE = REF DPTSLatchSeqStateRec;
DPTSLatchSeqStateRec:
TYPE =
RECORD [
in, out, ck, en, dis: Ports.Port ← NIL,
prevCK: Ports.Level,
slave: Ports.LevelSequence
];
DPTSLatchSeqInit: Rosemary.InitProc = {
state: DPTSLatchSeqState;
IF oldStateAny=
NIL
THEN {
size: NAT ← p[Ports.PortIndex[cellType.public, "D"]].ls.size;
state ← NEW[DPTSLatchSeqStateRec];
state.slave ← NEW[Ports.LevelSequenceRec[size]];
} ELSE state ← NARROW[oldStateAny];
state.ck ← p[Ports.PortIndex[cellType.public, "CK"]];
state.in ← p[Ports.PortIndex[cellType.public, "D"]];
state.out ← p[Ports.PortIndex[cellType.public, "Q"]];
state.en ← p[Ports.PortIndex[cellType.public, "en"]];
state.dis ← p[Ports.PortIndex[cellType.public, "dis"]];
state.out.d ← drive;
state.prevCK ← X;
Ports.SetLS[state.out.ls, X];
Ports.SetLS[state.slave, X];
stateAny ← state;
};
DPTSLatchSeqSimple: Rosemary.EvalProc = {
state: DPTSLatchSeqState ← NARROW[stateAny];
-- ***gross hack: make it look edge triggered so Rosemary works...
IF state.ck.l=H THEN Ports.CopyLS[from: state.in.ls, to: state.slave];
IF ~clockEval THEN {IF (state.prevCK=L AND state.ck.l=H) THEN Ports.CopyLS[from: state.in.ls, to: state.slave]};
IF state.en.l=H
AND state.dis.l=L
THEN {
state.out.d ← drive;
Ports.CopyLS[from: state.slave, to: state.out.ls];
} ELSE state.out.d ← none;
state.prevCK ← state.ck.l;
};
DPNOr3
DPNOr3Name: Rope.
ROPE = Rosemary.Register[roseClassName: "DP.DPNOr3.schSeq", init: DPNOr3SeqInit, evalSimple: DPNOr3SeqSimple];
DPNOr3SeqState: TYPE = REF DPNOr3SeqStateRec;
DPNOr3SeqStateRec:
TYPE =
RECORD [
in0, in1, in2, out: Ports.Port];
DPNOr3SeqInit: Rosemary.InitProc = {
state: DPNOr3SeqState ← IF oldStateAny=NIL THEN NEW[DPNOr3SeqStateRec] ELSE NARROW[oldStateAny];
state.in0 ← p[Ports.PortIndex[cellType.public, "in0"]];
state.in1 ← p[Ports.PortIndex[cellType.public, "in1"]];
state.in2 ← p[Ports.PortIndex[cellType.public, "in2"]];
state.out ← p[Ports.PortIndex[cellType.public, "out0"]];
state.out.d ← drive;
stateAny ← state;
};
DPNOr3SeqSimple: Rosemary.EvalProc = {
state: DPNOr3SeqState ← NARROW[stateAny];
FOR index:
NAT
IN [0..state.in0.ls.size)
DO
state.out.ls[index] ←
SELECT
TRUE
FROM
state.in0.ls[index]=H OR state.in1.ls[index]=H OR state.in2.ls[index]=H => L,
state.in0.ls[index]=X OR state.in1.ls[index]=X OR state.in2.ls[index]=X => X,
ENDCASE => H;
ENDLOOP;
};
DPXOr, DPXOrTop, DPXOrBot
DPXOrName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPXOr.schSeq", init: DPXOrSeqInit, evalSimple: DPXOrSeqSimple];
DPXOrTopName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPXOrTop.schSeq", init: DPXOrSeqInit, evalSimple: DPXOrSeqSimple];
DPXOrBotName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPXOrBot.schSeq", init: DPXOrSeqInit, evalSimple: DPXOrSeqSimple];
DPXOrSeqState: TYPE = REF DPXOrSeqStateRec;
DPXOrSeqStateRec:
TYPE =
RECORD [
in0, in1, out: Ports.Port];
DPXOrSeqInit: Rosemary.InitProc = {
state: DPXOrSeqState ← IF oldStateAny=NIL THEN NEW[DPXOrSeqStateRec] ELSE NARROW[oldStateAny];
state.in0 ← p[Ports.PortIndex[cellType.public, "in0"]];
state.in1 ← p[Ports.PortIndex[cellType.public, "in1"]];
state.out ← p[Ports.PortIndex[cellType.public, "out0"]];
state.out.d ← drive;
stateAny ← state;
};
DPXOrSeqSimple: Rosemary.EvalProc = {
state: DPXOrSeqState ← NARROW[stateAny];
FOR index:
NAT
IN [0..state.in0.ls.size)
DO
state.out.ls[index] ←
SELECT
TRUE
FROM
state.in0.ls[index]=X OR state.in1.ls[index]=X => X,
state.in0.ls[index] = state.in1.ls[index] => L,
ENDCASE => H;
ENDLOOP;
};
DPInv, DPInvDr
DPInvName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPInv.schSeq", init: DPInvSeqInit, evalSimple: DPInvSeqSimple];
DPInvDrName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPInvDr.schSeq", init: DPInvSeqInit, evalSimple: DPInvSeqSimple];
DPInvSeqState: TYPE = REF DPInvSeqStateRec;
DPInvSeqStateRec:
TYPE =
RECORD [
DPInvSeqInit: Rosemary.InitProc = {
state: DPInvSeqState ← IF oldStateAny=NIL THEN NEW[DPInvSeqStateRec] ELSE NARROW[oldStateAny];
state.in ← p[Ports.PortIndex[cellType.public, "in0"]];
state.out ← p[Ports.PortIndex[cellType.public, "out0"]];
state.out.d ← drive;
stateAny ← state;
};
DPInvSeqSimple: Rosemary.EvalProc = {
state: DPInvSeqState ← NARROW[stateAny];
Ports.NotLS[state.in.ls, state.out.ls];
};
DPTriDrInv, DPSCTriInv
DPTriDrInvName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPTriDrInv.schSeq", init: DPTriDrSeqInit, evalSimple: DPTriDrSeqSimple];
DPSCTriInvName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPSCTriInv.schSeq", init: DPTriDrSeqInit, evalSimple: DPTriDrSeqSimple];
DPTriDrSeqState: TYPE = REF DPTriDrSeqStateRec;
DPTriDrSeqStateRec:
TYPE =
RECORD [
in, out, en, dis: Ports.Port];
DPTriDrSeqInit: Rosemary.InitProc = {
state: DPTriDrSeqState ← IF oldStateAny=NIL THEN NEW[DPTriDrSeqStateRec] ELSE NARROW[oldStateAny];
state.in ← p[Ports.PortIndex[cellType.public, "in"]];
state.out ← p[Ports.PortIndex[cellType.public, "out"]];
state.en ← p[Ports.PortIndex[cellType.public, "en"]];
state.dis ← p[Ports.PortIndex[cellType.public, "dis"]];
state.out.d ← drive;
stateAny ← state;
};
DPTriDrSeqSimple: Rosemary.EvalProc = {
state: DPTriDrSeqState ← NARROW[stateAny];
Ports.NotLS[state.in.ls, state.out.ls];
state.out.d ← IF state.en.l=H AND state.dis.l=L THEN drive ELSE none;
};
DPBuf, DPSCBuf
DPBufName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPBuf.schSeq", init: DPBufSeqInit, evalSimple: DPBufSeqSimple];
DPSCBufName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPSCBuf.schSeq", init: DPBufSeqInit, evalSimple: DPBufSeqSimple];
DPBufSeqState: TYPE = REF DPBufSeqStateRec;
DPBufSeqStateRec:
TYPE =
RECORD [
DPBufSeqInit: Rosemary.InitProc = {
state: DPBufSeqState ← IF oldStateAny=NIL THEN NEW[DPBufSeqStateRec] ELSE NARROW[oldStateAny];
state.in ← p[Ports.PortIndex[cellType.public, "in0"]];
state.out ← p[Ports.PortIndex[cellType.public, "out0"]];
state.out.d ← drive;
stateAny ← state;
};
DPBufSeqSimple: Rosemary.EvalProc = {
state: DPBufSeqState ← NARROW[stateAny];
Ports.CopyLS[state.in.ls, state.out.ls];
};
DPMuxSwitch
DPMuxSwitchName: Rope.ROPE = Rosemary.Register[roseClassName: "DP.DPMuxSwitch.schSeq", init: DPMuxSwitchSeqInit, evalSimple: DPMuxSwitchSeqSimple];
DPMuxSwitchSeqState: TYPE = REF DPMuxSwitchSeqStateRec;
DPMuxSwitchSeqStateRec:
TYPE =
RECORD [
in, out, enb: Ports.Port];
DPMuxSwitchSeqInit: Rosemary.InitProc = {
state: DPMuxSwitchSeqState ← IF oldStateAny=NIL THEN NEW[DPMuxSwitchSeqStateRec] ELSE NARROW[oldStateAny];
state.in ← p[Ports.PortIndex[cellType.public, "ch1"]];
state.out ← p[Ports.PortIndex[cellType.public, "ch2"]];
state.enb ← p[Ports.PortIndex[cellType.public, "gate"]];
state.out.d ← drive;
stateAny ← state;
};
DPMuxSwitchSeqSimple: Rosemary.EvalProc = {
state: DPMuxSwitchSeqState ← NARROW[stateAny];
Ports.CopyLS[state.in.ls, state.out.ls];
state.out.d ← IF state.enb.l=H THEN drive ELSE none;
};
END.