Keep a one-edge halt request alive through a stalled instruction, then stop at the right return address.
Hardware context: ap_soc debug boundary. Finding the last completed instruction during firmware bring-up
A service probe can pulse halt_req only once. The hart reports retire when an instruction completes. next_pc already includes any branch redirect and matters only on retirement.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
row | 12 | input of each check |
Full specification
Sample every input on the rising edge. Synchronous reset wins everywhere and clears halted, saved_pc and all pending work.
While running, remember a halt request until retirement. If both arrive together, halt on that edge. On every halt, capture next_pc. Retain saved_pc until reset or the next halt.
While halted, ignore retire and halt_req. A resume or step command releases the hart immediately after its sampling edge. Start counting retirements on later edges.
Step wins over simultaneous resume and halts at the first subsequent retirement. Normal resume allows unlimited retirements. Ignore resume and step commands while running.
Examples
Example 1
Reset- Input
Reset at the first edge
- Output
halted = 0, saved_pc = 0x0
The probe starts with an empty snapshot.
Example 2
Wait- Input
Halt pulse while the instruction waits
- Output
halted = 0, saved_pc = 0x0
No instruction has finished yet.
Example 3
Return Address- Input
Retirement with next_pc = 0x84
- Output
halted = 1, saved_pc = 0x84
The earlier request takes effect on this edge.
Constraints and Contract
- Implement halt_control. The test treats next_pc as an opaque 32-bit tag so every bit must survive.
Hints
Hint 1
Separate an outstanding request from a stopped hart.
Hint 2
Locate the instruction boundary before saving its successor.
Hint 3
Release and retirement belong to different edges.
What the grader checks: All binary command combinations are tried from running, pending, halted and stepping histories. Every saved PC bit is isolated.
1320 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