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.

Five questions this page answers
Question
1Why does each core get a power switch of its own?
2A core must wake while its cluster is off. In what order do the two domains come up?
3One core goes idle. When may the cluster be switched off?
4Why does each step of a sequence wait for a report, and not for a fixed time?
5Core 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

New words on this page
WordMeaning
Domain treeThe power domains of a chip, drawn by who needs whom.
Parent domainThe domain that another domain needs in order to work. Parent for short.
Child domainA domain that hangs below a parent. It can be on only while its parent is on. Child for short.
Power domain of a coreA power domain that holds one core and its private caches.
Supply-good reportA signal from a power switch. It is 1 when the supply behind the switch has reached full voltage.
Power-down requestA request to the power controller to switch one domain off. The controller may refuse it.
Power chipA chip on the board that makes the supplies of the large chip. Engineers call it a PMIC, short for power management integrated circuit.
Inrush currentThe surge of current when a power switch closes on a domain that was empty of charge.

One Picture: The Domain Tree

The Domain Tree of ap_phoneStep through the picture. It starts at the domain that never goes off and adds one level at a time.
  • Pads
  • Power
  • Bus
  • Memory
  • Processor
  • Peripheral
The Domain Tree of ap_phoneStep through the picture. It starts at the domain that never goes off and adds one level at a time. component Power chip on the board; makesfour supplies component PD_AON always on: powercontroller, wakedetectors component PD_SYS network, memorycontroller,interrupts component PD_CLUSTER the shared L3 cache component PD_CORE0 core 0 behind its ownswitch component PD_CORE1 core 1 behind its ownswitch component PD_CORE2 toPD_CORE7 six more, each with aswitch component PD_MEDIA camera port andengines supplyparent ofparent ofparent ofparent ofparent ofparent of
  1. component Power chipon the board; makes four supplies
    • supply → PD_AON
  2. component PD_AONalways on: power controller, wake detectors
    • parent of → PD_SYS
  3. component PD_SYSnetwork, memory controller, interrupts
    • parent of → PD_CLUSTER
    • parent of → PD_MEDIA
  4. component PD_CLUSTERthe shared L3 cache
    • parent of → PD_CORE0
    • parent of → PD_CORE1
    • parent of → PD_CORE2 to PD_CORE7
  5. component PD_CORE0core 0 behind its own switch
  6. component PD_CORE1core 1 behind its own switch
  7. component PD_CORE2 to PD_CORE7six more, each with a switch
  8. component PD_MEDIAcamera port and engines
  1. 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.

  2. The system domain

    PD_SYS holds what every other block talks through. It is off only in the deepest mode of the chip.

  3. What the cores share

    The eight cores share one L3 cache. It sits in PD_CLUSTER, a domain of its own.

  4. A switch for each core

    Each core has its own power domain. An idle core can go off while its neighbours work.

  5. 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.

The wake of core 0 from standby, by hand
StepDomainTakesDone at
Close the switch, wait for the reportPD_CLUSTER33
ResetPD_CLUSTER14
Open the clampsPD_CLUSTER15
Close the switch, wait for the reportPD_CORE027
ResetPD_CORE018
Open the clampsPD_CORE019

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.

Who still needs the cluster
EventCores on afterwardsMay the cluster go off?
Core 0 goes off1No: core 1 still uses the shared cache
Core 1 goes off0Yes

The first row is where the update of the opening went wrong. Hold that thought until the traps.

The Rules

  1. Rule 1: A domain can be on only while its parent is on.

    What a child needs from its parent has no power otherwise.

  2. Rule 2: Power comes up from the root toward the leaf.

    The parent is on, reset and open before the child starts.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

Printed by the lab on Icarus. Each row is one step that the power controller has finished.
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 open

Rule 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

ChoiceThe alternativeIts cost
A switch for each coreOne switch for the whole clusterOne busy core keeps seven idle cores powered, and all of them leak.
The shared cache in a parent domainThe cache inside the domain of one coreThat core could never go off while any other core runs.
The controller counts the childrenEach core decides about the cluster by itselfA 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 reportSteps that wait a fixed timeA 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

ap_soc2 domains, 1 switch
ap_phone12 domains, 11 of them switched

This section looks ahead, to what a tree of twelve domains asks of the tools and of the people.

  1. 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.

  2. 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.

  3. 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.

  4. 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
NameMeaning
tThe time in ticks. A tick is a lab unit, not a clock period of the chip.
wakeA wake event for that core has reached the power controller.
supply goodThe power switch of that domain reports that its supply has reached full voltage.
reset doneThe domain has been reset.
clamps open, clamps closedThe isolation cells on the outputs of the domain pass its values, or hold them.
switch openThe power switch is open: the domain is off.
wake_timeThe ticks from the wake event until the core runs.
children_onHow 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.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: 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 open

Check Yourself

Predict the outputIn this run core 1 is woken first, then core 0. Core 0 is switched off and woken again while core 1 runs. What is the last line? Its form is: t=.. core0 runs wake_time=..
module tb;
  // A cut of the power tree of ap_phone: the system domain, the cluster, and two of its eight cores.
  localparam int SYS = 0, CLUSTER = 1, CORE0 = 2, CORE1 = 3;
  string name [4];
  int parent [4];        // the domain that feeds this one
  int switch_ticks [4];  // ticks from "close the switch" until the supply reports good
  bit on [4];
  int t = 0;

  function automatic int children_on(input int d);
    int n = 0;
    for (int c = 0; c < 4; c++) if (parent[c] == d && on[c]) n++;
    return n;
  endfunction

  // Up: the parent first. Then this domain: switch, reset, and only then open the clamps.
  task automatic power_up(input int d);
    if (!on[d]) begin
      power_up(parent[d]);
      t += switch_ticks[d];
      $display("t=%0d %s supply good", t, name[d]);
      t += 1;
      $display("t=%0d %s reset done", t, name[d]);
      t += 1;
      on[d] = 1;
      $display("t=%0d %s clamps open", t, name[d]);
    end
  endtask

  // Down: only when no child is on. Clamp first, then open the switch.
  task automatic power_down(input int d);
    if (children_on(d) != 0)
      $display("t=%0d %s down refused children_on=%0d", t, name[d], children_on(d));
    else begin
      t += 1;
      $display("t=%0d %s clamps closed", t, name[d]);
      t += 1;
      on[d] = 0;
      $display("t=%0d %s switch open", t, name[d]);
    end
  endtask

  task automatic wake(input int d);
    int start;
    start = t;
    $display("t=%0d wake %s", t, name[d]);
    power_up(d);
    $display("t=%0d %s runs wake_time=%0d", t, name[d], t - start);
  endtask

  initial begin
    name[SYS] = "sys";         parent[SYS] = -1;          switch_ticks[SYS] = 0;       on[SYS] = 1;
    name[CLUSTER] = "cluster"; parent[CLUSTER] = SYS;     switch_ticks[CLUSTER] = 3;
    name[CORE0] = "core0";     parent[CORE0] = CLUSTER;   switch_ticks[CORE0] = 2;
    name[CORE1] = "core1";     parent[CORE1] = CLUSTER;   switch_ticks[CORE1] = 2;
    wake(CORE1);
    wake(CORE0);
    power_down(CORE0);
    wake(CORE0);
  end
endmodule
ConceptWhy does each core get a power switch of its own?
ConceptA core must wake while its cluster is off. In what order do the domains come up?
ConceptOne core goes idle and is switched off. When may the cluster go off?
ConceptWhy does each step wait for a report and not for a fixed time?

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.

Practice

Report a problem with this page