Rosemary.mesa
Barth, November 4, 1985 6:50:06 pm PST
DIRECTORY Core, CoreClasses;
Rosemary: CEDAR DEFINITIONS = BEGIN
ROPE : TYPE = Core.ROPE;
ValueWireList: TYPE = LIST OF ValueWire;
ValueWire: TYPE = REF ValueWireRec;
ValueWireRec: TYPE = RECORD [
clients should ignore these fields
nextStrengthRingMember: ValueWire ← NIL,
previousStrengthRingMember: ValueWire ← NIL,
currentRing: Drive ← none,
internal: InternalValueWire ← NIL,
fieldSize: CARDINAL ← 0,
coreWire: Core.Wire ← NIL,
roseCellInstance: RoseCellInstance ← NIL,
d: Drive ← none,
type: ValueWireType ← none, -- IF Core.Wire = atom THEN l ELSE none,
l: Level ← L,
b: BOOLFALSE,
c: CARDINAL ← 0,
lc: LONG CARDINAL ← 0,
sub: SEQUENCE size: NAT OF ValueWire];
Drive: TYPE = {
expect, -- allows test procs to put expected value in
none, --from a test proc it means neither driven nor checked; in switch-level it means no strength at all
force, -- weakest drive level, allows test procs to check if device has tristated
chargeWeak, chargeMediumWeak,
charge,
chargeMediumStrong, chargeStrong, chargeVeryStrong,
driveWeak, driveMediumWeak,
drive,
driveMediumStrong, driveStrong, driveVeryStrong,
input -- the strongest drive level
};
ValueWireType: TYPE = {none, l, b, c, lc, sub};
Level: TYPE = {L, H, X};
Behaviour
Bind: PROC [cellType: Core.CellType, roseClassName: Core.ROPE];
Register: PROC [roseClassName: Core.ROPE, init: InitProc ← NIL, evalSimple: EvalProc ← NIL] RETURNS [sameRoseClassName: Core.ROPE];
InitProc: TYPE = PROC [cellType: Core.CellType, p: ValueWire] RETURNS [stateAny: REF ANYNIL];
Initializes the state and the value from the context contained in the cell type.
EvalProc: TYPE = PROC [p: ValueWire, stateAny: REF ANY];
Stop: SIGNAL [msg: ROPENIL, data: REF ANYNIL];
This signal may be raised when a behavioural proc wishes to display a string to a user and wait for a proceed or abort.
Simulation Instantiation and Control
Simulation: TYPE = REF SimulationRec;
InstantiateCellType: PROC [cellType: Core.CellType] RETURNS [simulation: Simulation];
The cellType must have a behavioural class on its property list.
InstantiateInstances: PROC [cellType: Core.CellType] RETURNS [simulation: Simulation];
The cellType must be a record. The simulation is instantiated for the list of cell instances directly on the record cell type. No flattening occurs.
Initialize: PROC [simulation: Simulation, steady: BOOLTRUE];
Reset the state. If steady, wire are initialized to "easy" values, like Low and 0; if not, they are initialized to Xish values, if possible, otherwise they are initialized randomly.
Settle: PROC [simulation: Simulation];
Relaxes the simulation.
GetValue: PROC [wire: Core.Wire] RETURNS [value: ValueWire];
Get the value of the wire.
RefreshValue: PROC [value: ValueWire];
Updates the value.
SetValue: PROC [simulation: Simulation, value: ValueWire];
Set the value of the wire.
PrintValue: PROC [value: ValueWire, out: Core.STREAM];
Print the value of the wire.
PrintDrivers: PROC [value: ValueWire, out: Core.STREAM];
Print the value of the actuals for each writer attached to the value wire which is in the highest nonnull strength ring.
PrintWriters: PROC [value: ValueWire, out: Core.STREAM];
Print the value of the actuals for each writer attached to the value wire.
Test Procedures
RegisterTest: PROC [testName: ROPE, testProc: CellTestProc];
CellTestProc: TYPE = PROC [p: ValueWire, Eval: PROC];
RunTest: PROC [simulation: Simulation, testName: ROPE];
Internals
SimulationRec: TYPE = RECORD [
cellType: Core.CellType,
roseCellInstances: RoseCellInstances ← NIL,
needEval: RoseCellInstance ← NIL,
internal: InternalValueWires ← NIL,
publicValue: ValueWire ← NIL];
RoseCellType: TYPE = REF RoseCellTypeRec;
RoseCellTypeRec: TYPE = RECORD [
init: InitProc ← NIL,
evalSimple: EvalProc ← NIL];
RoseCellInstances: TYPE = LIST OF RoseCellInstance;
RoseCellInstance: TYPE = REF RoseCellInstanceRec;
RoseCellInstanceRec: TYPE = RECORD [
scheduleNext: RoseCellInstance ← NIL,
roseCellType: RoseCellType,
coreCellInstance: CoreClasses.CellInstance,
value: ValueWire,
state: REF ANYNIL];
InternalValueWires: TYPE = LIST OF InternalValueWire;
InternalValueWire: TYPE = REF InternalValueWireRec;
InternalValueWireRec: TYPE = RECORD [
l: Level ← L,
writers: RoseCellInstances ← NIL,
writerValues: ARRAY Drive OF ValueWire ← ALL[NIL],
readers: RoseCellInstances ← NIL,
readerValues: ValueWireList ← NIL];
END.