S5.7.2 Choose the Mode

MediumImplement22 minIcarus Verilog · serverReview the topic

Budget the entire idle interval and return with enough time and state to service the next request.

Hardware context: ap_soc timer power island. Sleep and wake planning

These integer costs are exercise values for one ap_soc workload. Choose the lowest total energy among feasible modes. A mode meets a deadline at equality. Break an energy tie using the lower mode code.

This worksheet uses named constants. The first three entries show how to record your decisions.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification
Code / modeEntry + exit energy (nJ)Idle power (mW)Wake (µs)Wake source / context
1 Run090Any / full
2 Sleep451Any / full
3 Deep sleep1615RTC or button / saved
4 Off32012External restart / none

Energy in nJ equals transition energy plus idle power times dwell in microseconds. Wake time is a separate response constraint. The energy model includes the transitions once. A request for saved context allows full context too.

EntryYour decision
NOWDwell 20 µs, RTC, full context, deadline 0 µs.
FASTDwell 20 µs, RTC, full context, deadline 1 µs.
BUTTONDwell 20 µs, button, saved context, deadline 5 µs.
SHORTDwell 1 µs, button, saved context, deadline 6 µs.
SERIALDwell 50 µs, UART, no context requirement, deadline 20 µs.
COLDDwell 60 µs, external restart, no context requirement, deadline 12 µs.
LATEDwell 30 µs, button, saved context, deadline 4 µs.
EQUALDwell 3 µs, RTC, saved context, deadline 5 µs.
NIGHTRTC wake, saved context, 5 µs deadline. Choose the mode for DWELL µs.

Examples

Example 1

NOW
Input
Dwell 20 µs, RTC, full context, deadline 0 µs.
Output
matches = 1

Only run can respond immediately. Record NOW = 1.

Example 2

FAST
Input
Dwell 20 µs, RTC, full context, deadline 1 µs.
Output
matches = 1

Sleep is feasible and saves energy at this dwell. Record FAST = 2.

Example 3

BUTTON
Input
Dwell 20 µs, button, saved context, deadline 5 µs.
Output
matches = 1

Deep sleep costs 36 nJ and meets the deadline exactly. Record BUTTON = 3.

Constraints and Contract

  • Keep the parameter and named constants. Use the numeric codes and units on this page.
  • For NIGHT, enter a constant expression using DWELL. Only this entry changes with the parameter. The supported integer range is 0 through 16, inclusive.

Hints

Hint 1

Remove modes that lose required state or the wake source.

Hint 2

Check response time separately from energy.

Hint 3

Compute total energy including entry and exit, then resolve ties.

What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.

25 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 2 problems on this path

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

NOW

Input
Dwell 20 µs, RTC, full context, deadline 0 µs.
Expected output
matches = 1

Only run can respond immediately. Record NOW = 1.

Run samples executes all 3 public checks. Check all tests runs 25 checks on the server.

Icarus Verilog · server