S8.9.1 Stop a Program by Hand

EasyImplement12 minIcarus Verilog · serverReview the topic

Work out by hand where a halt lands, what two steps show, and where a trigger stops a program.

Hardware context: Debug boundary of one hart of ap_soc: a model program, a halt request, a step request and one execution trigger. Driving run control from a debug script during bring-up

This is the hart of lesson S8.9 with another program. The hart starts at address 0 on clock edge 1. A halt lands on the next instruction boundary. A step request or a resume request takes one clock edge, and the instruction starts on the edge after it. A trigger halts the hart one edge after the next pc reaches its address, before the instruction there runs.

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
AddressInstructionClock edges
0Load 32 into x53
4Add 1 to x51
8Load 80 into x55
12Add 1 to x51
16Load 9 into x52
20Add 1 to x51
24Add 1 to x51

The debugger sends a halt request after edge 1. When the hart has halted it asks for one step, and then for a second step. Then it sets a trigger at address 24 and sends a resume request. All numbers on this page are decimal. Enter an edge as its number: 3 for edge 3.

EntryYour decision
HALT_EDGEAfter which edge is the hart halted for the first time?
HALT_PCThe next pc at that stop.
HALT_X5The content of x5 at that stop.
STEP1_EDGEAfter which edge does the first step end?
STEP1_PCThe next pc after the first step.
STEP1_X5The content of x5 after the first step.
STEP2_EDGEAfter which edge does the second step end?
STEP2_PCThe next pc after the second step.
STEP2_X5The content of x5 after the second step.
TRIG_EDGEAfter which edge does the trigger halt the hart?
TRIG_PCThe next pc at that stop.
TRIG_X5The content of x5 at that stop.
RAN_24Has the instruction at 24 run when the hart halts? 1 for yes, 2 for no.
STEP2_EDGE_NSuppose the load at address 8 needed N clock edges in place of 5. After which edge would the second step end?

Examples

Example 1

HALT EDGE
Input
After which edge is the hart halted for the first time?
Output
matches = 1

The load at 0 needs edges 1, 2 and 3. The request came after edge 1, and the hart finishes the load first.

Example 2

HALT PC
Input
The next pc at that stop.
Output
matches = 1

The load at 0 has finished. The next instruction is at 4.

Example 3

HALT X5
Input
The content of x5 at that stop.
Output
matches = 1

The load at 0 put 32 in x5.

Constraints and Contract

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

Hints

Hint 1

List the edges of each instruction in order. A halt lands after the last edge of the instruction in progress.

Hint 2

One edge takes the request. Then one instruction runs, however many edges it needs.

Hint 3

Run instructions until the next pc equals the trigger address. Add one edge. That instruction has not run.

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

14 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

Report a problem with this page

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

HALT EDGE

Input
After which edge is the hart halted for the first time?
Expected output
matches = 1

The load at 0 needs edges 1, 2 and 3. The request came after edge 1, and the hart finishes the load first.

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

Icarus Verilog · server