V5.3.1 When Does the Model Hear of an Interrupt

MediumImplement22 minIcarus Verilog · serverReview the topic

From recorded records, work out where the core took a timer interrupt and how far behind the pin it was. Then say what each way of telling the model would do.

Hardware context: Interrupts of ap_soc v1.5 and the model: the core's snapshot in mip against the pins. Counting the skid between a pin and its record.

A program took four interrupts on ap_soc v1.5 (4 interrupt records, 298 records compared with the model, 0 mismatches). The timer's pin rose at cycle 98. The table holds the records around it. Index the rows from 0.

This worksheet uses named constants. The first three entries show how to record your decisions.

Replace each unresolved value of 65535 with your result.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification
Recorded on ap_soc v1.5 (Icarus build of soc_tb with a probe). mip bit 7 is the timer line as the core sampled it.
Rowcycleorderpcinstructionmiptrap
098540x80000078addi a1, a1, 30x000000000
199550x8000007caddi t3, t3, -10x000000000
2100560x80000080bne t3, zero, 0x800000780x000000000
3103570x80000078addi a1, a1, 30x000000801
4107580x80000118csrrs t5, mcause, zero0x000000800
5111590x8000011caddi s1, s1, 10x000000800
6112600x80000120andi t6, t5, 150x000000800
CodeMethod
1Record method: the core writes its snapshot into each record, and the model is given that mip
2Notify method: the bench calls the model to set its lines, from what it observes of the core
3Neither: the model decides the lines itself

Replayed on the instruction-level model, told one record late, the model first differs at order 16 (next_pc). Told the pins as they stood when each record retired, it differs at order 13 (next_pc).

EntryYour decision
FIRST_AFTERThe row of the first record after the pin rose.
TOOKThe row of the record that took the interrupt.
SKIDRecords between them: TOOK minus FIRST_AFTER.
TOOK_CYCLEThe cycle of the record that took it.
LATE_ORDERThe order at which a model told one record late first differs.
NOTIFY_ORDERThe order at which a model told the pins at each record's retirement first differs.
OUR_METHODWhich method does this chip's bench use?
IBEX_METHODWhich method does the Ibex co-simulation use, by its documentation (plan §7)?
ROW_AFTERThe row of the first record after the pin, if the pin had risen at cycle PIN instead.

Examples

Example 1

FIRST AFTER
Input
The row of the first record after the pin rose.
Output
matches = 1

Its cycle is the first above 98.

Example 2

TOOK
Input
The row of the record that took the interrupt.
Output
matches = 1

trap = 1 and its mip shows bit 7.

Example 3

SKID
Input
Records between them: TOOK minus FIRST_AFTER.
Output
matches = 1

The core samples the lines as each instruction enters execute; the instructions already past that point retire first.

Constraints and Contract

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

Hints

Hint 1

Find the first record whose cycle is after the rise.

Hint 2

The record with trap = 1 and the line in mip.

Hint 3

The difference is what a notify method must model.

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

13 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

Report a problem with this page

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

FIRST AFTER

Input
The row of the first record after the pin rose.
Expected output
matches = 1

Its cycle is the first above 98.

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

Icarus Verilog · server