XilinxPrimitives.mesa
Copyright Ó 1986, 1987 by Xerox Corporation. All rights reserved.
DIRECTORY Core, CoreClasses, CoreOps, LogicUtils, Ports, Rope, Rosemary;
XilinxPrimitives: CEDAR PROGRAM
IMPORTS CoreClasses, CoreOps, LogicUtils, Ports
= BEGIN OPEN LogicUtils;
XilinxFlipFlopRoseClass: Rope.ROPE = RoseClass["XilinxFlipFlop", XilinxFFInit, XilinxFFSimple, TRUE];
XilinxFlipFlop: PUBLIC PROC RETURNS [ct: Core.CellType] = {
name: Rope.ROPE = "DFF";
ct ← CacheFetch[name];
IF ct#NIL THEN RETURN[ct];
ct ← CoreClasses.CreateUnspecified[CoreOps.CreateWire[LIST[
CoreOps.CreateWire[name: "D"],
CoreOps.CreateWire[name: "Q"],
CoreOps.CreateWire[name: "CK"],
CoreOps.CreateWire[name: "ar"],
CoreOps.CreateWire[name: "ap"]]], name];
SimulateGate[ct, XilinxFlipFlopRoseClass];
Ports.InitPorts[ct, l, none, "D", "CK", "ar", "ap"]; Ports.InitPorts[ct, l, drive, "Q"];
CacheStore[name, ct];
};
XilinxFFRef: TYPE = REF XilinxFFRec;
XilinxFFRec: TYPE = RECORD [
ffD, ffQ, ffClock, ffR, ffP: NATLAST[NAT],
master, slave: Ports.Level];
XilinxFFInit: Rosemary.InitProc = {
state: XilinxFFRef ← IF oldStateAny=NIL THEN NEW[XilinxFFRec] ELSE NARROW[oldStateAny];
state.master ← state.slave ← X;
[state.ffD, state.ffQ, state.ffClock, state.ffR, state.ffP] ← Ports.PortIndexes[cellType.public, "D", "Q", "CK", "ar", "ap"];
p[state.ffQ].l ← X;
stateAny ← state;
};
XilinxFFSimple: Rosemary.EvalProc = {
state: XilinxFFRef ← NARROW[stateAny];
SELECT TRUE FROM
p[state.ffR].l=L AND p[state.ffP].l=L => IF ~clockEval THEN SELECT p[state.ffClock].l FROM -- normal mode of operation
L => state.master ← p[state.ffD].l; -- load master bit
H => state.slave ← state.master; -- load slave bit
ENDCASE => state.slave ← state.master ← X; -- random clock
p[state.ffR].l=H => state.slave ← state.master ← L; -- asynchronous reset
p[state.ffP].l=H => state.slave ← state.master ← H; -- asynchronous preset
ENDCASE => state.slave ← state.master ← X; -- mushy reset
p[state.ffQ].l ← state.slave;
};
END.