From Microcontroller to Application Processor: What Changes at Scale
A phone chip has the same eight kinds of block as ap_soc. Each one has grown into a subsystem, and behind each growth stands one number that no longer fitted.
You Will Be Able To
- Say what each of the eight kinds of block becomes on a large chip.
- Work out, from one camera frame, the numbers that force the memory, the bus and the address to grow.
- Explain why connections grow faster than blocks, and what a subsystem costs.
- Lesson
- S10.1
- Time
- 25 min
- Runs on
- Your browser
- Check
- 5 questions
A small camera works on your bench. It raises one pin when a picture is ready, and ap_soc reads that pin.
Now the same idea must go into a phone, with a full picture thirty times a second. Nobody invents a new kind of block for that: every block you already know has to grow.
Before You Start
You need From Board to Chip: What an SoC Is, and Why: the eight kinds of block, and a microcontroller beside an application processor.
You need The Memory Map: regions, sizes and address bits.
You need Many Managers: Arbitration and the Bus Matrix: managers, subordinates and the bus matrix.
You need The Interrupt Controller: A PLIC: the source ID, and the value 0 for "no interrupt".
| Question | |
|---|---|
| 1 | Which kinds of block does a large chip have that ap_soc lacks? |
| 2 | Why can one camera frame not stay in the memory of ap_soc? |
| 3 | Why does a chip with 4 GiB of memory need more than 32 address bits? |
| 4 | Why do the connections grow faster than the blocks? |
| 5 | A frame grows to 3840 by 2160 pixels, and the memory to 8 GiB. What does the lab print last? |
The Idea: The Same Eight Boxes, Each Outgrown
A large chip is not a different kind of machine. It has a processor, memory, a bus, peripherals, clocks and reset, power control, debug and pads. Those are the eight kinds of block you met on ap_soc.
What changes is the load. A phone shows video, holds large programs and talks to fast devices. Each of those jobs can be written as a number. One is the bytes in a picture. Another is the bytes that arrive in one second.
Follow one such number, and it soon passes what a block of ap_soc can do. The memory is too small for one picture. The bus matrix has too many pairs to connect. The address has too few bits.
A block that is outgrown does not simply get larger. It becomes a subsystem: several blocks that do one job together, usually built by one team. The memory becomes a controller on the chip and a memory chip outside it. The bus matrix becomes a network.
So read a large chip with one question for each box. Which number grew, and what did the box turn into? This page asks that question eight times, and the rest of the module answers it in depth.
New Words
| Word | Meaning |
|---|---|
| Subsystem | Several blocks that do one job together, with a clear boundary around them. |
ap_phone | The large chip of this module. It is an exercise: nobody has built it, and every number of it was chosen for these lessons. |
| Pixel of a picture | One dot of a picture, pixel for short. On this page a pixel takes 2 bytes. |
| Video frame | One whole picture from a camera. This page says frame for short. |
| GiB | 1024 times 1024 times 1024 bytes. That is 2 to the power 30. |
| DRAM | A kind of RAM that packs many bits into little area. It comes as a chip of its own, outside the package. |
| Cluster of cores | A group of processor cores that work side by side and share a cache. This module says core cluster. |
| Router | A small block that takes a message in and passes it on to a neighbour. |
| Network on chip | Routers joined by short links, in place of one large bus matrix. |
| Compute engine | A block that does one kind of heavy sum, such as picture work, faster than a core can. |
One Picture: One Frame on a Large Chip
- Pads
- Bus
- Memory
- Processor
- Peripheral
- Clock / reset
- Debug
- A frame arrives
A camera sends one frame after another. On ap_soc a pin said that a frame was ready. Here the bytes themselves come in.
- Memory leaves the chip
One frame is larger than all the memory of ap_soc. So the memory becomes a DRAM outside the package, with a controller on the chip.
- The bus becomes a network
Many blocks now want that memory. One bus matrix would need a path for every pair, so routers with short links take its place.
- One core becomes a cluster
A frame must be worked on before the next one comes. Eight cores share the work, and engines take the heaviest sums.
- The quiet blocks grow too
More blocks need more clocks, more power domains and more to watch. Nothing here is a new kind of block.
Read the diagram as text
- Camera port: fast pins: 124 million bytes arrive each second
- Network: 9 routers in place of one bus matrix
- Memory controller: decides when each read and write goes out
- DRAM: a memory chip outside the package: 4 GiB
- Core cluster: 8 cores in place of 1
- Compute engines: blocks that do picture sums faster than a core
- Clocks and power: 6 PLLs and 12 power domains, in place of 1 and 2
- Debug and trace: 8 harts to halt and to watch
- Camera port → Network: frame
- Network → Memory controller: write
- Memory controller → DRAM: memory pins
- Core cluster → Network: request
- Compute engines → Network: request
The exercise chip ap_phone, drawn by kind of block. Its numbers are chosen for this module and describe no real chip.
The Smallest Example, Worked by Hand
No simulator yet. Put a small camera on ap_soc. Its picture is 320 pixels wide and 240 high, and 15 frames arrive each second. Then ask four questions, each with one sum.
| Question | Sum | Result | Verdict |
|---|---|---|---|
| How large is one frame? | 320 × 240 × 2 | 153,600 bytes | The SRAM holds 65,536 bytes. The frame does not fit. |
| How many bytes arrive each second? | 153,600 × 15 | 2,304,000 bytes | About 35 times the whole SRAM, every second. |
| How many pairs must the bus connect? | 3 managers × 5 subordinates | 15 pairs | Few enough for one bus matrix. |
| How many bits does a source ID need? | 16 sources and the value 0: 17 values | 5 bits | 4 bits give only 16 values. |
| How many address bits does the memory use? | 65,536 is 2 to the power 16 | 16 of 32 bits | 16 bits are left for everything else. |
The managers are the processor, the debug module and the DMA. The subordinates on the fast bus are the boot ROM, ap_clint, ap_plic, the bridge and the SRAM.
Read the first verdict again. Even this small camera breaks the memory of ap_soc. The chip can still see that a frame is ready. It cannot keep the frame.
The other sums pass with room to spare. That is what makes a microcontroller simple: every number fits inside its block.
The Rules
Rule 1: The eight kinds of block stay.
A large chip adds no ninth kind. Each kind becomes one subsystem, or several.
Rule 2: A block grows when a number outgrows it.
Name the number before you draw the new block: bytes, bytes each second, pairs or sources.
Rule 3: Pairs grow as a product.
M managers and S subordinates give M times S pairs. Double both, and the pairs become four times as many.
Rule 4: An identifier needs enough bits for every value.
Count the values, with any that are kept aside. Then take the smallest power of two that reaches the count.
Rule 5: Memory uses address bits.
A memory of 2 to the power n bytes uses n address bits. The map needs more bits than that, for everything else.
Rule 6: A subsystem has a boundary, and a boundary needs an agreement.
Write down who owns each number that crosses it. Count a shared block once.
Sources for These Rules
A microcontroller beside the SoC of a small computer board: Harris and Harris, Digital Design and Computer Architecture, ARM edition, section 9.3.
DRAM needs one transistor for each bit and is denser and cheaper than SRAM: Patterson and Hennessy, Computer Organization and Design, ARM edition, section 5.2.
Rules 3 to 5 are arithmetic. The values of ap_soc come from its memory map, version 1.0, and from its interrupt controller.
Every value of ap_phone is chosen for this module. It describes no real chip.
Rule 6 is engineering practice, and has no single source.
Now Run It
The lab at the end of this page is a sheet of sums. It repeats the hand example for ap_soc, and then asks the same questions of ap_phone. That chip has 8 cores, 4 GiB of DRAM, 24 managers, 40 subordinates and 240 interrupt sources. Its camera sends 1920 by 1080 pixels, 30 times a second.
ap_phone frame_bytes=4147200 memory_bytes=4294967296 fits=1 bytes_per_s=124416000
ap_phone managers=24 subordinates=40 pairs=960
ap_phone sources=240 id_bits=8
ap_phone memory_bits=32 address_bits=40 bits_left=8Rule 2 at work, in the first row. One frame is 4,147,200 bytes, more than 63 times the whole SRAM of ap_soc. In 4 GiB it fits, so the row says fits=1.
The same row gives the load: 124,416,000 bytes each second, from the camera alone. The lesson on the memory subsystem starts from that number.
Rule 3, in the second row. The blocks on the bus grew from 8 to 64, a factor of 8. The pairs grew from 15 to 960, a factor of 64.
Rule 4, in the third row. 240 sources and the value 0 make 241 values, and 8 bits give 256.
Rule 5, in the last row. The memory alone uses 32 address bits. Set ADDRESS_BITS to 32 and that row ends with bits_left=0: nothing is left for a single device. So ap_phone has an address of 40 bits.
This lab is a sheet of sums, not a circuit. No lab in this track builds ap_phone. Each lesson that follows builds one small piece of it.
What Each Box Becomes
| Kind of block | On ap_soc | On ap_phone | The number that grew |
|---|---|---|---|
| Processor | One hart | A core cluster of 8 cores, with caches | Work to finish before the next frame |
| Memory | 4 KiB of ROM and 64 KiB of SRAM | 4 GiB of DRAM, behind a controller | Bytes in a frame, and bytes each second |
| Bus | One bus matrix and a bridge | A network on chip of 9 routers | Pairs: 15 against 960 |
| Peripherals | Seven slow devices behind the bridge | Fast ports and compute engines | Bytes each second for one device |
| Clocks and reset | Two oscillators and one PLL | 6 PLLs | Clock rates that differ from block to block |
| Power | 2 power domains | 12 power domains | Parts that must sleep while others run |
| Debug | One hart behind one TAP | 8 harts, and trace from each | Harts to halt together |
| Pads | A pin mux and slow pins | Fast lanes for memory, camera and display | Bits each second on one pin |
Every value in the third column is an exercise value.
Each row is a lesson of this module, or several. The processor row continues in The Cache Hierarchy of a Core Cluster. The bus row continues in The Network-on-Chip, and the memory row in The Memory Subsystem.
Peripherals and pads continue in High-Speed I/O Subsystems and Heterogeneous Compute. The last three rows are clocks, power and debug. Clocks: Clocking at Scale. Power: Power Domains at Scale and Power at Scale. Debug: Debug at Scale and Trace at Scale.
Why It Is Built This Way
| Choice | The alternative | Its cost |
|---|---|---|
| Memory as a DRAM outside the package | 4 GiB of SRAM on the chip | SRAM needs several transistors for each bit. The memory would be far larger than the rest of the chip. |
| A network of routers | One bus matrix with 960 pairs | Every pair is a path with long wires, and every new block adds a row or a column of them. |
| Subsystems with boundaries | One flat list of hundreds of blocks | No single team can hold it. But every boundary is a place where two teams can disagree. |
The last row is the price of scale. A subsystem lets one team finish its part alone. The chip works only if the parts agree where they meet.
The Trap: Two Teams, One Number
The camera team numbers its interrupt sources from 0. The team of the interrupt controller keeps 0 for "no interrupt". Both blocks pass their own tests.
On the first joint run, the first frame wakes nobody. Its source has the one number that is never delivered. No block is wrong. The agreement of rule 6 was never written down.
The second trap is the block that is counted three times. Three camera units each list the shared hub in their own inventory. The sum says three hubs, and the chip has one.
The third trap is on your bench. Reading the pin proved that a frame was ready. It never proved that a frame was stored, and on ap_soc no frame could be.
At Scale
This section looks ahead, past the edge of one chip and past one team.
More than one piece of silicon
A package can hold several pieces of silicon, called chiplets, side by side or stacked. Then a boundary between subsystems can also be a boundary between two of them.
One description, many outputs
With hundreds of blocks nobody wires the top level by hand. Tools write the connections from one description that every team shares.
Who may reach what
More managers mean more routes to every asset. A large chip filters the accesses of its devices, and keeps part of itself for trusted code only.
The first two continue in How Hundreds of IP Blocks Are Integrated and I/O Memory Management and Virtualisation. The third continues there too, in The Secure World and in The Multi-Stage Secure Boot Chain.
The Drawing for the First Worksheet
- Pads
- Peripheral
- Bus
- Memory
- Processor
- Sensor pads
Camera samples enter here.
- Capture DMA
Writes one completed frame and raises an event.
- System fabric
Routes requests to the memory subsystem.
- DRAM port
Owns the frame buffer.
- Event router
Routes capture completion to the assigned core.
- Core cluster
Runs the handler that consumes the notification.
- Display engine
Reads a buffer and emits scanned pixels.
- Panel pads
Drive the scanned pixels off chip.
Read the diagram as text
- Sensor pads: Camera samples enter here.
- Capture DMA: Writes one completed frame and raises an event.
- System fabric: Routes requests to the memory subsystem.
- DRAM port: Owns the frame buffer.
- Event router: Routes capture completion to the assigned core.
- Core cluster: Runs the handler that consumes the notification.
- Display engine: Reads a buffer and emits scanned pixels.
- Panel pads: Drive the scanned pixels off chip.
- Sensor pads → Capture DMA: samples
- Capture DMA → System fabric: buffer write
- System fabric → DRAM port: memory request
- Capture DMA → Event router: done
- Event router → Core cluster: service
- Display engine → System fabric: buffer read
- Display engine → Panel pads: pixels
Phone exercise topology. Only the displayed connections are in scope.
Try It
Run the sheet. The first four rows are the hand example. Check each against your own sums.
Set ADDRESS_BITS to 32. Which row changes, and what does it say about the memory map?
Set FRAME_W to 640 and FRAME_H to 480. By what factor does frame_bytes of ap_phone fall?
Names Printed by the Lab
| Name | Meaning |
|---|---|
| frame_bytes | The size of one frame: width times height times 2 bytes for each pixel. |
| memory_bytes | The largest memory of the chip: the SRAM of ap_soc, the DRAM of ap_phone. |
| fits | 1 when one frame fits in that memory, 0 when it does not. |
| bytes_per_s | The bytes that the camera sends in one second. |
| pairs | Managers times subordinates: the paths that one bus matrix would need. |
| id_bits | The bits of a source ID. One value more than the sources, because 0 means "none". |
| memory_bits | The address bits that the memory uses by itself. |
| bits_left | The address bits that remain to tell the memory from everything else. |
ap_soc frame_bytes=153600 memory_bytes=65536 fits=0 bytes_per_s=2304000 ap_soc managers=3 subordinates=5 pairs=15 ap_soc sources=16 id_bits=5 ap_soc memory_bits=16 address_bits=32 bits_left=16 ap_phone frame_bytes=4147200 memory_bytes=4294967296 fits=1 bytes_per_s=124416000 ap_phone managers=24 subordinates=40 pairs=960 ap_phone sources=240 id_bits=8 ap_phone memory_bits=32 address_bits=40 bits_left=8Check Yourself
Common Mistakes
Wrong Look for a new kind of block on a large chip.
There is none. The eight kinds stay.
Fix Ask what each kind became, and which number forced it.
Wrong Count a shared block once for each of its users.
All users reach the same instance.
Fix Count what is copied, then add each shared block once.
Wrong Read a ready bit as a stored frame.
The bit reports one pin.
Fix Follow the bytes of the frame to the memory that holds them.
Remember
- A large chip has the same eight kinds of block. Each became a subsystem.
- A block grows when a number outgrows it: bytes, bytes each second, pairs, sources or address bits.
- Pairs grow as a product, so connections grow faster than blocks.
- Every boundary between subsystems needs a written agreement.