Topology
Topology protocols and implementations for zone-based architectures.
Topologies define connectivity patterns (buses) for words and sites. All topologies are 2D-grid-aware.
AllToAllSiteTopology
dataclass
AllToAllSiteTopology()
All-to-all site connectivity: one bus per (src, dst) pair.
For N sites, produces N*(N-1)/2 single-element buses allowing any site to reach any other site directly.
DiagonalWordTopology
dataclass
DiagonalWordTopology()
Diagonal word connectivity between adjacent column pairs.
For a grid of (N rows x C cols), applies diagonal connectivity between each adjacent column pair (col_i, col_{i+1}). Per pair, produces 2N - 1 buses. Total buses: (C-1) * (2N - 1).
Per column pair: - Group 1 (shift 0..N-1): col_a[r] -> col_b[r + shift] for r in 0..N-1-shift - Group 2 (shift 1..N-1): col_a[r + shift] -> col_b[r] for r in 0..N-1-shift (reverse diagonal)
This gives full connectivity between all word pairs in adjacent columns, organized by diagonal. Non-adjacent columns are reachable via multi-hop.
HypercubeSiteTopology
dataclass
HypercubeSiteTopology()
Hypercube site connectivity within a single word.
For N = 2^k sites, produces k buses. Bus for dimension d connects sites that differ in bit d: src = [sites with bit d=0], dst = [sites with bit d=1]. Each bus has N/2 parallel moves.
For non-power-of-2 N, rounds up to the next power of 2 and filters out site indices >= N. Higher-indexed sites get fewer connections (e.g. for N=17, site 16 connects only to site 0 via dimension 4).
HypercubeWordTopology
dataclass
HypercubeWordTopology()
Hypercube word connectivity along both row and column dimensions.
For a grid of (R x C) words where R = 2^r and C = 2^c, produces r + c buses. Row dimension d connects word(row, col) to word(row ^ 2^d, col). Column dimension d connects word(row, col) to word(row, col ^ 2^d).
InterZoneTopology
Bases: Protocol
flowchart TD
bloqade.lanes.arch.build.topology.InterZoneTopology[InterZoneTopology]
click bloqade.lanes.arch.build.topology.InterZoneTopology href "" "bloqade.lanes.arch.build.topology.InterZoneTopology"
Generates word buses connecting words across two zones.
MatchingTopology
dataclass
MatchingTopology()
1:1 matching of words by grid position across two zones.
Produces a single bus pairing grid_a(r, c) with grid_b(r, c) for all (r, c). Requires both grids to have the same dimensions.
SiteTopology
Bases: Protocol
flowchart TD
bloqade.lanes.arch.build.topology.SiteTopology[SiteTopology]
click bloqade.lanes.arch.build.topology.SiteTopology href "" "bloqade.lanes.arch.build.topology.SiteTopology"
Generates site buses for movement within a single word (row of sites).
TransversalSiteTopology
dataclass
TransversalSiteTopology(
logical_topology: SiteTopology,
code_distance: int,
intra_group_topology: SiteTopology | None = None,
)
Physical site topology derived from a logical site topology via code expansion.
Sites are organized in groups of code_distance. Group g contains
physical sites [g*d, g*d+1, ..., g*d+d-1] where d = code_distance.
Produces two kinds of buses (transversal buses first so that logical bus IDs are preserved):
-
Transversal buses -- each logical bus is "inflated" so that every
(src, dst)element becomesdparallel physical elements. Logical bus B becomes physical bus B with the same index. -
Intra-group buses (optional) -- generated by
intra_group_topologyfordsites, then replicated and offset for each group. These support non-transversal operations within a code word (e.g. Steane code initialisation, syndrome extraction).
WordTopology
Bases: Protocol
flowchart TD
bloqade.lanes.arch.build.topology.WordTopology[WordTopology]
click bloqade.lanes.arch.build.topology.WordTopology href "" "bloqade.lanes.arch.build.topology.WordTopology"
Generates word buses for movement between words in a 2D grid.