<> <> <> <> <> <> <> <<>> DIRECTORY Core, CoreClasses, CoreFlat, CoreOps, Commander, HashTable, IO, ProcessProps, Rosemary; RoseDebug: CEDAR PROGRAM IMPORTS CoreFlat, CoreOps, HashTable, IO, ProcessProps EXPORTS = BEGIN OPEN Rosemary; HackSignal: SIGNAL = CODE; CorrespondingPublic: PUBLIC PROC [instance: CoreClasses.CellInstance, actual: Core.Wire] RETURNS [public: Core.Wire _ NIL] = { EachWirePair: CoreOps.EachWirePairProc = { IF actualWire=actual THEN {public _ publicWire; quit _ TRUE}; }; [] _ CoreOps.VisitBinding[instance.actual, instance.type.public, EachWirePair]; }; <<_ RoseDebug.FindHack[&new.data[0].type.data[49].type, &new.data[0].type.data[49].type.data.internal[11590]]>> FindHack: PROC [cellType: Core.CellType, wire: Core.Wire] = { rct: CoreClasses.RecordCellType _ NARROW[cellType.data]; FOR i: NAT IN [0..rct.size) DO IF CoreOps.RecursiveMember[rct[i].actual, wire] THEN { subrct: CoreClasses.RecordCellType _ NARROW[rct[i].type.data]; subWire: Core.Wire _ CorrespondingPublic[rct[i], wire]; FOR j: NAT IN [0..subrct.size) DO IF CoreOps.RecursiveMember[subrct[j].actual, subWire] THEN GOTO found; REPEAT found => { CoreOps.Print[rct[i].type]; SIGNAL HackSignal[]; }; ENDLOOP; }; ENDLOOP; }; <> <> <1000 THEN SIGNAL HackSignal;>> <<};>> <> <<};>> <<>> FindBigWires: PROC [simulation: Simulation] = { FindWire: HashTable.EachPairAction = { roseWire: RoseWire _ NARROW[value]; IF roseWire.channels# NIL AND roseWire.channels.size>1000 THEN SIGNAL HackSignal; }; [] _ HashTable.Pairs[table: simulation.coreToRoseWires, action: FindWire]; }; <> <> <> <> <> <> <> <> <> <> <> <> <> <<};>> <> <<};>> <<>> <> <> <> <> <> <> <> <> <<};>> <<>> EnumerateRoseWires: PROC [simulation: Simulation] RETURNS [roseWires: LIST OF RoseWire _ NIL] = { ConsWires: HashTable.EachPairAction = { roseWire: RoseWire _ NARROW[value]; roseWires _ CONS[roseWire, roseWires]; }; [] _ HashTable.Pairs[table: simulation.coreToRoseWires, action: ConsWires]; }; MaxConnections: PROC [simulation: Simulation] RETURNS [wires, average, max, total: INT _ 0] = { CountConnections: HashTable.EachPairAction = { roseWire: RoseWire _ NARROW[value]; wires _ wires + 1; total _ total + roseWire.connections.size; max _ MAX[max, roseWire.connections.size]; }; [] _ HashTable.Pairs[table: simulation.coreToRoseWires, action: CountConnections]; average _ total/wires; }; FilterXWires: PROC [sourceWires: LIST OF RoseWire] RETURNS [xwires: LIST OF RoseWire _ NIL] = { FOR roseWires: LIST OF RoseWire _ sourceWires, roseWires.rest UNTIL roseWires=NIL DO roseWire: RoseWire _ roseWires.first; IF roseWire.currentValue=NIL THEN { IF roseWire.wireLevel=X THEN xwires _ CONS[roseWires.first, xwires]; } ELSE FOR bit: CARDINAL IN [0..roseWire.currentValue.size) DO IF roseWire.currentValue[bit]=X THEN xwires _ CONS[roseWires.first, xwires]; ENDLOOP; ENDLOOP; }; FindCoreWires: PROC [simulation: Simulation, wire: Core.Wire] RETURNS [roseWires: LIST OF RoseWire _ NIL] = { ConsWires: HashTable.EachPairAction = { roseWire: RoseWire _ NARROW[value]; IF roseWire.wire.wire=wire THEN roseWires _ CONS[roseWire, roseWires]; }; [] _ HashTable.Pairs[table: simulation.coreToRoseWires, action: ConsWires]; }; RecomputeLoop: PROC [recomputed: RoseWire] RETURNS [BOOL _ FALSE] = { saw: HashTable.Table _ HashTable.Create[]; FOR recomputed _ recomputed, recomputed.nextRecomputed UNTIL recomputed=NIL DO IF NOT HashTable.Insert[saw, recomputed, $Saw] THEN RETURN [TRUE] ENDLOOP; saw _ saw; }; PrintRecompute: PROC [simulation: Simulation, recomputed: RoseWire, out: Core.STREAM _ NIL] = { IF out=NIL THEN out _ NARROW [ProcessProps.GetProp[$CommanderHandle], Commander.Handle].out; FOR recomputed _ recomputed, recomputed.nextRecomputed UNTIL recomputed=NIL DO IO.PutRope[out, CoreFlat.WirePathRope[simulation.cellType, recomputed.wire]]; IO.PutRope[out, "\n"]; ENDLOOP; }; PerturbLoop: PROC [simulation: Simulation] RETURNS [BOOL _ FALSE] = { sawNext: HashTable.Table _ HashTable.Create[]; sawPrevious: HashTable.Table _ HashTable.Create[]; FOR next: RoseWire _ simulation.perturbed, next.nextPerturbedWire UNTIL next=NIL DO IF NOT HashTable.Insert[sawNext, next, $Saw] THEN RETURN [TRUE] ENDLOOP; FOR previous: RoseWire _ simulation.perturbed, previous.previousPerturbedWire UNTIL previous=NIL DO IF NOT HashTable.Insert[sawPrevious, previous, $Saw] THEN RETURN [TRUE] ENDLOOP; }; <> <<>> <> <> < "e",>> < "n",>> < "cw",>> < "cmw",>> < "c",>> < "cms",>> < "cs",>> < "f",>> < "dw",>> < "dmw",>> < "d",>> < "dms",>> < "ds",>> < "i",>> < ERROR]];>> <<};>> <<>> <> <> < "L",>> < "H",>> < "X",>> < ERROR]];>> <<};>> <<>> <> < "n", pE => "p", nD => "d", ENDCASE => ERROR], Drive[trans.conductivity]];>> <<};>> <<>> <> <> <> <> <<[] _ HashTable.Insert[table: tranTab, key: trans[t], value: $Transistor];>> <> <<};>> <<>> <> <> <> <> <> <<};>> <> <> <> <> <<};>> <<>> <> <> <> <> <> < -"];>> <> <> <<};>> <<>> <> <> <> <> <> <> <> <> <> <> <> <<}>> <> <> <<};>> <> <<};>> <<>> <> <> <> <<[] _ HashTable.Pairs[table: simulation.coreToRoseWires, action: PrintWires];>> <<[] _ HashTable.Pairs[tranTab, PrintEachTransistor];>> <<};>> <<>> END.