MyCellModule.mesa
Copyright © 1987 by Xerox Corporation. All rights reserved.
Monier, January 5, 1987 8:15:51 pm PST
Gasbarro, January 23, 1987 2:17:39 pm PST
Barth, March 12, 1987 11:53:03 am PST
MyCellModule
:
CEDAR
PROGRAM
IMPORTS CDCommandOps, CDProperties, CDSequencer, CoreCreate, CoreFlat, Ports, Rosemary, RosemaryUser, Sisyph
= BEGIN
Binding
MyCellPhA, MyCellPhB, Vdd, Gnd:
NAT ←
LAST[
NAT];
MyCell
InitPortIndicies:
PROC [p: Core.Wire] ~ {
[up to 12 signals] ← Ports.PortIndexes[p, up to 12 quoted signals];
[Vdd, Gnd] ← Ports.PortIndexes[p, "Vdd", "Gnd"];
};
Structure
MyCell:
PUBLIC
PROC [arguments]
RETURNS [cellType: CoreCreate.CellType] = {
public: Core.Wire ← CoreCreate.Wires[
"simpleWire",
CoreCreate.Seq["bus", bitsInBus],
"Vdd", "Gnd"];
cellType ← CoreClasses.CreateUnspecified[name: "MyCell", public: public];
MyCellInitPortIndicies[public];
Ports.IPList[public, LIST[MyCellPhA, MyCellPhB], b];
};
Test
InitializeTest:
PROC ~ {
CDSequencer.ImplementCommand[key: $MyCellExtractAndSimulate, proc: MyCellExtractAndSimulate, queue: doQueue];
CDCommandOps.RegisterWithMenu[menu: $ProgramMenu, entry: "Simulate MyCell", key: $MyCellExtractAndSimulate];
RosemaryUser.RegisterTestProc["MyCellTest", MyCellTest];
};
MyCellExtractAndSimulate:
PROC [comm: CDSequencer.Command] ~ {
cellType: Core.CellType ← Sisyph.ExtractSchematicByName["MyCell.sch", Sisyph.Create[comm.design]];
public: Core.Wire ← cellType.public;
MyCellInitPortIndicies[public];
Ports.IPList[public, LIST[MyCellPhA, MyCellPhB], b];
CDProperties.PutDesignProp[comm.design, $DAUserRoseDisplay, MyCellSimulate[cellType].display];
};
MyCellCreateAndSimulate:
PROC ~ {
cellType: Core.CellType ← MyCell[arguments];
MyCellSimulate[cellType];
};
MyCellSimulate:
PROC [cellType: Core.CellType]
RETURNS [tester: RosemaryUser.Tester] ~ {
public: Core.Wire ← cellType.public;
Ports.ITDList[public, LIST[inputs], force];
Ports.ITDList[public, LIST[outputs], expect];
Ports.ITDList[public, LIST[inputs/outputs], none];
[] ← Rosemary.SetFixedWire[cellType.public[Vdd], H];
[] ← Rosemary.SetFixedWire[cellType.public[Gnd], L];
tester ← RosemaryUser.TestProcedureViewer[
cellType: cellType,
testButtons: LIST["MyCellTest"],
name: "MyCell Test",
displayWires: RosemaryUser.DisplayPortLeafWires[cellType],
cutSet: CoreFlat.CreateCutSet[labels: LIST["Logic", "LogicMacro", "FSA"]]];
};
MyCellTest: RosemaryUser.TestProc ~ {
-- PROC [cellType: Core.CellType, p: Ports.Port, Eval: PROC]
MyCellInitPortIndicies[cellType.public];
p[MyCellPhA].b ← TRUE;
p[MyCellPhB].b ← FALSE;
Eval[];
};
Behavior
MyCell
Name: Rope.
ROPE = Rosemary.Register[roseClassName: "
MyCell
", init:
MyCell
Init, evalSimple:
MyCell
Simple];
MyCellState: TYPE = REF MyCellStateRec;
MyCellStateRec:
TYPE =
RECORD [
any state: any type];
MyCellInit: Rosemary.InitProc = {
state: MyCellState ← IF oldStateAny#NIL THEN NARROW[oldStateAny] ELSE NEW[MyCellStateRec];
MyCellInitPortIndicies[cellType.public];
stateAny ← state;
};
MyCell
Simple: Rosemary.EvalProc = {
state: MyCellState ← NARROW[stateAny];
body of the proc
};