DIRECTORY Core, CoreTransistor, GetMe, RoseBehavior, TransistorRoseDefs; TransistorRoseDetails: CEDAR PROGRAM IMPORTS GetMe, RoseBehavior, TransistorRoseDefs = BEGIN OPEN CoreTransistor, RoseBehavior, TransistorRoseDefs; Conductance: TYPE = {Off, On, Indeterminate}; ComputeState: ARRAY TransistorType OF ARRAY Level OF Conductance = [ nE: [L: Off, H: On, X: Indeterminate], pE: [L: On, H: Off, X: Indeterminate], nD: ALL[On] ]; TransistorStateRef: TYPE = REF TransistorStateRec; TransistorStateRec: TYPE = RECORD [ strength: Strength _ drive, conductance: Conductance]; CreateState: PROC [argsAny: REF ANY _ NIL] RETURNS [stateAny: REF ANY _ NIL] = { t: Transistor = NARROW[argsAny]; ts: TransistorStateRef _ NEW [TransistorStateRec _ [ conductance: Indeterminate ]]; stateAny _ ts; }; EnumerateVicinity : PROC [ argsAny, stateAny: REF ANY, portPath: PortPath, evenIfInput: BOOL _ FALSE, consume: PROC [PortPath] ] = { state: TransistorStateRef = NARROW[stateAny]; NotOff: PROC RETURNS [no: BOOL] = INLINE { no _ SELECT state.conductance FROM On, Indeterminate => TRUE, Off => FALSE, ENDCASE => ERROR}; IF portPath = NIL OR portPath.rest # NIL THEN ERROR; SELECT portPath.first FROM Transistorgate.first => NULL; Transistorch1.first => IF NotOff[] THEN consume[Transistorch2]; Transistorch2.first => IF NotOff[] THEN consume[Transistorch1]; Transistorback.first => NULL; ENDCASE => ERROR; }; ValsChanged: PROC [argsAny, switchAny, simpleAny, strengthAny, stateAny: REF ANY, perturb: PROC [portPath: PortPath]] = { t: Transistor = NARROW[argsAny]; state: TransistorStateRef = NARROW[stateAny]; io: REF TransistorSwitch = NARROW[switchAny]; {OPEN t, state, io; SELECT type FROM nE, pE => { new: Conductance _ ComputeState[type][gate.val]; IF new # conductance THEN { conductance _ new; perturb[Transistorch1]; perturb[Transistorch2]; } }; nD => NULL; ENDCASE => ERROR; }; }; PropQ: PROC [argsAny, switchAny, simpleAny, strengthAny, stateAny: REF ANY, perturb: PROC [portPath: PortPath]] = { t: Transistor = NARROW[argsAny]; state: TransistorStateRef = NARROW[stateAny]; io: REF TransistorSwitch = NARROW[switchAny]; {OPEN t, state, io; cs: Strength = SELECT conductance FROM On => strength, Off, Indeterminate => none, ENDCASE => ERROR; IF cs > none THEN { ch1.s[q] _ MAX[ch1.s[q], MIN[cs, ch2.s[q]]]; ch2.s[q] _ MAX[ch2.s[q], MIN[cs, ch1.s[q]]]; }; }; }; PropUD: PROC [argsAny, switchAny, simpleAny, strengthAny, stateAny: REF ANY, perturb: PROC [portPath: PortPath]] = { t: Transistor = NARROW[argsAny]; state: TransistorStateRef = NARROW[stateAny]; io: REF TransistorSwitch = NARROW[switchAny]; {OPEN t, state, io; cs: Strength = SELECT conductance FROM On, Indeterminate => strength, Off => none, ENDCASE => ERROR; IF cs > none THEN { ch1.s[u] _ MAX[ch1.s[u], MIN[cs, ch2.s[u]]]; ch1.s[d] _ MAX[ch1.s[d], MIN[cs, ch2.s[d]]]; ch2.s[u] _ MAX[ch2.s[u], MIN[cs, ch1.s[u]]]; ch2.s[d] _ MAX[ch2.s[d], MIN[cs, ch1.s[d]]]; }; }; }; RegisterDetails[ behaviorClassName: "Transistor", details: NEW [DetailsRec _ [ ValsChanged: ValsChanged, PropQ: PropQ, PropUD: PropUD, EnumerateVicinity: EnumerateVicinity, CreateState: CreateState ]], versionStamp: GetMe.GetVersion[] ]; END. ฎTransistorRoseDetails.mesa Copyright c 1985 by Xerox Corporation. All rights reversed. Barth, August 1, 1985 2:31:39 pm PDT Spreitzer, October 1, 1985 6:54:39 pm PDT สิ– "cedar" style˜– "Cedar" stylešœ™Jšœ ฯmœ1™