S8.4.2 Rebuild the Path from the Trace

MediumImplement22 minIcarus Verilog · serverReview the topic

Recover an instruction path from a synchronization packet, a program listing and interleaved trace bytes.

Hardware context: Trace funnel and circular sink. Postmortem instruction history

Your capture starts with a full program offset. After that, source zero sends one decision per conditional branch. Reconstruct executed offsets in bytes. All offsets and exercise packet values below are decimal.

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
OffsetProgram at that offset
16Ordinary instruction. Continue at 20.
20Conditional branch to 36. Fall through to 24.
24Stop.
36Ordinary instruction. Continue at 40.
40Conditional branch back to 36. Fall through to 44.
44Jump directly to 60.
60Stop.

The sink starts empty. Each tuple is (source ID, byte, ready). Count edges from zero. All offers are valid. IDs here are local source numbers. Source zero starts with sync offset 16. Its later bytes are outcomes: one means taken, zero means fall through. Source one carries device events.

Drawn exercise capture in edge order
(0,16,1)  (1,0,1)  (0,1,0)  (0,1,1)
(0,1,1)   (1,1,1)  (0,0,1)
EntryYour decision
STARTStarting offset?
FIRST_TESTOffset of the first conditional?
FIRST_DESTOffset immediately after that branch?
SECOND_TESTOffset of the next conditional?
LOOP_DESTDestination after the second outcome?
EXIT_DESTDestination after the third outcome?
STOPFinal offset?
RETIREDTotal executed instructions including stop?
OUTCOMESHow many outcome bytes were consumed?
FLUSH_ACKA flush starts at edge 2, with both taken outcomes already queued. All later packets are generated afterward. Sample acknowledgement one edge after the last pre-request packet transfers. At which edge is acknowledgement first sampled?
OLDEST_EDGEA four-entry circular sink retains the last four accepted packets. Which edge supplied the oldest survivor?
TOTAL_RETIREDInsert EXTRA_LOOPS more taken back edges before the final zero. How many instructions execute including stop?

Examples

Example 1

START
Input
Starting offset?
Output
matches = 1

The sync packet supplies 16.

Example 2

FIRST TEST
Input
Offset of the first conditional?
Output
matches = 1

Execution advances from 16 to 20.

Example 3

FIRST DEST
Input
Offset immediately after that branch?
Output
matches = 1

The first accepted source-zero outcome takes the branch.

Constraints and Contract

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

Hints

Hint 1

Mark each accepted source-zero packet.

Hint 2

Move through the listing until a conditional needs its outcome.

Hint 3

Count every visit, including repeated offsets and the stop.

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

Report a problem with this page

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

START

Input
Starting offset?
Expected output
matches = 1

The sync packet supplies 16.

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

Icarus Verilog · server