def ROM4(data, i, width): return fork([uncurry(LUT(data[i][w], 4)) for w in range(width)])
def compress3to2(): global n3to2s n3to2s = n3to2s + 1 Op = Define3to2Op() return fork([XOr(3), Op()])
def compress2to2(): global n2to2s n2to2s = n2to2s + 1 return fork([LUT2(I0 ^ I1), LUT2((I0 & I1) | (I1 & I2))])
def compress3to2(): global n3to2s n3to2s = n3to2s + 1 return fork( [LUT3(I0 ^ I1 ^ I2), LUT3((I0 & I1) | (I1 & I2) | (I2 & I0))])
def definition(io): swap = uncurry(fork(And(2), Or(2)), prefix="I") #swap = uncurry( fork( And(2), Or(2) ) , prefix="in") wire(swap(io.I), io.O)