RoseControl.mesa
Copyright © 1985 by Xerox Corporation. All rights reversed.
Barth, October 4, 1985 5:00:53 pm PDT
Spreitzer, October 25, 1985 8:04:30 pm PDT
Generics
Error: ERROR [msg: ROPE, data: REF ANY ← NIL];
Warning: SIGNAL [msg: ROPE, data: REF ANY ← NIL];
Stop: SIGNAL [msg: ROPE, data: REF ANY ← NIL];
Basics
Simulation: TYPE = REF SimulationRec;
Instantiate:
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:
BOOL ←
TRUE];
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];
Simulate until bored.
Testers
CellTestHandle: TYPE = REF CellTestHandleRep;
CellTestHandleRep: TYPE;
InstantiateForTest:
PROC [cellType: Core.CellType, expand:
BOOL ←
TRUE]
RETURNS [cth: CellTestHandle];
IF expand
THEN merges tester into copy of testee
ELSE makes a circuit with one tester and one testee.
Test:
PROC [cth: CellTestHandle, testProc: TestProc, testData:
REF
ANY ←
NIL, stateToo:
BOOL ←
FALSE, steady:
BOOL ←
TRUE];
You can only get state if InstantiateForTest[expand: FALSE].
TestProc:
TYPE =
PROC [
testeeType: Core.CellType,
testData, switchInstructions, simpleInstructions, driveInstructions, stateAny: REF ANY,
Eval: PROC
];
GetTestSimulation: PROC [cth: CellTestHandle] RETURNS [simulation: Simulation];
Reading & Writing
See RoseValuing for some convenient combinations.
RoseWire: TYPE = REF RoseWireRep;
RoseWireRep: TYPE;
LookupRoseWire: PROC [sim: Simulation, w: Core.Wire] RETURNS [rw: RoseWire];
RoseWireSource: PROC [rw: RoseWire] RETURNS [sim: Simulation, w: Core.Wire];
ExhibitValue: PROC [rw: RoseWire, to: PROC [rwt: RoseWireType, ptr: Ptr]];
ConsumeValue: PROC [rw: RoseWire, produce: PROC [rwt: RoseWireType, ptr: Ptr]];
SetForce:
PROC [rw: RoseWire, fs: ForceScope];
ForceScope: TYPE = {notForced, tillSettle, forever};
boolType, bitType: RoseWireType;
ReadBool: PROC [p: Ptr] RETURNS [b: BOOL];
WriteBool: PROC [p: Ptr, b: BOOL];
ReadSwitch: PROC [p: Ptr] RETURNS [s: RoseBehavior.SwitchVal];
WriteSwitch: PROC [p: Ptr, s: RoseBehavior.SwitchVal];
AddNotification:
PROC [
event: Event,
on: RoseWire,
notify: EventConsumerProc,
data: REF ANY ← NIL]
RETURNS [registration: NotificationRegistration];
Event: TYPE = {Perturbed, Found, NewQ, NewUD, NewVal};
EventConsumerProc:
TYPE =
PROC [
event: Event,
on: RoseWire,
type: RoseWireType,
ptr: Ptr,
Valid for {NewQ, NewUD, NewVal}, but not {Perturbed, Found}.
data: REF ANY];
NotificationRegistration: TYPE = REF NotificationRegistrationPrivate;
NotificationRegistrationPrivate: TYPE;
RemoveNotification: PROC [registration: NotificationRegistration];