Constant: Sinix.ExtractProc = {
PROC [obj: Object, mode: Mode, properties: CD.PropList ← NIL, userData: REF ← NIL] RETURNS [result: REF, props: Properties ← NIL]
Evaluate parameters, recover b: number of bits, v: value (INT).
cx: Sisyph.Context = Sisyph.EvaluateParameters[userData, obj, properties];
iconCT: CellType = NARROW [Sinix.ExtractCell[obj, mode, NIL, cx].result];
gnd: Wire = CoreOps.CreateWire[name: "Gnd"];
vdd: Wire = CoreOps.CreateWire[name: "Vdd"];
output: Wire;
b: NAT;
v: INT;
vCard: CARD;
b ← Sisyph.FetchInt[cx, "b"].value;
v ← Sisyph.FetchInt[cx, "v"].value;
vCard ← LOOPHOLE[v];
IF b<=0 THEN LogicUtils.Error["Specify number of bits for Constant"];
output ← Seq[size: b];
IF b<=32
THEN
FOR i:
NAT
IN [0..b)
DO
output[i] ← IF BitOps.EBFD[vCard, i, b] THEN vdd ELSE gnd;
ENDLOOP
ELSE {
sign: Wire ← IF v<0 THEN vdd ELSE gnd;
FOR i: NAT IN [0..b-32) DO output[i] ← sign; ENDLOOP;
FOR i:
NAT
IN [b-32..b)
DO
output[i] ← IF BitOps.EBFD[vCard, i-b+32, 32] THEN vdd ELSE gnd;
ENDLOOP;
};
CoreGeometry.PutIndirectLazyPins[mode.decoration, output, CoreOps.FindWire[iconCT.public, "Output"]];
result ← Wires[output, gnd, vdd];
};