The idea: many masters, many slaves, one chip

A system on a chip has several blocks that start transfers, the masters: here a CPU, a DMA engine, a GPU and an accelerator (ACC). It has several blocks that answer, the slaves: here an SRAM, a DRAM controller, a UART and a timer. The wires that connect them are the interconnect. The bus protocol says what the signals mean in each cycle (that is on AMBA Buses). This page asks a different question: how many transfers can move at the same time, and what it costs.

Three drawings of the same 4 masters and 4 slaves. Left: a shared bus, one line that every block taps into, with one arbiter; 4 transfers to different slaves take 16 cycles. Middle: a 4 by 4 crossbar, masters on rows and slaves on columns with a switch at each of the 16 crossings; the same 4 transfers take 4 cycles. Right: a 2 by 2 mesh of routers, each tile holding one master and one slave, with links only between neighbouring routers; the same 4 transfers take 6 cycles.
Same 4 transfers, 4 words each: one shared bus takes 16 cycles, a crossbar 4, a 2×2 mesh NoC 6.

To compare them fairly, every transfer on the page is the same size: 4 words, one header (or address) word and 3 data words. One word crosses one set of wires per clock cycle. All requests are ready at cycle 0, and a master sends its own requests in order. The panel on the right lists every packet: its latency (cycles until its last word arrives) and its wait (cycles lost to other masters). The summary under it keeps the result of each interconnect for the current traffic, so you can run the same traffic three times and compare.

The shared bus and its arbiter

A shared bus is one set of wires that every block taps into. Only one master may drive it at a time, or the signals would clash. An arbiter decides who goes next. This page uses round-robin: the arbiter keeps a pointer, grants the first requesting master at or after it, then moves the pointer just past the winner. So a master that was just served goes to the back of the line, and no one can starve.

A bus is cheap and simple, but it moves one transfer at a time, wherever the transfers go. Four requests to four different slaves take 4 × 4 = 16 cycles. CPU waits 0 cycles, DMA 4, GPU 8 and ACC 12 (Demo: shared bus, round-robin, 4 requests). The bus moves 1 word per cycle, and adding more masters only makes the line longer. A fixed-priority arbiter is simpler still, but a busy high-priority master can then shut out a low-priority one forever.

The crossbar

A crossbar gives every master its own row of wires and every slave its own column. At each of the 4 × 4 = 16 crossings sits a switch, the crosspoint. Closing the crosspoint at row CPU, column DRAM connects the CPU to the DRAM controller, while other crosspoints connect other pairs. Each slave port has its own arbiter, because the only conflict left is two masters that want the same slave.

With four different slaves, all four crosspoints close in the first slot and everything is done in 4 cycles: 4 words per cycle (Demo: crossbar, 4 different slaves at once). When CPU and GPU both want DRAM, DRAM's arbiter lets CPU go first and GPU goes in the next slot, so the run takes 8 cycles and GPU waits 4 (Demo: crossbar, two masters want DRAM). A master that loses also holds up its own later requests, even ones for a free slave. That is head-of-line blocking.

A network on chip: packets, flits, XY routing, wormhole

A network on chip (NoC) treats the chip like a tiny computer network. The chip is cut into tiles. Each tile has a router, and wires run only to the neighbouring routers. Here tile i sits at (x, y) = (i mod 2, i div 2) and holds master i and slave i: CPU and SRAM on tile 0, DMA and DRAM on tile 1, GPU and UART on tile 2, ACC and the timer on tile 3.

  • A transfer becomes a packet, cut into flits (flow-control units): a head flit H with the destination, body flits B1 and B2, and a tail flit T. Each flit is one word.
  • XY routing: a router first sends the head along x until the column is right, then along y. GPU at (0,1) to DRAM at (1,0) goes R2 → R3 → R1, 2 hops. The rule is fixed and needs no tables, and because a packet never turns from y back to x, packets cannot wait on each other in a circle (no deadlock).
  • Wormhole flow control: each link has room for one flit. The head reserves each link it enters, and the body follows. The reservation ends when the tail has passed. If the head must wait, the whole packet stops where it is, spread over several links like a worm. Coloured links on the canvas are reserved; a red outline and letter mark a flit that could not move in that cycle.

One flit crosses one link per cycle: the inject link from the master to its router, each router-to-router hop, and the eject link into the slave. The head arrives after hops + 2 cycles, and the 3 flits behind it arrive one per cycle after that. So a packet that meets no one has a zero-load latency of hops + 5 cycles: 5 on its own tile, 6 for one hop, 7 for two (Demo: NoC, XY routing corner to corner).

