Follow three boots of one chain by hand: who has control after each offer, where a stop is latched, and what a reset changes.
Hardware context: Boot chain of ap_phone: Boot ROM, loader, monitor and operating system. Multi-stage secure boot and anti-rollback
This is the chain of lesson S10.15 with other images and other floors. After a reset the Boot ROM runs. The running stage checks the next image: its signature, and its version against a floor. If both pass, the next stage runs. If not, the running stage keeps control and accepts no further image until the next reset.
This worksheet uses named constants. The first three entries show how to record your decisions.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| Stage that has control | Code |
|---|---|
| Boot ROM | 1 |
| Loader | 2 |
| Monitor | 3 |
| OS | 4 |
| Image | Lowest version accepted (the floor) |
|---|---|
| Loader | 5 |
| Monitor | 3 |
| OS | 6 |
| Event | What happens |
|---|---|
| 1 | Reset |
| 2 | A loader is offered: signature good, version 5 |
| 3 | A monitor is offered: signature good, version 2 |
| 4 | A monitor is offered: signature good, version 3 |
| 5 | Reset |
| 6 | A loader is offered: signature good, version 6 |
| 7 | A monitor is offered: signature good, version 3 |
| 8 | An OS is offered: signature wrong, version 6 |
| 9 | An OS is offered: signature good, version 6 |
| 10 | Reset |
| 11 | A loader is offered: signature good, version 4 |
| 12 | A loader is offered: signature good, version 5 |
A version passes if it is at the floor or above it. Enter the code of a stage, or a count.
| Entry | Your decision |
|---|---|
| AFTER_2 | The code of the stage that has control after event 2. |
| AFTER_3 | The code of the stage that has control after event 3. |
| AFTER_4 | The code of the stage that has control after event 4. |
| AFTER_6 | The code of the stage that has control after event 6. |
| AFTER_7 | The code of the stage that has control after event 7. |
| AFTER_8 | The code of the stage that has control after event 8. |
| AFTER_9 | The code of the stage that has control after event 9. |
| AFTER_11 | The code of the stage that has control after event 11. |
| AFTER_12 | The code of the stage that has control after event 12. |
| CHECKER_8 | The code of the stage that checks the image of event 8. |
| IGNORED | How many of the twelve events offer an image that would pass, to a stage that is already stopped? |
| RESETS | After event 12, how many resets are needed before the OS can run? |
| LAST_OWNER | A fresh boot offers a loader, a monitor and an OS, each at its floor. The signature of offer number BAD is wrong (1 the loader, 2 the monitor, 3 the OS, 0 none). Give the code of the stage that has control at the end. |
Examples
Example 1
AFTER 2- Input
The code of the stage that has control after event 2.
- Output
matches = 1
Version 5 meets the floor of 5, and the signature is good. The loader runs.
Example 2
AFTER 3- Input
The code of the stage that has control after event 3.
- Output
matches = 1
Version 2 is below the floor of 3. The loader refuses and keeps control.
Example 3
AFTER 4- Input
The code of the stage that has control after event 4.
- Output
matches = 1
The image is good, but the stop of event 3 is latched.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For LAST_OWNER, enter a constant expression using BAD. Only this entry changes with the parameter. The supported integer range is 0 through 3, inclusive.
- Replace each unfinished 255 with your decision.
Hints
Hint 1
After a reset the code is 1, and nothing is stopped.
Hint 2
First the signature, then the version against the floor of that image.
Hint 3
After a refusal, cross out every later offer up to the next reset.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
13 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.
See all 1 problem on this path