Algorithm Search⌘K

Conceptadvanced

Universal switch block

Also called Chang-Wong-Wong universal switch module.

An FPGA switch block that can route every set of two-pin connections that its side widths allow, built by Chang, Wong and Wong with the fewest switches, 6W for W tracks a side.

A universal switch block is an FPGA switch block with WW tracks on each of its four sides that can route every set of two-pin connections in which no side has more than WW connections. Chang, Wong and Wong defined it in 1996, built one with 6W6W switches, and proved that no switch block with fewer switches is universal. The planar pattern of the Xilinx XC4000 family has the same 6W6W switches but is not universal. The concept belongs to the FPGA CAD topic of this sub-area; in content it is a definition with a theorem, which this page states and proves.

In plain words

At a crossing of two routing channels, each side has a fixed number of tracks. Some nets must turn from one side to another, and some must go straight. Each net uses one switch, and no two nets may use the same track end.

If too many nets want the same side, no switch block can help, because the side runs out of track ends. A universal block is one that never fails for any other reason: whenever every side has room, it finds a track for every net.

The cheap pattern that keeps each net on the same track number fails on a small case: three nets that turn around three sides of the crossing need three different tracks when only two exist. The universal block avoids this by letting some turns swap tracks, and it does so with no more switches than the cheap pattern.

The idea

The model

Name the sides TT, RR, BB and LL, each with terminals 00 to W−1W - 1. A switch block is a graph SS on the 4W4W terminals whose edges join different sides. A requirement is a finite list of nets, each a pair {a,b}\{a, b\} of different sides. Write it as a loopless multigraph HH on the vertex set {T,R,B,L}\{T, R, B, L\} with one edge for each net. The density condition, which Chang, Wong and Wong call the dimension constraint, is

deg⁡H(s)≤Wfor each side s.\deg_H(s) \le W \quad \text{for each side } s.

A routing of HH in SS gives each net {a,b}\{a, b\} one switch {(a,i),(b,j)}∈S\{(a, i), (b, j)\} \in S, such that no terminal is used by two nets. The block SS is universal when every HH that meets the density condition has a routing in SS.

The condition is necessary for every block, since a side with more than WW nets has too few terminals. So a universal block is one that routes everything that any block could route.

The lower bound of 6W

Theorem 1. Every universal block on four sides with WW tracks has at least 6W6W switches.

Proof. Fix two sides a≠ba \ne b. The requirement with WW nets {a,b}\{a, b\} meets the density condition. A routing uses WW switches between aa and bb with pairwise different terminals, so every terminal of aa has a switch to side bb. This holds for each of the three sides b≠ab \ne a, so every terminal has degree at least 3, and the block has at least 4W⋅3/2=6W4W \cdot 3 / 2 = 6W switches. □\square

So a universal block with exactly 6W6W switches has Fs=3F_s = 3, and between any two sides its switches form a perfect matching, given by a permutation πab\pi_{ab} of the tracks.

The case W = 2

For W=2W = 2, a block with Fs=3F_s = 3 is given by one bit cabc_{ab} for each of the six pairs of sides: cab=0c_{ab} = 0 means the switches are (a,i)(b,i)(a, i)(b, i), and cab=1c_{ab} = 1 means they are (a,i)(b,1−i)(a, i)(b, 1 - i).

Lemma 2. A block with W=2W = 2 and Fs=3F_s = 3 is universal if and only if cc sums to an odd number on each of the four triangles of side pairs and to an even number on each of the three 4-cycles.

Proof. Let HH have maximum degree at most 2. Then each connected component of HH is a path or a cycle, of length 2, 3 or 4, since there are only four vertices. Components share no side, so they can be routed one at a time.

A routing gives each end of each net a track: if the net {a,b}\{a, b\} uses track tt on side aa, it uses track t⊕cabt \oplus c_{ab} on side bb. The routing is legal exactly when the two nets at a side of degree 2 use different tracks there. On a path, choose the track of the first end freely. Each edge then fixes the track at its far end, and at each inner vertex the next net must take the other track, which is always possible. So every path routes. On a cycle of length ℓ\ell, going once around flips the track ℓ\ell times at the vertices and adds cabc_{ab} on each edge, so the start track comes back to itself if and only if ℓ+∑cyclecab\ell + \sum_{\text{cycle}} c_{ab} is even. A cycle of length 2 has the same pair twice, so its sum is 2cab2 c_{ab}, which is even. A triangle needs an odd sum, and a 4-cycle needs an even sum.