The hot spot at cycle 4. Router R1 has its eject link to DRAM reserved by DMA's packet, whose flits are entering DRAM. ACC's head flit waits on link R3 to R1 and its body flit B1 waits on the inject link from ACC; both are outlined in red. CPU's head waits on link R0 to R1 with B1 behind it. GPU's head waits on link R2 to R3, behind ACC's worm. A time line under it shows DRAM receiving DMA's packet in cycles 2 to 5, ACC's in 6 to 9, CPU's in 10 to 13 and GPU's in 14 to 17.
Hot spot, cycle 4: DMA's packet holds R1→DRAM, so the other worms stop in place, flits spread over the links behind their heads.

In Demo: NoC hot spot, wormhole stalls all four masters write to DRAM. DMA sits on DRAM's own tile, so its head asks first and takes the eject link R1→DRAM; its packet is done in cycle 5. CPU's and ACC's heads wait at R1, and GPU's head waits at R3 behind ACC's worm. When the link frees up, round-robin gives it to ACC (done at 9), then CPU (13), then GPU (17). Only one packet can enter DRAM at a time, so the NoC takes 17 cycles, no better than the bus.

Latency against throughput

Cycles to finish each traffic pattern on the page (all transfers are 4 words; in brackets, words per cycle):

TrafficShared busCrossbar 4×4NoC 2×2 mesh
one transfer, CPU → DRAM446
4 masters → 4 different slaves16 (1.00)4 (4.00)6 (2.67)
each master → slave on its own tile1645 (3.20)
corner to corner, 2 hops each1647 (2.29)
CPU and GPU both → DRAM168 (2.00)10 (1.60)
hot spot, all four → DRAM161617 (0.94)
stream, 4 different slaves × 348 (1.00)12 (4.00)14 (3.43)

Three things stand out. A single packet is slowest on the NoC, 6 cycles against 4, because every router hop costs a cycle (Demo: one transfer alone, bus then NoC). Many packets on different links move together, so the NoC beats the bus by far, and on a long stream the hop cost is paid only once at the start: 14 cycles for 48 words, close to the crossbar's 12 (Demo: the same stream on bus, crossbar, NoC). And no interconnect beats a busy slave: with all four masters on DRAM, all three need about 16 cycles.

What each one costs

With N masters and M slaves, and a NoC mesh of k × k tiles:

Shared busCrossbar2D mesh NoC
Wires1 shared setN rows + M columns4k(k − 1) router links, plus 2 per tile
Switching logic1 arbiter, 1 multiplexerN × M crosspoints, M arbitersk² routers with 5 ports and small buffers
Transfers at once1up to min(N, M)up to one per link
This page, 4 × 41 bus16 crosspoints4 routers, 8 links
64 × 641 bus, 64-way arbiter4096 crosspoints64 routers, 224 links
Longest wireacross the chipacross the chipto the next tile

A bus is the cheapest and is fine for a few slow blocks. A crossbar gives the most bandwidth, but its area grows with N × M and its long wires get slow. For dozens of blocks, a NoC grows by adding tiles, and its short wires keep the clock fast. That is why many-core chips use meshes. Real chips often mix the three: a crossbar or NoC for the CPU, GPU and memory, and a simple bus behind a bridge for the slow peripherals.

See also AMBA Buses for the AXI, AHB and APB signals of a single transfer, clock by clock, and Interconnect Topologies for rings, meshes, tori, hypercubes and fat trees that link whole computers. On a multicore chip the interconnect also carries cache-coherence messages, which is what makes the traffic on False Sharing and MESI costly. A DMA engine is one more master on the interconnect, as on the DMA page.

See also the asynchronous FIFO that carries data safely between blocks running on different clocks.

See also Data-Parallel Training, where link bandwidth between GPUs decides how fast a ring all-reduce or a parameter server can average gradients.

See also a FIR filter accelerator, a slave for the CPU's register writes and a master for its own DMA on the same interconnect.

What the page leaves out

  • Reads and responses: every transfer here is a write with no answer. A real read sends a request one way and the data back the other way, often over a second network.
  • Split transactions and outstanding requests, address decoding, bus bridges and clock-domain crossings.
  • Router pipelines of 2 to 5 cycles per hop, deeper buffers, credit-based flow control and virtual channels, which let a packet pass a blocked worm on the same link.
  • Store-and-forward and virtual cut-through switching, adaptive routing, larger meshes, rings and tori on chip.
  • Quality of service, weighted or priority arbitration, and the wire delay and power of each design.

