The Power-Up Sequence
Power comes up, and for a short while nothing on the chip can be trusted. Every earlier page of this module gave one part its start. This page puts the starts in order.
You Will Be Able To
- Put the stages of a power-up in order, and say what each one waits for.
- Explain why a boot strap is sampled once and stored.
- Use the first fetch, its address and its response, to find a wait that was skipped.
- Lesson
- S5.9
- Time
- 24 min
- Runs on
- Your browser
- Check
- 6 questions
Two boards of one design are powered up. One prints its banner and the other stays silent. A capture shows the same first address on both: zero, as it should be. What else is there to look at?
Before You Start
You need Clock Sources and the Chip-Level Clock Tree: the oscillator, the PLL and lock. This page uses them and does not explain them again.
You need Reset Architecture: to release a reset. How each release is made safe for its clock is there, and in the page after it. This page is about the order only.
You need Reset and Interrupts in One Picture: after reset the processor fetches its first instruction from the reset address.
| Question | |
|---|---|
| 1 | Why does each stage wait for a ready signal and not for a fixed time? |
| 2 | Which block is released last, and why? |
| 3 | What is a boot strap, and why is it sampled only once? |
| 4 | The sequencer releases the processor before the ROM is ready. What does the first fetch return? |
| 5 | The first fetch shows the right address. What else must be checked? |
The Idea: Each Stage Waits for the One Before
At power-up everything on a chip depends on something else. The clock needs a steady supply. The PLL needs a running oscillator. The memory needs a clock and a moment to start. The processor needs a memory that can answer.
So a chip starts in stages. A small always-on block, the sequencer, takes one step at a time. After each step it waits for a signal that says "this stage is ready". Only then does it take the next step.
The easy mistake is to wait for a time in place of a signal. A crystal that starts in a millisecond on the bench may need five in the cold. A fixed delay is right until the day it is not. A ready signal is right by construction.
The last stage is the processor. Once released, it does one thing at once: it fetches its first instruction. If the memory behind that address is not ready, the fetch fails. The chip is dead before it has run one instruction. So the block that asks is released after every block that must answer.
One small thing sits in the middle of the sequence. Many chips can start from more than one place. A pin, the boot strap, chooses. The sequencer reads it once, at a moment when it can be trusted, and stores the answer.
New Words
| Word | Meaning |
|---|---|
| Power-up sequence | The ordered steps from "power applied" to the first instruction. |
| Sequencer | The always-on logic that takes those steps, one at a time. |
| Supply supervisor | A circuit that watches the supply voltage and reports when it is good. |
| Ready signal of a stage | A signal by which a stage says: I have started, you may use me. |
| Boot strap | A pin that the board ties high or low to choose a start-up option. |
| Strap sample | The one moment at which the sequencer reads the strap and stores its value. |
| ROM warm-up | The clock edges that our boot ROM needs after its release before it can answer. |
One Picture: The Chain of Waits
- Power
- Clock / reset
- Pads
- Memory
- Processor
- Wait for the supply
While the supply rises, nothing can be trusted. A supervisor watches it and raises "supply good". Until then the sequencer holds every output at 0.
- Start the clock, and wait
The sequencer asks the oscillator to start and waits for "ready". Then it starts the PLL and waits for lock. A request is not a result.
- Sample the strap, once
With a good clock, the sequencer reads the boot strap and stores the answer. From here on, the pin may do anything.
- Release what will answer
The bus and the boot ROM leave reset first. The ROM needs a few edges to start, and says so with "ROM ready".
- Release what will ask, last
Only when the ROM is ready does the processor leave reset. Its first act is a fetch, and a fetch needs someone to answer.
Read the diagram as text
- Supply supervisor: says when the supply is good
- Sequencer: always on; takes one step at a time
- Oscillator and PLL: each says when it is ready
- Boot strap: a pin that chooses where to start
- Bus and boot ROM: the ROM needs a few edges after its release
- Processor: fetches its first instruction after release
- Supply supervisor → Sequencer: supply good
- Sequencer → Oscillator and PLL: start
- Oscillator and PLL → Sequencer: ready, then lock
- Boot strap → Sequencer: sampled once
- Sequencer → Bus and boot ROM: release
- Bus and boot ROM → Sequencer: ROM ready
- Sequencer → Processor: release, last
- Processor → Bus and boot ROM: first fetch
The power-up sequence of ap_soc. The order, and what each stage waits for, are choices of our chip.
The Smallest Example, Worked by Hand
Count clock edges of the sequencer: e0, e1, e2 and so on. Three things come from outside, at times we choose for the example. The supply is good from e1. The oscillator is ready from e3. The PLL locks from e5. The ROM needs 4 edges of warm-up after its release.
The sequencer takes each step on the first edge at which the signal it waits for is 1. Work out the edges.
| Step of the sequencer | Waits for | Happens at |
|---|---|---|
| Ask the oscillator to start | supply good (1 from e1) | e1 |
| Start the PLL | oscillator ready (1 from e3) | e3 |
| Sample the strap | PLL lock (1 from e5) | e5 |
| Release the bus and the ROM | the strap sample, one edge before | e6 |
| (the ROM warms up) | 4 edges after e6 | ROM ready at e10 |
| Release the processor | ROM ready, one edge before | e11 |
| (the first fetch) | the processor, now running | after e11 |
Now break one wait. Let the sequencer release the processor as soon as the bus is released, and not wait for the ROM. The bus is released at e6, so the processor leaves reset at e7. Its first fetch reaches a ROM that is three edges short of ready.
What that ROM answers is a rule of our lab. Take a read that comes before it is ready, or at an address it does not hold. It gets an error response: an answer that says the read failed. The word that comes with it is 0. Its one good word is 00000013, at address 0.
The strap adds one more case. In our chip a strap of 0 means: start at address 00000000, in the boot ROM. A strap of 1 means: start at 80000000, the first address of the RAM. The lab memory holds only the one ROM word. So a start at 80000000 asks for an address that the lab does not hold.
- Edge 0
The supply is not good yet. The sequencer holds everything at 0.
- Edge 1
The supply is good. The sequencer asks the oscillator to start.
- Edge 3
The oscillator is ready. The sequencer starts the PLL.
- Edge 5
The PLL reports lock. The sequencer samples the boot strap, once.
- Edge 6
The bus and the ROM leave reset. The ROM now needs four edges of its own to start.
- Edge 10
The ROM is ready.
- Edge 11
Only now the processor leaves reset. Its first fetch will find a ROM that can answer.
Drawn from the twelve edge rows of the first run of the lab. 1 means: this has happened.
The Rules
Rule 1: Nothing starts before the supply is good.
Until then the sequencer holds every start signal and every release at 0.
Rule 2: Each stage waits for a ready signal of the stage before.
A request to start is not a result. A fixed delay is a guess.
Rule 3: The boot strap is sampled once and stored.
Later changes of the pin must not move the start address.
Rule 4: What answers is released before what asks.
The bus and the memory first, the processor last.
Rule 5: A release is not readiness.
A block may need time after its release. Wait for its ready signal, not for its release.
Rule 6: Read the first fetch by its response, not by its address.
The right address with an error response is a failed boot.
Sources for These Rules
These rules are common design practice. No book or standard in our reference library gives a power-up sequence, so none is quoted.
The order of our sequencer, the strap of one bit and the two start addresses are choices of ap_soc. The warm-up of 4 edges and the error on an early read are choices of this lab.
Why the PLL is used only after lock is a rule of the page on clock sources. Why a release must be in step with a clock is a rule of the page on reset architecture.
Now Run It
The lab at the end of this page has the sequencer and the one-word boot ROM. Test code plays the supply supervisor, the oscillator, the PLL and the processor. It prints one long row for each clock edge. The table below is read from those rows.
| Signal | Run 1: waits for the ROM | Run 2: does not wait |
|---|---|---|
| supply good | e1 | e1 |
| oscillator ready | e3 | e3 |
| PLL lock | e5 | e5 |
| strap sampled | e5 | e5 |
| bus and ROM released | e6 | e6 |
| ROM ready | e10 | not before the fetch |
| processor released | e11 | e7 |
Built from the recorded rows of the lab. Run 2 ends at its fetch, before the ROM is ready.
Rule 2 at work, in the first column: every edge is the one from the hand table. Rule 4 at work: the processor is released at e11, one edge after ROM ready at e10.
fetch addr=00000000 valid=1 error=0 word=00000013
fetch addr=00000000 valid=1 error=1 word=00000000Rule 5 broken, in the second column. The processor is released at e7. The ROM was released at e6 and is not ready.
Rule 6 at work, in the two fetch rows. Both show address 00000000 and valid=1: a response arrived. The first has error=0 and the word 00000013. The second has error=1 and a word of 0. Only the response tells the two boots apart.
This lab leaves things out. Test code plays every analog part with a time we chose: there is no real supply, crystal or PLL. All of it runs on one clock, so no release here needs a synchronizer. The processor is test code that makes one read.
Why It Is Built This Way
| Design choice | The alternative | What the choice buys, and costs |
|---|---|---|
| Wait for ready signals | Wait for fixed delays | Right at any temperature and for any part. Each stage must provide an honest ready signal. |
| Sample the strap once | Read the pin whenever it is needed | The start address cannot move later. The pin is free for another use after boot. |
| Release the processor last | Release everything together | The first fetch finds a memory that answers. Boot takes a few edges longer. |
| An error on an early read | Stall the read until the ROM is ready | A skipped wait shows up at once. A chip with this fault does not boot at all. |
The Trap: The Right Address
Back to the two boards. Both showed a first fetch at address zero. On the silent one, somebody had replaced a wait for "ROM ready" by a short fixed delay, to make boot faster. On the bench the ROM was quick, and the delay was enough.
The silent board had a ROM from another batch, a little slower. The processor came out of reset while that ROM was still starting. The address was right. The response was an error, and the capture did not include the response.
A second trap is the strap that is read live. A design uses the pin itself, and not the stored sample, each time it needs the start address. After boot the same pin is used as an output. The next warm reset starts the chip from the wrong memory.
A third trap is a lock signal that flickers. The PLL reports lock, loses it for a moment and reports it again. A sequencer that moved on at the first report is now running the chip on a clock that is not steady. The second practice problem has such a lock.
At Scale
This section looks ahead. One chain of six stages becomes a tree of dependencies with several supplies.
Supplies in order too
A large chip has many supplies, and they must rise in a set order. A separate chip on the board does that.
A record of progress
A good sequencer stores how far it got. A board that hangs in stage four of nine can then say so.
Branches that start side by side
Blocks that do not depend on each other start at the same time. Only the path to the first fetch is a strict chain.
What the first instructions do
The sequence ends where software begins. The Boot Flow follows the processor from its first fetch.
Try It
Run the lab. It powers the chip up twice. The second time, the sequencer does not wait for the ROM.
Change ROM_START_EDGES from 4 to 6. At which edge is the processor released in the first run?
Hold the strap at 1 in the first run. The quiz below asks what the first fetch returns.
Names Printed by the Lab
| Name | Meaning |
|---|---|
| e0, e1, ... | One row for each clock edge of the sequencer, with the values just after that edge. |
| good | Supply good, from the supervisor. |
| osc, osc_ok | The sequencer has asked the oscillator to start; the oscillator says that it is ready. |
| pll, lock | The sequencer has started the PLL; the PLL reports lock. |
| sampled, boot_sel | The strap has been sampled; the value that was stored. |
| fabric | The bus and the ROM are released from reset. |
| rom | ROM ready. |
| core | The processor is released from reset. |
| req, addr | The fetch request of the test code that plays the processor, and its address. |
| valid, error, word | A response has arrived; it is an error; the word that came with it. |
| trial shorten_wait | 0: the sequencer waits for ROM ready. 1: it does not. |
trial shorten_wait=0 e0 good=0 osc=0 osc_ok=0 pll=0 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e1 good=1 osc=1 osc_ok=0 pll=0 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e2 good=1 osc=1 osc_ok=0 pll=0 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e3 good=1 osc=1 osc_ok=1 pll=1 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e4 good=1 osc=1 osc_ok=1 pll=1 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e5 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e6 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=0 core=0 req=0 addr=00000000 valid=0 e7 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=0 core=0 req=0 addr=00000000 valid=0 e8 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=0 core=0 req=0 addr=00000000 valid=0 e9 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=0 core=0 req=0 addr=00000000 valid=0 e10 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=1 core=0 req=0 addr=00000000 valid=0 e11 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=1 core=1 req=0 addr=00000000 valid=0 issue good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=1 core=1 req=1 addr=00000000 valid=0 return good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=1 core=1 req=0 addr=00000000 valid=1 fetch addr=00000000 valid=1 error=0 word=00000013 trial shorten_wait=1 e0 good=0 osc=0 osc_ok=0 pll=0 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e1 good=1 osc=1 osc_ok=0 pll=0 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e2 good=1 osc=1 osc_ok=0 pll=0 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e3 good=1 osc=1 osc_ok=1 pll=1 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e4 good=1 osc=1 osc_ok=1 pll=1 lock=0 sampled=0 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e5 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=0 rom=0 core=0 req=0 addr=00000000 valid=0 e6 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=0 core=0 req=0 addr=00000000 valid=0 e7 good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=0 core=1 req=0 addr=00000000 valid=0 issue good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=0 core=1 req=1 addr=00000000 valid=0 return good=1 osc=1 osc_ok=1 pll=1 lock=1 sampled=1 boot_sel=0 fabric=1 rom=0 core=1 req=0 addr=00000000 valid=1 fetch addr=00000000 valid=1 error=1 word=00000000Read included file: ap_crg_boot.sv
// Startup slice of ap_crg. Each ready input is already qualified in the
// always-on domain. Board supervision handles rail or lock loss after boot.
module ap_crg_boot(
input logic aon_clk, supply_good, osc_ready, pll_locked, boot_pin,
input logic fabric_ready, rom_ready, shorten_wait,
output logic osc_start, pll_start, straps_valid, boot_sel,
output logic fabric_reset_n, core_reset_n
);
always_ff @(posedge aon_clk or negedge supply_good) begin
if (!supply_good) begin
{osc_start, pll_start, straps_valid, boot_sel} <= 0;
{fabric_reset_n, core_reset_n} <= 0;
end else begin
osc_start <= 1;
if (osc_start && osc_ready) pll_start <= 1;
if (pll_start && pll_locked && !straps_valid) begin
boot_sel <= boot_pin;
straps_valid <= 1;
end
if (straps_valid) fabric_reset_n <= 1;
if (fabric_reset_n && fabric_ready && (rom_ready || shorten_wait))
core_reset_n <= 1;
end
end
endmodule
Read included file: boot_rom_port.sv
// A one-word boot ROM for the startup lab. Unavailable and unmapped reads
// both complete with an error. START_EDGES counts local edges after release.
module boot_rom_port #(
parameter integer START_EDGES = 4
)(
input logic clk, reset_n, req,
input logic [31:0] addr,
output wire ready,
output logic valid, error,
output logic [31:0] data
);
integer warm_edges;
assign ready = reset_n && warm_edges >= START_EDGES;
always_ff @(posedge clk) begin
if (!reset_n) begin
warm_edges <= 0;
valid <= 0;
error <= 0;
data <= 0;
end else begin
if (!ready) warm_edges <= warm_edges + 1;
valid <= req;
if (req) begin
error <= !ready || addr != 0;
data <= ready && addr == 0 ? 32'h00000013 : 0;
end
end
end
endmodule
Check Yourself
Common Mistakes
Wrong Start the PLL because the oscillator was asked to start.
A request is not a result. The oscillator may still be starting.
Fix Wait for its ready signal.
Wrong Read the strap live, each time the start address is needed.
The pin may change after boot.
Fix Use the value stored at the strap sample.
Wrong Call a boot good because the first address is right.
The memory can answer that address with an error.
Fix Check the response and the word that came back.
Remember
- A chip powers up in stages. Each stage waits for a ready signal of the stage before.
- The boot strap is sampled once and stored.
- What answers is released before what asks: the processor is last.
- Read the first fetch by its response, not by its address.