V3.2.2 The Core That Woke Before Its Bus

MediumDebug25 minIcarus · browser samples / server checksReview the topic

A reset sequencer for the always-on clock lets one reset go too early. Find the first cycle the release order breaks, name the bug, and fix the sequencer.

Hardware context: The board's clock, supply, reset pad and boot strap around ap_soc v1.5. Finding the first cycle a reset sequencer releases out of order.

ap_soc releases its resets in a fixed order. The bus leaves reset 4 rising edges of clk_aon after the cause has gone. The core follows 2 edges after the bus, so its first fetch finds a bus that is already running. Every cause holds both resets at once, with no clock.

This copy of the sequencer fails the bench below. Run it and read the log and the waveform.

Step 1: find the first cycle where resetn_sys or resetn_core breaks the release order, and name the signal. Step 2: choose the cause. Step 3, optional: fix the sequencer; the fix is graded by the normal cases.

Signals in the Timeline

SignalWidthRole
scenario4input of each check
Full specification
The ports
// The release of the bus and core resets, on the always-on clock.
module reset_seq (
  input  logic clk_aon,       // the always-on clock
  input  logic por_n,         // power-on reset, active low, asynchronous
  input  logic warm,          // a warm reset is asked for (pin, watchdog or software), active high
  output logic resetn_sys,    // the bus and its blocks, active low
  output logic resetn_core    // the processor, active low
);
  ...
endmodule
Eventresetn_sysresetn_core
por_n low or warm high (any time)0 at once0 at once
4th rising edge of clk_aon after the cause went awayrisesstays 0
6th rising edge after the cause went away1rises

Cycle N is the stretch after the N-th rising edge of clk_aon. The bench checks both levels in the middle of every cycle.

Diagnose the Failing Run

The test below runs the buggy design. Read its log, then find where it first goes wrong in the waveform.

Log

Waveform

Click a signal at a cycle to select it. Or focus the waveform and use the arrow keys: Left and Right move one cycle, Up and Down one signal.

Step 1 · The first bad cycle and signal
Step 2 · The cause

Step 3 is optional: fix the code in the editor, then run the tests.

Examples

Example 1

Power-On, Then Two Warm Resets
Input
power-on 20 ns; warm 30 ns; warm 50 ns
Output
bus_edge_1 = 4, core_edge_1 = 6, bus_edge_2 = 4, core_edge_2 = 6, bus_edge_3 = 4, core_edge_3 = 6, held_during_causes = 'b00000000000000000000000000000000

After each cause the bus rises at the 4th edge and the core at the 6th. While a cause is held both read 0.

Example 2

A Short Warm Reset
Input
power-on 10 ns; warm 6 ns; warm 90 ns
Output
bus_edge_1 = 4, core_edge_1 = 6, bus_edge_2 = 4, core_edge_2 = 6, bus_edge_3 = 4, core_edge_3 = 6, held_during_causes = 'b00000000000000000000000000000000

A warm cause of 6 ns falls between two edges. It still holds both resets at once, and the count starts again.

Example 3

Two Power-On Resets
Input
power-on 12 ns; warm 44 ns; power-on 28 ns
Output
bus_edge_1 = 4, core_edge_1 = 6, bus_edge_2 = 4, core_edge_2 = 6, bus_edge_3 = 4, core_edge_3 = 6, held_during_causes = 'b00000000000000000000000000000000

A second power-on reset clears both resets and restarts the count, exactly as the first did.

Constraints and Contract

  • Keep the module name and the ports.
  • Causes start and end between clock edges.

Hints

Hint 1

Count rising edges from the moment por_n rose. Which reset should be up first?

Hint 2

Each cause shows first in a different cycle. Look for an early bus, an early core, a core that ignores a warm reset, or a warm reset that does nothing.

Hint 3

The count that releases each reset is the whole design.

What the grader checks: The failing run is simulated live with the shipped sequencer. The fix is graded on five scripts of power-on and warm causes. Each reports the edge at which both resets rose after each cause, and their levels during it.

5 checks on Icarus · browser samples / server checks. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. 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

Power-On, Then Two Warm Resets

Input
power-on 20 ns; warm 30 ns; warm 50 ns
Expected output
bus_edge_1 = 4, core_edge_1 = 6, bus_edge_2 = 4, core_edge_2 = 6, bus_edge_3 = 4, core_edge_3 = 6, held_during_causes = 'b00000000000000000000000000000000

After each cause the bus rises at the 4th edge and the core at the 6th. While a cause is held both read 0.

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

Icarus · browser samples / server checks