On the mind map

Open the Computer Architecture mind mapComputerArchitectureAbstraction and numbers: layers and bit patternsAbstraction and numbersCombinational logic: output depends only on inputsCombinational logicSequential logic: state held by a clockSequential logicMIPS software: how C becomes machine wordsMIPS softwareThe processor: datapath plus controlThe processorPipelines and parallelism: more instructions at oncePipelines and parallelismMemory and I/O: small fast near, big slow farMemory and I/OMemory arraysMemory arraysdecoder picks wordline, bitlines readCPU cacheCPU cachetag, index, offset; hit or missCache address breakdownCache address breakdownsets = lines/ways; tag = rest of addressCache Write PoliciesCache Write PoliciesWrite-back sends dirty lines at evictionLoop tiling and interchangeLoop tiling and interchangeWalk rows; tile so reused data fitsMemory hierarchyMemory hierarchyAMAT = hit time + miss rate × penaltyDRAM timingDRAM timingopen row is fast, row change is slowMESI and false sharingMESI and false sharinga write invalidates other copiesVirtual memoryVirtual memoryTLB caches the page tableEmbedded I/OEmbedded I/Odevices are addresses; poll or interruptMCU startup to mainMCU startup to mainCopy .data, zero .bss, then mainButton debounce FSMButton debounce FSMTwo equal 10 ms samples = one pressI2C BusI2C BusWired-AND bus: ACK, stretch, arbitrateUSB enumerationUSB enumerationAddress 0, descriptors, SET_CONFIGURATIONCAN bus arbitrationCAN bus arbitrationDominant 0 wins: lowest ID sends unharmedModbus RTU and TCPModbus RTU and TCPone master asks; bad CRC means silenceTDMA time-triggered busTDMA time-triggered busFixed slots; FTA drops extremes, averagesAMBA AXI, AHB, APBAMBA AXI, AHB, APBVALID and READY both 1 on the edgePCIe TLPsPCIe TLPsRequests by address, completions by IDBus vs Crossbar vs NoCBus: one at a time; NoC: links in parallelADC and PWMADC and PWMSAR = binary search; duty = OC1RS/(PR2+1)PID ControlPID ControlI removes error; clamp stops windupOpen the Computer Architecture mind mapComputer Architecturesmall fast near, big slow farMemory and I/OMemory arraysMemory arraysdecoder picks wordline, bitlines readCPU cacheCPU cachetag, index, offset; hit or missCache address breakdownCache address breakdownsets = lines/ways; tag = rest of addressCache Write PoliciesCache Write PoliciesWrite-back sends dirty lines at evictionLoop tiling and interchangeLoop tiling and interchangeWalk rows; tile so reused data fitsMemory hierarchyMemory hierarchyAMAT = hit time + miss rate × penaltyDRAM timingDRAM timingopen row is fast, row change is slowMESI and false sharingMESI and false sharinga write invalidates other copiesVirtual memoryVirtual memoryTLB caches the page tableEmbedded I/OEmbedded I/Odevices are addresses; poll or interruptMCU startup to mainMCU startup to mainCopy .data, zero .bss, then mainButton debounce FSMButton debounce FSMTwo equal 10 ms samples = one pressI2C BusI2C BusWired-AND bus: ACK, stretch, arbitrateUSB enumerationUSB enumerationAddress 0, descriptors, SET_CONFIGURATIONCAN bus arbitrationCAN bus arbitrationDominant 0 wins: lowest ID sends unharmedModbus RTU and TCPModbus RTU and TCPone master asks; bad CRC means silenceTDMA time-triggered busTDMA time-triggered busFixed slots; FTA drops extremes, averagesAMBA AXI, AHB, APBAMBA AXI, AHB, APBVALID and READY both 1 on the edgePCIe TLPsPCIe TLPsRequests by address, completions by IDBus vs Crossbar vs NoCBus: one at a time; NoC: links in parallelADC and PWMADC and PWMSAR = binary search; duty = OC1RS/(PR2+1)PID ControlPID ControlI removes error; clamp stops windup
This page on the Computer Architecture mind map · 79 pages in 7 branches · open it to see the whole map and test yourself in recall mode.