Add up the energy of one idle gap in three modes, find the gap at which deep sleep starts to pay, and apply a wake deadline.
Hardware context: Power modes of ap_soc: run, sleep and deep sleep, each with an idle power, a transition energy and a wake time. Choosing a sleep mode for a battery device from its duty cycle
This is the calculator of lesson S5.13 with other costs. A chip has nothing to do for a while, the idle gap. It can stay in run mode, go to sleep, or go to deep sleep. All numbers are exercise values, not measurements of a chip. A power of 1 mW for 1 microsecond is an energy of 1 nJ.
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
| Mode | Energy to enter and leave | Power while idle | Time to wake |
|---|---|---|---|
| Run | 0 nJ | 12 mW | 0 |
| Sleep | 4 nJ | 5 mW | 2 microseconds |
| Deep sleep | 28 nJ | 2 mW | 9 microseconds |
The energy of a mode over a gap is its energy to enter and leave, plus its idle power times the gap. Enter energies in nJ and times in microseconds, as plain numbers. For a choice of mode enter 1 for sleep and 2 for deep sleep.
| Entry | Your decision |
|---|---|
| RUN_4 | Energy of run mode over a gap of 4 microseconds. |
| SLEEP_4 | Energy of sleep over a gap of 4 microseconds. |
| DEEP_4 | Energy of deep sleep over a gap of 4 microseconds. |
| CHEAPER_4 | The cheaper sleep mode for a gap of 4 microseconds: 1 or 2. |
| SLEEP_12 | Energy of sleep over a gap of 12 microseconds. |
| DEEP_12 | Energy of deep sleep over a gap of 12 microseconds. |
| CHEAPER_12 | The cheaper sleep mode for a gap of 12 microseconds: 1 or 2. |
| EXTRA_COST | How much more deep sleep costs to enter and leave than sleep. |
| SAVED_EACH_US | How much less energy deep sleep uses in each microsecond of the gap. |
| BREAK_EVEN | The gap, in microseconds, at which the two sleep modes cost the same. |
| DEEP_IN_TIME | The chip must answer within 6 microseconds of a wake event. Does deep sleep wake in time? 1 for yes, 2 for no. |
| CHOICE_12 | The mode to choose for a gap of 12 microseconds with that deadline: 1 or 2. |
| DEEP_ENERGY_N | What is the energy of deep sleep, in nJ, for an idle gap of N microseconds? |
Examples
Example 1
RUN 4- Input
Energy of run mode over a gap of 4 microseconds.
- Output
matches = 1
12 mW for 4 microseconds is 48 nJ. Run mode has nothing to enter or leave.
Example 2
SLEEP 4- Input
Energy of sleep over a gap of 4 microseconds.
- Output
matches = 1
4 nJ to enter and leave, plus 5 mW for 4 microseconds: 4 + 20.
Example 3
DEEP 4- Input
Energy of deep sleep over a gap of 4 microseconds.
- Output
matches = 1
28 nJ to enter and leave, plus 2 mW for 4 microseconds: 28 + 8.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For DEEP_ENERGY_N, enter a constant expression using N. Only this entry changes with the parameter. The supported integer range is 2 through 12, inclusive.
Hints
Hint 1
Energy to enter and leave, plus idle power times the gap.
Hint 2
Divide the extra cost of the deeper mode by what it saves in each microsecond.
Hint 3
A mode that wakes too late is ruled out, however little energy it uses.
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