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
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| Address | Instruction | Clock edges |
|---|---|---|
| 0 | Load 32 into x5 | 3 |
| 4 | Add 1 to x5 | 1 |
| 8 | Load 80 into x5 | 5 |
| 12 | Add 1 to x5 | 1 |
| 16 | Load 9 into x5 | 2 |
| 20 | Add 1 to x5 | 1 |
| 24 | Add 1 to x5 | 1 |
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.
| Entry | Your decision |
|---|---|
| HALT_EDGE | After which edge is the hart halted for the first time? |
| HALT_PC | The next pc at that stop. |
| HALT_X5 | The content of x5 at that stop. |
| STEP1_EDGE | After which edge does the first step end? |
| STEP1_PC | The next pc after the first step. |
| STEP1_X5 | The content of x5 after the first step. |
| STEP2_EDGE | After which edge does the second step end? |
| STEP2_PC | The next pc after the second step. |
| STEP2_X5 | The content of x5 after the second step. |
| TRIG_EDGE | After which edge does the trigger halt the hart? |
| TRIG_PC | The next pc at that stop. |
| TRIG_X5 | The content of x5 at that stop. |
| RAN_24 | Has the instruction at 24 run when the hart halts? 1 for yes, 2 for no. |
| STEP2_EDGE_N | Suppose 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