Conversely, if some triangle or 4-cycle breaks its parity rule, the requirement made of that cycle meets the density condition and has no routing, by the same argument. □\square

All bits zero is the planar pattern, where every triangle has the sum 0, so it fails on the three nets TLT L, LBL B, BTB T. The choice used on this page is cTR=cBL=1c_{TR} = c_{BL} = 1 and the other four bits 0. Each triangle holds exactly one of the edges TRTR and BLBL, so its sum is 1, and each 4-cycle holds both of them or neither, so its sum is 0 or 2.

Any W

Let k=⌊W/2⌋k = \lfloor W/2 \rfloor. The block UWU_W puts a copy of the W=2W = 2 block on each pair of tracks {2j,2j+1}\{2j, 2j + 1\} for 0≤j<k0 \le j < k, with the same pair on all four sides. If WW is odd, the last track W−1W - 1 gets the six switches (a,W−1)(b,W−1)(a, W - 1)(b, W - 1). So UWU_W has 12k+6(W−2k)=6W12k + 6(W - 2k) = 6W switches.

Lemma 3. Let WW be odd and HH a loopless multigraph on four vertices with maximum degree at most WW. Then HH has a matching that covers every vertex of degree WW.

Proof. Let DD be the set of vertices of degree WW, and write mxym_{xy} for the number of edges between xx and yy.

  • ∣D∣=0|D| = 0: the empty matching.
  • ∣D∣=1|D| = 1: the vertex has degree W≥1W \ge 1, so take one of its edges.
  • ∣D∣=2|D| = 2, D={u,v}D = \{u, v\}: if muv≥1m_{uv} \ge 1, take that edge. If not, the edges of uu and of vv all go to the other two vertices xx and yy. If both uu and vv had neighbors only in {x}\{x\}, then deg⁡x≥2W\deg x \ge 2W, which is too large. So uu and vv have different neighbors among xx and yy, and the two edges form a matching.
  • ∣D∣=3|D| = 3, D={u,v,w}D = \{u, v, w\}, with zz the fourth vertex: a matching that covers three vertices has two edges, so it is perfect. Assume no perfect matching exists. The degree sum is even and 3W3W is odd, so deg⁡z\deg z is odd and zz has a neighbor, say uu. Then mvw=0m_{vw} = 0, or {uz,vw}\{uz, vw\} is a perfect matching. If muv=0m_{uv} = 0, then all WW edges of vv go to zz, and deg⁡z≥W+muz>W\deg z \ge W + m_{uz} > W. So muv≥1m_{uv} \ge 1, which forces mwz=0m_{wz} = 0, and then all WW edges of ww go to uu. Then muw≥1m_{uw} \ge 1 forces mvz=0m_{vz} = 0, and all WW edges of vv go to uu. Now deg⁡u≥2W+1\deg u \ge 2W + 1, a contradiction.
  • ∣D∣=4|D| = 4: HH is WW-regular. From deg⁡u+deg⁡v−deg⁡w−deg⁡z=0\deg u + \deg v - \deg w - \deg z = 0 we get muv=mwzm_{uv} = m_{wz}, and in the same way muw=mvzm_{uw} = m_{vz} and muz=mvwm_{uz} = m_{vw}. The three numbers muvm_{uv}, muwm_{uw}, muzm_{uz} sum to W≥1W \ge 1, so one of them is positive, and that pairing gives a perfect matching. □\square

Theorem 4. UWU_W is universal for every W≥1W \ge 1.

Proof. Let HH meet the density condition. If WW is odd, take the matching MM of Lemma 3 and route its nets on track W−1W - 1: each side is in at most one edge of MM, so no terminal is used twice. The rest H′=H−MH' = H - M has maximum degree at most W−1=2kW - 1 = 2k, since MM covers every vertex of degree WW. If WW is even, H′=HH' = H and W=2kW = 2k.

