Rebuild the path of a program from its listing and six packets, and find where an interrupt broke in.
Hardware context: Trace funnel and circular sink. Postmortem instruction history
This is the decoder of lesson S8.4 with another program. A decoder walks the listing from the start address. It takes a packet only where the listing cannot tell what comes next. Packet S gives the start address. Packet T means that a branch was taken, packet N that it was not. Packet I gives the address of the instruction that an interrupt held up: the program goes to the handler in its place. Packet A gives the address to which a return went.
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 |
|---|---|
| 16 | Plain |
| 20 | Branch to 32 |
| 24 | Plain |
| 28 | Jump to 20 |
| 32 | Plain |
| 36 | Stop |
| 96 | Plain. The interrupt handler starts here. |
| 100 | Return |
The capture holds six packets, in this order: S 16, N, I 28, A 28, N, T. All numbers on this page are decimal, and instructions are four apart. The path is the list of every address that ran, in order. Count the stop as an instruction.
| Entry | Your decision |
|---|---|
| FIRST | The first address on the path. |
| SECOND | The second address on the path. |
| THIRD | The third address on the path. |
| FOURTH | The fourth address on the path. |
| IN_HANDLER | How many instructions of the handler ran? |
| AFTER_RETURN | The address that ran straight after the return. |
| BRANCH_RUNS | How many times did the branch at 20 run? |
| BEFORE_IRQ | How many instructions ran before the interrupt broke in? |
| LAST | The last address on the path. |
| TOTAL | How many instructions are on the path? |
| NO_PACKET | How many of those instructions needed no packet of their own? Count T, N and A as the packet of an instruction. Do not count S or I. |
| TOTAL_N | Suppose the capture had N more packets N just before its last packet. How many instructions would be on the path? |
Examples
Example 1
FIRST- Input
The first address on the path.
- Output
matches = 1
The packet S gives the start address.
Example 2
SECOND- Input
The second address on the path.
- Output
matches = 1
The instruction at 16 is plain, so 20 follows. No packet is needed.
Example 3
THIRD- Input
The third address on the path.
- Output
matches = 1
The branch at 20 takes the packet N: not taken, so 24 follows.
Constraints and Contract
- Keep the parameter and named constants. Use the numeric codes and units on this page.
- For TOTAL_N, enter a constant expression using N. Only this entry changes with the parameter. The supported integer range is 0 through 4, inclusive.
Hints
Hint 1
Start at the address in the packet S. After a plain instruction or a jump, the listing gives the next address.
Hint 2
A branch takes T or N. A return takes A.
Hint 3
Before each instruction, look at the next packet. If it is I with this address, go to the handler.
What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.
12 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 3 problems on this path