DIRECTORY Core, CoreClasses, CoreFlat, HashTable, Ports; Rosemary: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Core.ROPE; BindCellType: PROC [cellType: Core.CellType, roseClassName: ROPE] RETURNS [sameCellType: Core.CellType]; BindCellClass: PROC [cellClass: Core.CellClass, roseClassName: ROPE] RETURNS [sameCellClass: Core.CellClass]; Register: PROC [roseClassName: ROPE, init: InitProc _ NIL, evalSimple: EvalProc _ NIL] RETURNS [sameRoseClassName: ROPE]; InitProc: TYPE = PROC [cellType: Core.CellType, p: Ports.Port] RETURNS [stateAny: REF ANY _ NIL]; StateCopyProc: TYPE = PROC [from: REF ANY, to: REF ANY]; EvalProc: TYPE = PROC [p: Ports.Port, stateAny: REF ANY]; Stop: SIGNAL [msg: ROPE _ NIL, data: REF ANY _ NIL]; AddCutSets: PROC [cellType: Core.CellType, cs1, cs2, cs3, cs4, cs5, cs6: ROPE _ NIL] RETURNS [sameCellType: Core.CellType]; SetFixedWire: PROC [wire: Core.Wire, level: Ports.Level] RETURNS [sameWire: Core.Wire]; SetWireSize: PROC [wire: Core.Wire, size: WireSize] RETURNS [sameWire: Core.Wire]; WireSize: TYPE = Ports.Drive[chargeWeak..chargeStrong]; SetTransistorCellTypeSize: PROC [transistor: Core.CellType, size: TransistorSize] RETURNS [sameTransistor: Core.CellType]; SetTransistorInstanceSize: PROC [transistor: CoreClasses.CellInstance, size: TransistorSize] RETURNS [sameTransistor: CoreClasses.CellInstance]; TransistorSize: TYPE = Ports.Drive[driveWeak..driveStrong]; InstantiateCellType: PROC [cellType: Core.CellType, testPort: Ports.Port, statePoints: NAT _ 0] RETURNS [simulation: Simulation]; InstantiateInstances: PROC [cellType: Core.CellType, testPort: Ports.Port, cutSet: ROPE _ NIL, statePoints: NAT _ 0] RETURNS [simulation: Simulation]; Initialize: PROC [simulation: Simulation, steady: BOOL _ TRUE]; Settle: PROC [simulation: Simulation, updateProc: UpdateProc _ NIL]; UpdateProc: TYPE = PROC [wire: RoseWire]; GetWirePath: PROC [wire: RoseWire] RETURNS [path: CoreFlat.PackedPath, coreWire: Core.Wire]; GetCellTypeState: PROC [simulation: Simulation] RETURNS [stateAny: REF ANY]; GetInstanceState: PROC [simulation: Simulation, instantiationPath: CoreFlat.InstantiationPath, instance: CoreClasses.CellInstance] RETURNS [stateAny: REF ANY]; WireValue: PROC [simulation: Simulation, instantiationPath: CoreFlat.InstantiationPath, wire: Core.Wire] RETURNS [value: Ports.LevelSequence]; StatePoint: PROC [simulation: Simulation, point: NAT]; RestoreState: PROC [simulation: Simulation, point: NAT]; RoseCellType: TYPE = REF RoseCellTypeRec; RoseCellTypeRec: TYPE = RECORD [ evalSimple: EvalProc _ NIL, init: InitProc _ NIL, copy: StateCopyProc _ NIL]; Simulation: TYPE = REF SimulationRec; SimulationRec: PUBLIC TYPE = RECORD [ coreCellType: Core.CellType _ NIL, cutSet: ROPE _ NIL, coreToRoseWires: HashTable.Table _ NIL, coreToRoseInstances: HashTable.Table _ NIL, coreToValues: ValueBindings _ NIL, instanceNeedEval: RoseCellInstance _ NIL, perturbed: RoseWire _ NIL, roseBoolWires: LIST OF RoseWire _ NIL, publicBindings: PortBindings _ NIL, scratchValue: Ports.LevelSequence _ NIL, scratchDrive: DriveSequence _ NIL, vicinityByStrength: ARRAY Ports.Drive OF VicinityRec, testPort: Ports.Port _ NIL, statePoints: PortSequence _ NIL]; DriveSequence: TYPE = REF DriveRec; DriveRec: TYPE = RECORD [drives: SEQUENCE size: CARDINAL OF Ports.Drive]; VicinityRec: TYPE = RECORD[ wires: RoseWires, firstFree: CARDINAL _ 0]; PortSequence: TYPE = REF PortSequenceRec; PortSequenceRec: TYPE = RECORD [ports: SEQUENCE size: NAT OF Ports.Port]; RoseCellInstance: TYPE = REF RoseCellInstanceRec; RoseCellInstanceRec: TYPE = RECORD [ nextNeedEval: RoseCellInstance _ NIL, roseCellType: RoseCellType _ NIL, publicPort: Ports.Port _ NIL, portBindings: PortBindings _ NIL, state: REF ANY _ NIL, statePoints: SRA _ NIL, path: CoreFlat.PackedPath, instance: CoreClasses.CellInstance _ NIL]; SRA: TYPE = REF SRASeq; SRASeq: TYPE = RECORD [elements: SEQUENCE size: CARDINAL OF REF ANY]; PortBindings: TYPE = REF PortBindingSeq; PortBindingSeq: TYPE = RECORD [elements: SEQUENCE size: CARDINAL OF PortBinding]; PortBinding: TYPE = REF PortBindingRec; PortBindingRec: TYPE = RECORD [ instance: RoseCellInstance _ NIL, clientPort: Ports.Port _ NIL, fields: Fields _ NIL, currentDrive: Ports.Drive _ none, statePoints: DriveSequence _ NIL]; Fields: TYPE = REF FieldSeq; FieldSeq: TYPE = RECORD [elements: SEQUENCE size: CARDINAL OF Field]; Field: TYPE = REF FieldRec; FieldRec: TYPE = RECORD [ portBinding: PortBinding _ NIL, portStartBit: NAT _ 0, roseWire: RoseWire _ NIL, currentValue: Ports.LevelSequence _ NIL, statePoints: LevelSequenceSeq _ NIL]; RoseWires: TYPE = REF RoseWireSeq; RoseWireSeq: TYPE = RECORD [elements: SEQUENCE size: CARDINAL OF RoseWire]; RoseWire: TYPE = REF RoseWireRec; RoseWireRec: TYPE = RECORD [ connections: Fields _ NIL, currentValue: Ports.LevelSequence _ NIL, nextPerturbedWire: RoseWire _ NIL, previousPerturbedWire: RoseWire _ NIL, nextRecomputed: RoseWire _ NIL, channels: RoseTransistors _ NIL, gates: RoseTransistors _ NIL, connectionDrive: Ports.Drive _ none, switchDrive: Ports.Drive _ none, upDrive: Ports.Drive _ none, downDrive: Ports.Drive _ none, wireDrive: Ports.Drive _ charge, connectionLevel: Ports.Level _ L, wireLevel: Ports.Level _ L, mark: BOOL _ FALSE, statePoints: REF ANY _ NIL, -- TypeUnion[Ports.LevelSequence, LevelSequenceSeq] path: CoreFlat.PackedPath, wire: Core.Wire _ NIL]; LevelSequenceSeq: TYPE = REF LevelSequenceSeqRec; LevelSequenceSeqRec: TYPE = RECORD [elements: SEQUENCE size: CARDINAL OF Ports.LevelSequence]; RoseTransistors: TYPE = REF RoseTransistorSeq; RoseTransistorSeq: TYPE = RECORD [elements: SEQUENCE size: CARDINAL OF RoseTransistor]; RoseTransistor: TYPE = REF RoseTransistorRec; RoseTransistorRec: TYPE = RECORD [ gate: RoseWire _ NIL, ch1: RoseWire _ NIL, ch2: RoseWire _ NIL, conductivity: Ports.Drive _ drive, type: CoreClasses.TransistorType _ nE]; ValueBindings: TYPE = LIST OF ValueBinding; ValueBinding: TYPE = RECORD [ path: CoreFlat.PackedPath, wire: Core.Wire _ NIL, values: Values _ NIL]; Values: TYPE = LIST OF Value; Value: TYPE = RECORD [ roseWire: RoseWire _ NIL, firstBit: NAT _ 0, size: NAT _ 0]; RoseWireHashKey: TYPE = REF RoseWireHashKeyRec; RoseWireHashKeyRec: TYPE = RECORD[ path: CoreFlat.PackedPath, wire: Core.Wire]; RoseInstanceHashKey: TYPE = REF RoseInstanceHashKeyRec; RoseInstanceHashKeyRec: TYPE = RECORD[ path: CoreFlat.PackedPath, instance: CoreClasses.CellInstance]; END. φRosemary.mesa Barth, April 4, 1986 3:30:00 pm PST Behaviour Registration Initializes the state and the value from the context contained in the cell type. Multiple calls must return different copies of the any bits in the state record which actually represent the state of the simulation. Copies the state. Must be idempotent. This signal may be raised when a behavioural proc wishes to display a string to a user and wait for a proceed or abort. Instantiation and Relaxation Adds the cell type to the specified cut sets. Sets the value of the wire and indicates that the value of the wire may not be changed by Rosemary. Sets the order of magnitude wire size. Sets the order of magnitude transistor size. The cellType must have a behavioural class on its property list. Reset the state. If steady then the wires are initialized to "easy" values like L and 0. If not steady then they are initialized to X, if possible, otherwise they are initialized randomly. The init procs are called again for each cell. Relaxes the simulation. The port supplied to either flavor of instantiate must not be changed during the execution of this procedure. If an update procedure is supplied it is called each time a RoseWire changes value. State Access Maps the Rosemary wire back into the Core data structure. Useful in UpdateProcs. Returns the ref to the cell types state. Raises an ERROR if the simulation was not instantiated with InstantiateCellType. Returns the ref to the indicated instance's state. Raises an ERROR if the instance was not a leaf during instantiation. Gets the current value of the wire. Raises an ERROR if the wire was not instantiated. Saves the current state of the simulation. Raises an ERROR if the index is greater than or equal to the number of statepoints passed to the instantiation procedure. Restores the state of the simulation. Data Structures Not intended to be understood by clients. The data structures have been optimized for atomic wires with transistors on them. Space optimization of more abstract objects was not a design goal. The following space estimates are not up to date. This is an unnecessary statement since documentation is always out of date. Right? Space allocation (including overhead of 2 words per allocated record) transistor: (7 + 2 + 1) words/RoseTransistorRec + 2 words/RoseTransistor * 3 RoseTransistor/RoseTransistorRec => 16 words/transistor wire: (25 + 2 + 2) words/RoseWireRec + (1 + 2) words/RoseTransistorSeq * 2 RoseTransistorSeq/RoseWireRec => 32 words/wire + quantization of RoseTransistorSeq A circuit with 200,000 transistors and 70,000 wires requires ~5.5 MWord of memory. You might conceive of simulating 400,000 transistor circuits on a Dorado with 12 MWord of memory. Maybe. With luck. When hell freezes over. Which is when a simulation will finish if very many of those wires or transistors have to be considered by the simulator during each evaluation. currentValue=NIL => the wire is atomic. The following fields are only significant if the wire is atomic. Κ U˜™ J™#—J™JšΟk œ/˜8J˜JšΟnœœ œ˜#J˜Jšœœœ˜head™codešž œœ*œœ˜hL˜—šž œœ,œœ!˜mL˜—šžœœœœœœœ˜yL˜—šžœœœ*œ œœœ˜aL™ΧL™—šž œœœœœœœ˜8L™L™—š žœœœœœ˜9L™—L˜š œœœœœœœ˜4L™wL˜——šœ™š ž œœ9œœœ˜{L™-J˜—šž œœ'œ˜WL™cJ˜—šž œœ#œ˜RL™&L™Lšœ œ)˜7J˜—šžœœ3œ!˜zLšœ,™,J˜—šžœœ>œ,˜L™Lšœœ'˜;J˜—šžœœ>œœ˜Lšœ@™@J˜—š žœœ9œœœœ˜–J˜—šž œœ"œœ˜?L™ξL™—šžœœ3œ˜DLšž œœœ˜)LšœΫ™ΫL™——™ šž œœœ2˜\LšœQ™QL™—š žœœœ œœ˜LLšœ4œA™zL™—š žœœmœ œœ˜ŸLšœ>œ5™xL™—šž œœZœ˜ŽLšœ/œ"™VL˜—šž œœ!œ˜6Lšœ6œj™₯L˜—šž œœ!œ˜8L™%L˜——™L™)L™L™–LšœkΟbœ™…™ELšœ„™„Lšœ™—™τL™—Lšœœœ˜)šœœœ˜ Lšœœ˜Lšœ˜Lšœœ˜L˜—Lšœ œœ˜%šœœœœ˜%Lšœœ˜"Lšœœœ˜Lšœ#œ˜'Lšœ'œ˜+Lšœœ˜"Lšœ%œ˜)Lšœœ˜Lšœœœ œ˜&Lšœœ˜#Lšœ$œ˜(Lšœœ˜"Lšœœ œ ˜5Lšœœ˜Lšœœ˜!L˜—Lšœœœ ˜#š œ œœ œœœ˜IL˜—šœ œœ˜Lšœ˜Lšœ œ˜L˜—Lšœœœ˜)š œœœœœœ ˜IL˜—Lšœœœ˜1šœœœ˜$Lšœ!œ˜%Lšœœ˜!Lšœœ˜Lšœœ˜!Lšœœœœ˜Lšœ œœ˜L˜Lšœ%œ˜*L˜—Lšœœœ˜Lšœœœ œœœœœ˜EL˜Lšœœœ˜(Lš œœœ œœœ˜QLšœ œœ˜'šœœœ˜Lšœœ˜!Lšœœ˜Lšœœ˜Lšœ!˜!Lšœœ˜"L˜—Lšœœœ ˜Lš œ œœ œœœ˜ELšœœœ ˜šœ œœ˜Lšœœ˜Lšœœ˜Lšœœ˜Lšœ$˜(Lšœ œ˜%L˜—Lšœ œœ ˜"Lš œ œœ œœœ ˜KLšœ œœ ˜!šœ œœ˜Lšœœ˜Lšœ$œ˜(™iLšœœ˜"Lšœ"œ˜&Lšœœ˜Lšœœ˜ Lšœœ˜Lšœ$˜$Lšœ ˜ Lšœ˜Lšœ˜Lšœ ˜ Lšœ!˜!L˜Lšœœœ˜—Lšœ œœΟc3˜PL˜Lšœœ˜L˜—Lšœœœ˜1š œœœ œœœ˜^L˜—Lšœœœ˜.Lš œœœ œœœ˜WLšœœœ˜-šœœœ˜"Lšœœ˜Lšœœ˜Lšœœ˜Lšœ"˜"Lšœ'˜'L˜—Lšœœœœ˜+šœœœ˜L˜Lšœœ˜Lšœœ˜L˜—Lšœœœœ˜šœœœ˜Lšœœ˜Lšœ œ˜Lšœœ˜L™—Lšœœœ˜/šœœœ˜"L˜L˜L˜—Lšœœœ˜7šœœœ˜&L˜L˜$L˜——Jšœ˜—…—0.{