Power Domains at Scale: The Domain Tree, Gating and Sequencing
A large chip has a power domain for every block that can rest alone. The domains form a tree, and the tree fixes the order of every change.
You Will Be Able To
- Draw the power domains of a large chip as a tree, and name the parent of each.
- Give the order in which domains come up for a wake, and add up the wake time.
- Say when a parent domain may be switched off, and who decides.
- Lesson
- S10.16
- Time
- 25 min
- Runs on
- Your browser
- Check
- 5 questions
A phone lies in a pocket. Every few seconds one core wakes, looks for new mail and goes back to rest.
One night an update changes how idle cores are switched off. In the morning the battery is at half, and one phone in fifty has restarted by itself.
Before You Start
You need Power at Chip Level: a power domain, its power switch, its isolation cells and the order down and up.
You need Power Modes and the Energy of a Sleep: power modes, wake time and the wake deadline.
You need The Cache Hierarchy of a Core Cluster: a cluster of cores that share one L3 cache.
| Question | |
|---|---|
| 1 | Why does each core get a power switch of its own? |
| 2 | A core must wake while its cluster is off. In what order do the two domains come up? |
| 3 | One core goes idle. When may the cluster be switched off? |
| 4 | Why does each step of a sequence wait for a report, and not for a fixed time? |
| 5 | Core 0 goes off and wakes again while core 1 runs. What wake time does the lab print? |
The Idea: Domains Form a Tree
On ap_soc there were two power domains, and one of them never went off. That was enough for one processor. A phone has eight cores, and most of the time most of them have nothing to do.
An idle core still leaks. So each core gets a power domain and a switch of its own. One core can then check the mail while seven are off.
But the cores are not alone. All eight share one L3 cache. If that cache sat inside the domain of core 0, switching core 0 off would take the cache away from the others. So what is shared goes into a domain of its own, one level up.
Now the domains have an order. A core is of use only while the shared cache has power. The cache is of use only while the network of the chip has power. Draw that, and you get a tree: each domain hangs below the domain that it needs.
The tree fixes every sequence. Power comes up from the root toward the leaf. It goes down from the leaf toward the root. And a domain in the middle may go off only when nothing below it is still on.
One more thing changes with size. A wake is no longer one switch. It is a row of steps through several domains, and each step takes time. The deeper the chip sleeps, the longer its wake.
New Words
| Word | Meaning |
|---|---|
| Domain tree | The power domains of a chip, drawn by who needs whom. |
| Parent domain | The domain that another domain needs in order to work. Parent for short. |
| Child domain | A domain that hangs below a parent. It can be on only while its parent is on. Child for short. |
| Power domain of a core | A power domain that holds one core and its private caches. |
| Supply-good report | A signal from a power switch. It is 1 when the supply behind the switch has reached full voltage. |
| Power-down request | A request to the power controller to switch one domain off. The controller may refuse it. |
| Power chip | A chip on the board that makes the supplies of the large chip. Engineers call it a PMIC, short for power management integrated circuit. |
| Inrush current | The surge of current when a power switch closes on a domain that was empty of charge. |
One Picture: The Domain Tree
- Pads
- Power
- Bus
- Memory
- Processor
- Peripheral
- The root
PD_AON has power for as long as the phone has a battery. The power controller lives here, so it can switch everything else.
- The system domain
PD_SYS holds what every other block talks through. It is off only in the deepest mode of the chip.
- What the cores share
The eight cores share one L3 cache. It sits in PD_CLUSTER, a domain of its own.
- A switch for each core
Each core has its own power domain. An idle core can go off while its neighbours work.
- The whole tree
PD_MEDIA hangs beside the cluster. That makes 12 domains. Every arrow reads: the domain at its tail must be on first.
Read the diagram as text
- Power chip: on the board; makes four supplies
- PD_AON: always on: power controller, wake detectors
- PD_SYS: network, memory controller, interrupts
- PD_CLUSTER: the shared L3 cache
- PD_CORE0: core 0 behind its own switch
- PD_CORE1: core 1 behind its own switch
- PD_CORE2 to PD_CORE7: six more, each with a switch
- PD_MEDIA: camera port and engines
- Power chip → PD_AON: supply
- PD_AON → PD_SYS: parent of
- PD_SYS → PD_CLUSTER: parent of
- PD_CLUSTER → PD_CORE0: parent of
- PD_CLUSTER → PD_CORE1: parent of
- PD_CLUSTER → PD_CORE2 to PD_CORE7: parent of
- PD_SYS → PD_MEDIA: parent of
The twelve domains of the exercise chip ap_phone. PD is short for power domain. The lab of this page uses the system domain, the cluster and two of the cores.
The power-intent file of such a chip states the same tree, domain by domain. This page does not teach that format. The Low Power track does, in Power Domains and Hierarchical UPF.
The Smallest Example, Worked by Hand
No simulator yet. The chip is in its standby mode: PD_SYS is on, the cluster and all cores are off. A timer says that it is time to look for mail, and core 0 must wake.
Each domain comes up in three steps, as on the small chip. Close the switch and wait for the supply, reset, then open the clamps. The times are lab values, in ticks.
| Step | Domain | Takes | Done at |
|---|---|---|---|
| Close the switch, wait for the report | PD_CLUSTER | 3 | 3 |
| Reset | PD_CLUSTER | 1 | 4 |
| Open the clamps | PD_CLUSTER | 1 | 5 |
| Close the switch, wait for the report | PD_CORE0 | 2 | 7 |
| Reset | PD_CORE0 | 1 | 8 |
| Open the clamps | PD_CORE0 | 1 | 9 |
The wake time is 9 ticks: 5 for the parent and 4 for the core. Now a second core is needed. The cluster is on already, so core 1 pays only for itself: 4 ticks.
Then the work is done, and the domains go off again. Count who still needs the cluster at each moment.
| Event | Cores on afterwards | May the cluster go off? |
|---|---|---|
| Core 0 goes off | 1 | No: core 1 still uses the shared cache |
| Core 1 goes off | 0 | Yes |
The first row is where the update of the opening went wrong. Hold that thought until the traps.
The Rules
Rule 1: A domain can be on only while its parent is on.
What a child needs from its parent has no power otherwise.
Rule 2: Power comes up from the root toward the leaf.
The parent is on, reset and open before the child starts.
Rule 3: Power goes down from the leaf toward the root.
A parent is switched off only when no child is on. A power-down request that comes earlier is refused.
Rule 4: Inside one domain the order of the small chip holds.
Up: switch, reset, open the clamps. Down: close the clamps, open the switch.
Rule 5: Each step waits for a report, not for a fixed time.
The reset starts when the supply-good report is 1, however long that took.
Rule 6: The wake time is the sum of the steps of every domain that was off on the way.
So the same core has several wake times, one for each mode of the chip.
Sources for These Rules
Rule 4 repeats the rules of the earlier lesson on power at chip level. Its book source is there: Weste and Harris, CMOS VLSI Design, fourth edition, section 5.3.2.
Rules 1 to 3 and rule 6 follow from the tree. A tree of domains with a switch for each core is common practice in large chips. It is not a rule of any standard.
Rule 5, a controller that asks and a block that reports back: Arm AMBA Low Power Interface Specification, IHI 0068 issue D, section 2.1.2. That section is about one request and its answer. The supply-good report of a switch is common practice, not checked against a source.
Every time on this page is a lab value.
Now Run It
The lab at the end of this page plays the two wakes of the hand tables. Then it switches the domains off again, with one request that comes too early.
t=0 wake core0
t=3 cluster supply good
t=4 cluster reset done
t=5 cluster clamps open
t=7 core0 supply good
t=8 core0 reset done
t=9 core0 clamps open
t=9 core0 runs wake_time=9
t=9 wake core1
t=11 core1 supply good
t=12 core1 reset done
t=13 core1 clamps open
t=13 core1 runs wake_time=4
t=14 core0 clamps closed
t=15 core0 switch open
t=15 cluster down refused children_on=1
t=16 core1 clamps closed
t=17 core1 switch open
t=18 cluster clamps closed
t=19 cluster switch openRule 2 at work, in the first eight rows. Nothing of core0 moves until the cluster has opened its clamps, at t=5. Then the core takes its own three steps.
Rule 6, in the two rows that end in wake_time. Core 0 paid 9 ticks, core 1 only 4. The cluster was on by then.
Rule 3, in the row at t=15. Core 0 has just gone off, and somebody asks for the cluster to go down. The row says refused, with children_on=1: core 1 is still on.
Rule 3 again, in the last four rows. Only after the switch of core1 is open does the cluster close its clamps and open its switch.
Rule 4 shows in the order of the rows of every domain. Up: supply, reset, clamps. Down: clamps, then the switch.
This lab leaves things out. It is test code: no supply rises, no value is lost, and a report is a count of ticks. It has two of the eight cores.
Why It Is Built This Way
| Choice | The alternative | Its cost |
|---|---|---|
| A switch for each core | One switch for the whole cluster | One busy core keeps seven idle cores powered, and all of them leak. |
| The shared cache in a parent domain | The cache inside the domain of one core | That core could never go off while any other core runs. |
| The controller counts the children | Each core decides about the cluster by itself | A core that goes idle cannot know who else still runs. One wrong guess takes the cache from a running core. |
| Steps that wait for a report | Steps that wait a fixed time | A supply rises slowly when it is cold or heavily loaded. A fixed wait is then too short, or it is too long on every other day. |
The price of the tree is latency. Every level adds its steps to a wake that starts from the deepest mode. That is why a chip has several modes, and why software picks one by the length of the idle gap.
The Trap: The Phone That Restarted in the Night
Back to the update. Its author wanted to save power. When a core went idle, the new code switched it off. Then it asked for the cluster to go down as well. On his desk, with one core in use, that was always right.
In the pocket, two cores were sometimes awake at once. Core 0 finished and took the cluster with it. Core 1 lost the shared cache in the middle of its work, and the phone restarted. A controller that follows rule 3 would have answered with the refusal of the lab.
The battery tells the second story. Where the cluster did stay on, core 0 was woken every few seconds and paid for a full wake each time. Rule 6 says what that costs. Whether so short a rest pays at all is the break-even sum of the lesson on power modes.
A third trap waits on the way up. Close the switches of eight cores at once, and the inrush current pulls the shared supply down. The cores that already run can lose values. So a controller closes the switches one after another.
At Scale
This section looks ahead, to what a tree of twelve domains asks of the tools and of the people.
Patterns that are allowed
Eleven switched domains have 2,048 patterns of on and off. The tree of this chip allows 515 of them. A power-intent file lists the allowed ones as power states, and tools check each.
State that must survive
A core that goes off loses its registers. Either software saves them first, or special flip-flops keep them. Retention is taught in the Low Power track.
Clamps at every level
Each arrow of the tree is a boundary with isolation cells on it. Which wires get a cell, and on whose supply, is the subject of Which Crossings Get Cells.
The supply is shared
The cluster and its cores hang on one supply from the power chip. Its voltage is one more thing they must agree on, and the next lesson is about it.
Try It
Run the lab. Find the two wake times, and say why they differ.
Swap the third and the fourth step of the run, so that the cluster is asked to go down first. Predict what the lab prints for it.
Change the 3 in the switch time of the cluster to 6. Predict both wake times before you run.
Names Printed by the Lab
| Name | Meaning |
|---|---|
| t | The time in ticks. A tick is a lab unit, not a clock period of the chip. |
| wake | A wake event for that core has reached the power controller. |
| supply good | The power switch of that domain reports that its supply has reached full voltage. |
| reset done | The domain has been reset. |
| clamps open, clamps closed | The isolation cells on the outputs of the domain pass its values, or hold them. |
| switch open | The power switch is open: the domain is off. |
| wake_time | The ticks from the wake event until the core runs. |
| children_on | How many child domains are on at this moment. |
Sources and What the Lab Leaves Out
The lab is test code with no circuit. Each domain is one bit, and each step is a count of ticks.
It has no supply, so no voltage rises. A report arrives after a fixed count that stands for the real delay.
It keeps no values, so it cannot show what a domain loses. It has two cores of the eight, and PD_SYS stays on.
t=0 wake core0 t=3 cluster supply good t=4 cluster reset done t=5 cluster clamps open t=7 core0 supply good t=8 core0 reset done t=9 core0 clamps open t=9 core0 runs wake_time=9 t=9 wake core1 t=11 core1 supply good t=12 core1 reset done t=13 core1 clamps open t=13 core1 runs wake_time=4 t=14 core0 clamps closed t=15 core0 switch open t=15 cluster down refused children_on=1 t=16 core1 clamps closed t=17 core1 switch open t=18 cluster clamps closed t=19 cluster switch openCheck Yourself
Common Mistakes
Wrong Switch a parent domain off when one of its children goes idle.
Another child may still be on and still need it.
Fix Let the controller count the children that are on, and refuse while the count is not 0.
Wrong Quote one wake time for a core.
The wake costs the steps of every domain that was off on the way.
Fix Give a wake time for each mode of the chip.
Wrong Start the reset a fixed time after the switch closes.
The supply may need longer on a cold or loaded chip.
Fix Wait for the supply-good report.
Remember
- Power domains form a tree. A child can be on only while its parent is on.
- Up runs from the root to the leaf. Down runs from the leaf to the root.
- A parent goes off only when no child is on. The power controller counts them.
- A wake costs the steps of every domain that was off on the way.