Next split H′H' into kk parts of maximum degree at most 2. Take two copies of H′H' and, for each vertex vv, join its two copies by 2k−deg⁡H′(v)2k - \deg_{H'}(v) parallel edges. The result is a loopless 2k2k-regular multigraph. By Petersen's 2-factor theorem, whose proof by an Eulerian circuit and König's theorem on a regular bipartite multigraph also holds for multigraphs, its edges split into kk 2-factors. Restricted to the first copy, they split the edges of H′H' into kk subgraphs of maximum degree at most 2. Route subgraph jj on the track pair {2j,2j+1}\{2j, 2j + 1\} by Lemma 2. Different pairs and the last track use different terminals, so the whole routing is legal. □\square

With Theorem 1, UWU_W has the fewest switches that a universal block can have. Chang, Wong and Wong give their own construction and proof. The one above is a short way to reach the same result.

Limits of the idea

Universality is a property of one switch block. A net in an array passes several blocks, and it must use the same track on the channel segment between two of them. So an array of universal blocks still needs a search for a detailed routing, and the global problem stays hard. The idea also assumes bidirectional switches, one switch per net in the block, and two-pin connections. A net with three or more pins at one block needs more than one switch there.

Examples

Three turning nets, W = 2. The nets are TLT L, LBL B and BTB T. In U2U_2, the pairs TLT L and BTB T keep the track, and LBL B swaps it. Route TLT L from (T,0)(T, 0) to (L,0)(L, 0). Then LBL B must start at (L,1)(L, 1) and swaps to (B,0)(B, 0). Then BTB T starts at (B,1)(B, 1) and ends at (T,1)(T, 1). Each side uses tracks 0 and 1 once each. The planar pattern fails here, as the proof of Lemma 2 shows.

A full requirement, W = 3. Take two nets TRT R, two nets BLB L, one net TBT B and one net RLR L. Every side has degree 3, so the set DD of Lemma 3 holds all four sides, and the pairing {TR,BL}\{TR, BL\} has both edges, so MM is one net TRT R and one net BLB L, routed on track 2. The rest is the 4-cycle T,R,L,BT, R, L, B. Route the second TRT R from (T,0)(T, 0) to (R,1)(R, 1) (a swap), then RLR L from (R,0)(R, 0) to (L,0)(L, 0), then the second BLB L from (L,1)(L, 1) to (B,0)(B, 0) (a swap), and TBT B from (B,1)(B, 1) to (T,1)(T, 1).

Counts. For W=1W = 1 to 4 there are 10, 56, 214 and 641 requirements that meet the density condition. UWU_W routes all of them. The planar pattern fails on 0, 4, 24 and 88 of them; for W=2W = 2, the four failures are the four triangles.

Where it is used

  • Architecture of the switch blocks. The result tells an architect that routability of one block costs no extra switches: the same 6W6W switches as the planar pattern can route every requirement. Chang, Wong and Wong also show that the XC4000-type pattern and the anti-symmetric patterns are not universal, and compare the patterns in experiments with a router.
  • Routing and channel width. A router on an array with universal blocks never fails inside one block for lack of a switch, only for lack of tracks. The effect on the minimum channel width of a whole design is measured, not proved. Betz, Rose and Marquardt compare several patterns inside a full flow in Chapter 7.
  • Exact routing. With the planar pattern, the track choice is a graph coloring of the nets; with other patterns it is a constraint problem that SAT-based FPGA routing solves exactly. The routing resource graph holds the pattern as edges.
  • Edge coloring. For the planar pattern, routing one block is an edge coloring of HH with WW colors. A triangle with one edge per side pair has chromatic index 3 but maximum degree 2, which is why the planar pattern fails. Universal blocks avoid the need for an edge coloring with Δ\Delta colors.

References

  1. Yao-Wen Chang, D. F. Wong and C. K. Wong, Universal switch modules for FPGA design, ACM Transactions on Design Automation of Electronic Systems 1(1), 80 to 101, 1996, the definition of a universal switch module by the dimension constraint, the construction with 6W switches and Fs = 3, the proof that fewer switches cannot be universal, and the proof that the XC4000-type module is not universal
  2. Yao-Wen Chang, D. F. Wong and C. K. Wong, Universal switch-module design for symmetric-array-based FPGAs, Proceedings of the ACM Symposium on Field-Programmable Gate Arrays (FPGA '96), 80 to 86, 1996, the conference version of the construction
  3. Vaughn Betz, Jonathan Rose and Alexander Marquardt, Architecture and CAD for Deep-Submicron FPGAs, Kluwer, 1999 (doi 10.1007/978-1-4615-5145-4), Chapter 7, Detailed Routing Architecture (switch block patterns compared inside a full routing flow; general locator)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/VB1R58/text.yaml