Cells
ConstantName: ROPE = Rosemary.Register[roseClassName: "Constant", init: ConstantInit, evalSimple: ConstantSimple];
ConstantState: TYPE = REF ConstantStateRec;
ConstantStateRec:
TYPE =
RECORD [
out: NAT ← LAST[NAT],
val: LONG CARDINAL];
ConstantInit: Rosemary.InitProc = {
state: ConstantState ← NEW[ConstantStateRec];
{OPEN state;
[out] ← Ports.PortIndexes[cellType.public, "Output"];
val ← NARROW[CoreProperties.GetCellTypeProp[cellType, $value], REF LONG CARDINAL]^;
Ports.LCToLS[val, p[out].ls]};
stateAny ← state;
};
ConstantSimple: Rosemary.EvalProc = {
state: ConstantState ← NARROW[stateAny];
{OPEN state; Ports.LCToLS[val, p[out].ls]};
};
SoftConstant:
PUBLIC
PROC [b:
NAT, v:
INT]
RETURNS [ct: CellType] = {
ct ← CoreClasses.CreateUnspecified[name: ConstantName, public: CoreCreate.Wires["Vdd", "Gnd", CoreCreate.Seq["Output", b]]];
CoreProperties.PutCellTypeProp[ct, $value, NEW[LONG CARDINAL ← LOOPHOLE[v]]];
[] ← Rosemary.BindCellType[cellType: ct, roseClassName: ConstantName];
[] ← CoreFlat.CellTypeCutLabels[ct, Logic.logicCutSet];
Ports.InitPorts[ct, l, none, "Vdd", "Gnd"];
Ports.InitPorts[ct, ls, drive, "Output"];
};
FirmConstant:
PUBLIC
PROC [b:
NAT, v:
INT]
RETURNS [ct: CellType] = {
ct ← CoreClasses.CreateUnspecified[name: ConstantName, public: CoreCreate.Wires["Vdd", "Gnd", CoreCreate.Seq["Output", b], "DOut", "DIn"]]; -- Fix to make DOut high order bit of Output
CoreProperties.PutCellTypeProp[ct, $value, NEW[LONG CARDINAL ← LOOPHOLE[v]]];
[] ← Rosemary.BindCellType[cellType: ct, roseClassName: ConstantName];
[] ← CoreFlat.CellTypeCutLabels[ct, Logic.logicCutSet];
Ports.InitPorts[ct, l, none, "Vdd", "Gnd"];
Ports.InitPorts[ct, ls, drive, "Output"];
};
HardConstant:
PUBLIC
PROC [b:
NAT, v:
INT]
RETURNS [ct: CellType] = {
ct ← CoreClasses.CreateUnspecified[name: ConstantName, public: CoreCreate.Wires["Vdd", "Gnd", CoreCreate.Seq["Output", b], "DOut", "DIn", "Shift", "Execute"]]; -- Fix to make DOut high order bit of Output
CoreProperties.PutCellTypeProp[ct, $value, NEW[LONG CARDINAL ← LOOPHOLE[v]]];
[] ← Rosemary.BindCellType[cellType: ct, roseClassName: ConstantName];
[] ← CoreFlat.CellTypeCutLabels[ct, Logic.logicCutSet];
Ports.InitPorts[ct, l, none, "Vdd", "Gnd"];
Ports.InitPorts[ct, ls, drive, "Output"];
};