name: Rope.ROPE ← CoreOps.GetCellTypeName[cell];
ELSE
SELECT primitiveType^
FROM
ignore, equate => NULL;
and, nand, or, nor => {
flatOutput: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "X"];
flatInputs: PolarizedInputs ← NIL;
Combinatorial.MakeCombinatorial[cell];
FOR wl: Core.Wires ← Combinatorial.GetTypedWires[cell, input], wl.rest
UNTIL wl=
NIL
DO
flatInput: CoreFlat.FlatWire ← CanonizeWire[bindings, flatCell, wl.first];
flatInputs ← CONS[[flatInput, invertInputs[primitiveType^]], flatInputs];
ENDLOOP;
AddPrimitive[flatCell, flatOutput, invertOutput[primitiveType^], flatInputs];
};
xor2, xnor2 => {
a: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "I-A"];
b: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "I-B"];
x: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "X"];
i1: CoreFlat.FlatWire ← CreateWire[flatCell];
i2: CoreFlat.FlatWire ← CreateWire[flatCell];
AddPrimitive[flatCell, i1, FALSE, LIST[[a, TRUE], [b, FALSE]]];
AddPrimitive[flatCell, i2, FALSE, LIST[[a, FALSE], [b, TRUE]]];
AddPrimitive[flatCell, x, primitiveType^=xnor2, LIST[[i1, FALSE], [i2, FALSE]]];
};
a22o2i, o22a2i => {
a: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "A"];
b: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "B"];
c: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "C"];
d: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "D"];
x: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "X"];
i1: CoreFlat.FlatWire ← CreateWire[flatCell];
i2: CoreFlat.FlatWire ← CreateWire[flatCell];
invertInputs: BOOL ← primitiveType^=o22a2i;
AddPrimitive[flatCell, i1, FALSE, LIST[[a, invertInputs], [b, invertInputs]]];
AddPrimitive[flatCell, i2, FALSE, LIST[[c, invertInputs], [d, invertInputs]]];
AddPrimitive[flatCell, x, NOT invertInputs, LIST[[i1, FALSE], [i2, FALSE]]];
};
a21o2i, o21a2i => {
a: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "A"];
b: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "B"];
c: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "C"];
x: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "X"];
i: CoreFlat.FlatWire ← CreateWire[flatCell];
invert: BOOL ← primitiveType^=o21a2i;
AddPrimitive[flatCell, i, FALSE, LIST[[a, invert], [b, invert]]];
AddPrimitive[flatCell, x, NOT invert, LIST[[i, FALSE], [c, NOT invert]]];
};
ff => {
q: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "Q"];
d: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "D"];
ck: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "CK"];
AddPrimitive[flatCell, q, FALSE, LIST[[d, TRUE]], ck];
};
ffEn => {
en: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "en"];
d: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "D"];
q: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "Q"];
ck: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "CK"];
i1: CoreFlat.FlatWire ← CreateWire[flatCell];
i2: CoreFlat.FlatWire ← CreateWire[flatCell];
i3: CoreFlat.FlatWire ← CreateWire[flatCell];
AddPrimitive[flatCell, i1, FALSE, LIST[[en, FALSE], [d, FALSE]]];
AddPrimitive[flatCell, i2, FALSE, LIST[[en, TRUE], [q, FALSE]]];
AddPrimitive[flatCell, i3, FALSE, LIST[[i1, FALSE], [i2, FALSE]], ck];
};
tstDriver => {
x: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "X"];
triData: TriData ← NARROW[RefTab.Fetch[triDataTable, x].val];
IF triData.count>1
THEN {
i: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "I"];
en: CoreFlat.FlatWire ← GetNamedWire[bindings, cell.public, flatCell, "EN"];
i1: CoreFlat.FlatWire ← CreateWire[flatCell];
i2: CoreFlat.FlatWire ← CreateWire[flatCell];
previous: CoreFlat.FlatWire ← IF triData.count=2 THEN triData.lastInput ELSE CreateWire[flatCell];
AddPrimitive[flatCell, i1, FALSE, LIST[[en, FALSE], [i, FALSE]]];
AddPrimitive[flatCell, i2, FALSE, LIST[[en, TRUE], [previous, FALSE]]];
AddPrimitive[flatCell, triData.next, FALSE, LIST[[i1, FALSE], [i2, FALSE]]];
triData.count ← triData.count - 1;
triData.next ← previous;
};
};
ENDCASE => ERROR;