Atelier des rouesLab FR
Objects/Documentation

copies11.py

I provide this item to reproduce or inspect AT.D3.

Download ↓
"""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()

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.