<> <> <> <> <> <<>> DIRECTORY Convert, Core, NewCoreClasses, CoreOps, Rope; NewCoreClassesImpl: CEDAR PROGRAM IMPORTS Convert, CoreOps, Rope EXPORTS NewCoreClasses = BEGIN OPEN Core, NewCoreClasses; <> RopeFromVolts: PUBLIC PROC [v: Volts] RETURNS [rope: ROPE] = BEGIN RETURN [Rope.Cat[Convert.RopeFromReal[v], "V"]]; END; RopeFromKOhms: PUBLIC PROC [r: KOhms] RETURNS [rope: ROPE] = BEGIN RETURN [Rope.Cat[Convert.RopeFromReal[r], "K"]]; END; RopeFrompF: PUBLIC PROC [c: pF] RETURNS [rope: ROPE] = BEGIN RETURN [Rope.Cat[Convert.RopeFromReal[c], "pF"]]; END; RopeFromns: PUBLIC PROC [t: ns] RETURNS [rope: ROPE] = BEGIN RETURN [Rope.Cat[Convert.RopeFromReal[t], "ns"]]; END; RopeFrommA: PUBLIC PROC [i: mA] RETURNS [rope: ROPE] = BEGIN RETURN [Rope.Cat[Convert.RopeFromReal[i], "mA"]]; END; RopeFromuH: PUBLIC PROC [l: uH] RETURNS [rope: ROPE] = BEGIN RETURN [Rope.Cat[Convert.RopeFromReal[l], "uH"]]; END; <> resistorCellClass: PUBLIC CellClass _ NEW [CellClassRec _ [name: "Resistor", recast: NIL]]; CreateResistor: PUBLIC PROC [args: ResistorRec, name: ROPE _ "Resistor", props: Properties _ NIL] RETURNS [cellType: CellType] = { public: Wire _ CoreOps.CreateWire[LIST[ CoreOps.CreateWire[name: "n0"], CoreOps.CreateWire[name: "n1"] ]]; cellType _ CoreOps.CreateCellType[ class: resistorCellClass, public: public, data: NEW [ResistorRec _ args], name: name, props: props]; }; <> inductorCellClass: PUBLIC CellClass _ NEW [CellClassRec _ [name: "Inductor", recast: NIL]]; CreateInductor: PUBLIC PROC [args: InductorRec, name: ROPE _ "Inductor", props: Properties _ NIL] RETURNS [cellType: CellType] = { public: Wire _ CoreOps.CreateWire[LIST[ CoreOps.CreateWire[name: "n0"], CoreOps.CreateWire[name: "n1"] ]]; cellType _ CoreOps.CreateCellType[ class: inductorCellClass, public: public, data: NEW [InductorRec _ args], name: name, props: props]; }; <> capacitorCellClass: PUBLIC CellClass _ NEW [CellClassRec _ [name: "Capacitor", recast: NIL]]; CreateCapacitor: PUBLIC PROC [args: CapacitorRec, name: ROPE _ "Capacitor", props: Properties _ NIL] RETURNS [cellType: CellType] = { public: Wire _ CoreOps.CreateWire[LIST[ CoreOps.CreateWire[name: "n0"], CoreOps.CreateWire[name: "n1"] ]]; cellType _ CoreOps.CreateCellType[ class: capacitorCellClass, public: public, data: NEW [CapacitorRec _ args], name: name, props: props]; }; <> signalGeneratorCellClass: PUBLIC CellClass _ NEW [CellClassRec _ [name: "SignalGenerator", recast: NIL]]; CreateSignalGenerator: PUBLIC PROC [args: SignalGeneratorRec, name: ROPE _ "SignalGenerator", props: Properties _ NIL] RETURNS [cellType: CellType] = { public: Wire _ CoreOps.CreateWire[LIST[ CoreOps.CreateWire[name: "n"] ]]; cellType _ CoreOps.CreateCellType[ class: signalGeneratorCellClass, public: public, data: NEW [SignalGeneratorRec _ args], name: name, props: props]; }; <> probeCellClass: PUBLIC CellClass _ NEW [CellClassRec _ [name: "Probe", recast: NIL]]; CreateProbe: PUBLIC PROC [args: ProbeRec, name: ROPE _ "Probe", props: Properties _ NIL] RETURNS [cellType: CellType] = { public: Wire _ SELECT args.type FROM Voltage => CoreOps.CreateWire[LIST[CoreOps.CreateWire[name: "n"]]], Current => CoreOps.CreateWire[LIST[CoreOps.CreateWire[name: "n0"], CoreOps.CreateWire[name: "n1"]]] ENDCASE => ERROR; cellType _ CoreOps.CreateCellType[ class: probeCellClass, public: public, data: NEW [ProbeRec _ args], name: name, props: props]; }; <> initCellClass: PUBLIC CellClass _ NEW [CellClassRec _ [name: "Init", recast: NIL]]; CreateInit: PUBLIC PROC [args: InitRec, name: ROPE _ "Init", props: Properties _ NIL] RETURNS [cellType: CellType] = { public: Wire _ SELECT args.type FROM Voltage => CoreOps.CreateWire[LIST[CoreOps.CreateWire[name: "n"]]], Current => CoreOps.CreateWire[LIST[CoreOps.CreateWire[name: "n0"], CoreOps.CreateWire[name: "n1"]]] ENDCASE => ERROR; cellType _ CoreOps.CreateCellType[ class: initCellClass, public: public, data: NEW [InitRec _ args], name: name, props: props]; }; <> thymePanelCellClass: PUBLIC CellClass _ NEW [CellClassRec _ [name: "ThymePanel", recast: NIL]]; CreateThymePanel: PUBLIC PROC [args: ThymePanelRec, name: ROPE _ "ThymePanel", props: Properties _ NIL] RETURNS [cellType: CellType] = BEGIN public: Wire _ CoreOps.CreateWire[]; cellType _ CoreOps.CreateCellType[ class: thymePanelCellClass, public: public, data: NEW [ThymePanelRec _ args], name: name, props: props]; END; END.