NAnd:
PUBLIC
PROC [i:
NAT]
RETURNS [ct: CellType] = {
instances: LIST OF CellInstance ← NIL;
pType: CellType ← Transistor[type: pE, width: 3];
nType: CellType ← Transistor[type: nE, width: 1];
FOR input:
NAT
IN [0..i)
DO
instances ←
CONS[Instance[pType,
["gate", Index["Input", input]], ["ch1", "Vdd"], ["ch2", "nOutput"], ["Vdd", "Vdd"]],
instances];
instances ←
CONS[Instance[nType,
["gate", Index["Input", input]],
["ch1", IF input=0 THEN "nOutput" ELSE Index["stack", input-1]],
["ch2", IF input=i-1 THEN "Gnd" ELSE Index["stack", input]]],
instances];
ENDLOOP;
ct ← Cell[
name: "NAnd",
public: Wires["Vdd", "Gnd", Seq["Input", i], "nOutput"],
onlyInternal: Wires[Seq["stack", i-1]],
instances: instances];
};