Inside one chip,
a whole city
一颗芯片里面,
像一座城

No hardware background needed. This page covers the layout, the wiring, and which parts get to sleep. 不需要硬件基础。这一页讲它们怎么排、怎么连、哪些能单独睡觉。

一片硅,分成几个区 one die, a few districts 一粒米 a grain of rice
This piece of silicon is about 5 mm across. That is close to the rice grain beside it, drawn to the same scale. Four districts, one street. Violet is the block being accessed right now, and it means that all through this page. 这片硅大约 5 毫米见方,和旁边那粒米差不多长。米是按同一个比例画的。上面四个区,中间一条街。紫色是这一刻正在被访问的那一块,全页的紫都是这个意思。

What is inside one chip? 一颗芯片里面有什么?

SoC 片上系统SoC processor, memory and the small parts around them, on one piece of silicon 把处理器、内存和外设(各管一件具体事的小部件)做进同一片硅里

In a city the hall decides, the main street carries goods, branch offices each handle one thing. One chip holds the same three. 一座城里,市政府拍板,主干道运货,各个办事处各管一摊。一颗芯片里也是这三样。

It's like…就像……

A city. The hall sits on the main street, the offices line it, and everything moves along that street. 一座城。市政府在主干道边上拍板,办事处沿街办事,货都走那条街。

市政府 city hall 主干道 main street 办事处 branch office CPU 串口 serial port 计时器 timer
Three dashed pairs: hall to processor, main street to street, office to peripheral. Violet marks the same block on both sides. Two peripherals here; a real chip has a dozen, and memory joins next screen. 三条虚线,三对东西。市政府对处理器、主干道对中间那条街、办事处对外设。两边的紫色标的是同一块。这里只画两个外设,真芯片里有十几个,内存下一屏才来。

Why not wire every pair? 为什么不给每对都拉一根线?

总线 busbus one shared path, taken in turns 一条大家共用的通路,轮着用

Wiring five blocks in pairs takes ten runs. One street, one stub each. 5 个模块两两拉线,要 10 条通路。改成一条街,每块只接一条支线。

写下去 writes go down 读上来 reads come up CPU DMA RAM UART SPI 人人直连 wire every pair 一条街 one street
One shared bus, the single-layer AHB kind. One transfer at a time, so two masters queue and an arbiter picks who goes. A modern SoC's fabric is usually a crossbar, a grid of streets where several pairs move at once. That limit is this drawing's, not every chip's. Top row starts transfers, bottom row answers. DMA does both. It is a master when it moves data, and a slave through its own configuration registers. RAM is memory, UART and SPI are serial ports. 这条街是一条共享总线,AHB 那样的单层总线。一次只成交一笔,两个主设备得排队。谁先走由一个仲裁器决定。现代 SoC 的主干多是交叉开关,也就是几条街织成的网格。几对可以同时走。所以「一次一笔」是这张图的性质,不是每颗芯片的。上排自己发起传输(主设备),下排被点到才回话(从设备)。DMA 两头都算。搬数据时它是主设备,它自己那组配置寄存器又让它也是从设备。RAM 是内存,UART 和 SPI 是两种串口。

How are memory and peripherals told apart? 内存和外设怎么分得开?

地址 addressaddress the house number of every byte on the chip 芯片里每个字节的门牌号,处理器靠它找东西

Memory and peripherals share one street of numbers, one range each. 内存和外设住在同一条号码街上,各占一段号段。

地址往上递增 addresses increase upward 空号段 nothing here UART 0x5000_0000 0x4000_0000 0x2000_0000 0x0000_0000 读写内存 memory 程序放这儿 program lives here CPU
Low addresses at the foot, rising up: 0x0000_0000 at the bottom, the top range at 0x5000_0000. Not to scale — big unmapped gaps sit between ranges. UART gets 4 KB from 0x4000_0000, room for 1024 registers where a serial port needs dozens. Nothing sits behind the top range, so an access there faults. Overlaps are a configuration error, bar deliberate mirroring or a boot remap. 低地址在下、往上递增:最下面 0x0000_0000,最上面那段起于 0x5000_0000。没按比例画——段与段之间还有大片空号。UART 分到 0x4000_0000 起的 4 KB,能排下 1024 个 32 位寄存器,而一个串口用不到几十个。最上面那段后面没接东西,访问它会出错。号段重叠是配置错误,例外只有刻意的镜像和启动时的重映射。

Which regions can sleep on their own? 哪些区能单独睡觉?

时钟域 / 电源域clock / power domain a region on one clock / a region on one supply 共用一个钟的区域 / 共用一路电的区域

A region can stop its own clock, or cut its own power and forget everything. 各区能自己停钟,也能自己断电——断了电,连记住的都没了。

这一区睡着了 this region is asleep 常醒的一区 always awake CPU RAM 100 MHz 32.768 kHz 同步 sync 叫醒 wake it up
Two domains, dashed edges. The left one sleeps. Its clock stopped and the 100 MHz trace is flat. The street's line breaks at the boundary — no power, no signal. The right runs on a 32.768 kHz crystal — the one in a wristwatch — three thousand times slower. Its alarm pushes the switch that returns power. That crossing spans two clocks, so a synchronizer holds the signal a beat. 两块极浅的底色是两个域,虚线是边界。左边睡着了:钟停了,100 MHz 那条线是平的。街上那条路断在边界前——断了电就不该还在发信号。右边那颗 32.768 kHz 晶振,就是石英手表里走秒的那一颗,慢约三千倍。它到点了推一下总开关,电就回来。这一跨跨了两个钟,所以边界上放了个同步块,让信号停一拍。