DIRECTORY Core, CoreClasses, CoreOps, RefTab, Sequence; SequenceTest: CEDAR PROGRAM IMPORTS CoreClasses, CoreOps, RefTab, Sequence = BEGIN CreateInverter: PROC RETURNS [cellType: Core.CellType, In, Out, Bus, Gnd, Vdd: Core.Wire] = { In _ CoreOps.CreateWire[name: "In"]; Out _ CoreOps.CreateWire[name: "Out"]; Bus _ CoreOps.CreateWires[name: "Bus", size: 3]; Gnd _ CoreOps.CreateWire[name: "Gnd"]; Vdd _ CoreOps.CreateWire[name: "Vdd"]; { ntrans: CoreClasses.CellInstance _ NEW [CoreClasses.CellInstanceRec _ [ actual: CoreOps.CreateWire[LIST [In, Out, Gnd]], type: CoreClasses.CreateTransistor[nE] ]]; ptrans: CoreClasses.CellInstance _ NEW [CoreClasses.CellInstanceRec _ [ actual: CoreOps.CreateWire[LIST [In, Out, Vdd, Vdd]], type: CoreClasses.CreateTransistor[pE] ]]; FOR i: NAT IN [0..3) DO Bus[i] _ CoreOps.CreateWire[]; ENDLOOP; cellType _ CoreClasses.CreateRecordCell[ public: CoreOps.CreateWire[LIST [In, Out, Bus, Gnd, Vdd]], internal: CoreOps.CreateWire[LIST [In, Out, Bus, Gnd, Vdd]], instances: LIST [ntrans, ptrans], name: "Inverter" ]; }; }; CreateSequence: PROC RETURNS [sequence, recasted: Core.CellType _ NIL] = { inverter: Core.CellType; In, Out, Bus, Gnd, Vdd: Core.Wire; bindings: Sequence.WireBindings _ NIL; operations: Sequence.Operations _ RefTab.Create[]; [inverter, In, Out, Bus, Gnd, Vdd] _ CreateInverter[]; bindings _ CONS[[In, Out], bindings]; [] _ RefTab.Store[operations, In, NEW[Sequence.OperationRec _ [expose: [FALSE, FALSE, FALSE, TRUE, FALSE]]]]; [] _ RefTab.Store[operations, Out, NEW[Sequence.OperationRec _ [expose: [FALSE, FALSE, FALSE, FALSE, TRUE]]]]; bindings _ CONS[[Bus, Bus], bindings]; [] _ RefTab.Store[operations, Bus, NEW[Sequence.OperationRec _ [expose: [FALSE, FALSE, TRUE, FALSE, FALSE]]]]; bindings _ CONS[[Gnd, Gnd], bindings]; [] _ RefTab.Store[operations, Gnd, NEW[Sequence.OperationRec _ [expose: [FALSE, FALSE, TRUE, FALSE, FALSE]]]]; bindings _ CONS[[Vdd, Vdd], bindings]; [] _ RefTab.Store[operations, Vdd, NEW[Sequence.OperationRec _ [expose: [FALSE, FALSE, TRUE, FALSE, FALSE]]]]; sequence _ Sequence.CreateSequence[inverter, 3, bindings, operations]; recasted _ sequence.class.recast[sequence]; CoreOps.Print[sequence]; CoreOps.Print[recasted]; }; END. |SequenceTest.mesa Copyright Σ 1988 by Xerox Corporation. All rights reserved. Barth, March 21, 1988 2:31:52 pm PST Κt˜šœ™Icode™