Objets/Documentation
copies11.py
Je fournis cette pièce pour reproduire ou examiner AT.D3.
Télécharger ↓"""Reversible fanout scheduling for a four-bit residue oracle, all gates explicit."""
from itertools import product
import json
def circuit(bits,parallel):
# Compute four one-hot predicate bits [x mod 4 == j] using negative controls.
# A negative control is counted as a primitive in this abstract library.
a,b=bits
if parallel:
wires=[a,b,0,0,0,0,0,0,0,0,0,0]
layers=[[('c',0,2),('c',1,3)],[('c',0,4),('c',2,6),('c',1,5),('c',3,7)],
[('t',2*j,2*j+1,8+j,j) for j in range(4)],
[('c',0,4),('c',2,6),('c',1,5),('c',3,7)],[('c',0,2),('c',1,3)]]
else:
wires=[a,b,0,0,0,0];layers=[[('t',0,1,2+j,j)] for j in range(4)]
for layer in layers:
used=set()