NewCoreClassesImpl.mesa
Written by: Pradeep Sindhu April 1, 1986 1:12:34 am PST
Last Edited by:
Bertrand Serlet October 17, 1986 11:49:09 pm PDT
Pradeep Sindhu December 4, 1986 1:18:52 am PST
DIRECTORY Convert, Core, NewCoreClasses, CoreOps, Rope;
NewCoreClassesImpl: CEDAR PROGRAM
IMPORTS Convert, CoreOps, Rope
EXPORTS NewCoreClasses =
BEGIN OPEN Core, NewCoreClasses;
Translation Procs for Basic Types
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;
Resistor
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];
};
Inductor
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];
};
Capacitor
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];
};
SignalGenerator
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];
};
Probe
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];
};
Init
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];
};
ThymePanel
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.