V5.1.1 Read the Retire Record

EasyImplement12 minIcarus Verilog · serverReview the topic

Read records of one recorded run of ap_soc v1.5 and answer from them. Where did an interrupt land, what does a trap report, what stays at zero?

Hardware context: The retire trace of ap_rv32 inside ap_soc v1.5: 24 fields a record, recorded on the chip. Reading a recorded trace by hand.

The tour program of lesson V5.1 ran on ap_soc v1.5 and made 67 records, 3 of them traps. The table shows eight of them, with 15 of the 24 fields. Answer each entry from the records and the rules of the trace. Hex answers are written 32'h... .

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

Replace each unresolved value of 4294967295 with your result.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification
Recorded on ap_soc v1.5 (soc_tb on Icarus with a probe). The same run compared 67 records with the model on the chip bench: 0 mismatches.
orderpcinstructiontrapcausetvalnext_pcrdrd_wdatamem_addrrmaskmem_rdatacsr_writemstatusmip
110x8000002clbu a1, 1(s1)00x000000000x000000000x80000030110x000000ee0x800000c510x000000ee00x000018000x00000000
130x80000034csrrs a3, mstatus, zero00x000000000x000000000x80000038130x000018000x0000000000x0000000000x000018000x00000000
140x80000038ecall10x0000000b0x000000000x8000009400x000000000x0000000000x0000000000x000018000x00000000
420x80000078bne t3, zero, 0x8000007000x000000000x000000000x8000007000x000000000x0000000000x0000000000x000018880x00000000
430x80000070bne s4, zero, 0x8000007c10x800000070x000000000x8000009400x000000000x0000000000x0000000000x000018800x00000080
440x80000094csrrs t5, mcause, zero00x000000000x000000000x80000098300x800000070x0000000000x0000000000x000018800x00000080
520x80000070bne s4, zero, 0x8000007c00x000000000x000000000x8000007c00x000000000x0000000000x0000000000x000018880x00000000
540x80000080lw t2, 0(t0)10x000000050x100070000x8000009400x000000000x0000000000x0000000000x000018800x00000000
EntryYour decision
LBU_MASKmem_rmask of the lbu record.
ECALL_NEXTnext_pc of the ecall record (the handler's address).
RETIREDminstret after all 67 records.
IRQ_ORDERThe order of the record that took the timer interrupt.
IRQ_MEPCmepc after the interrupt record (the pc the handler will return to).
AGAIN_ORDERThe order of the record where that interrupted instruction finally retires.
CSRRS_WRITEcsr_write of csrrs a3, mstatus, zero.
FAULT_TVALtval of the load fault.
FAULT_MEMmem_addr of the load fault record.
IRQ_MIEBit 3 (MIE) of mstatus after the interrupt record, as 0 or 1.
RETIRED_ATminstret after 67 records, if TRAPS of them were traps.

Examples

Example 1

LBU MASK
Input
mem_rmask of the lbu record.
Output
matches = 1

One byte read: bit 0 only. Byte 0 of mem_rdata is the byte at mem_addr.

Example 2

ECALL NEXT
Input
next_pc of the ecall record (the handler's address).
Output
matches = 1

On a trap, next_pc is where the core went: the handler at mtvec.

Example 3

RETIRED
Input
minstret after all 67 records.
Output
matches = 1

minstret counts the records that did not trap: 67 - 3.

Constraints and Contract

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

Hints

Hint 1

Each question names one record: find it by its instruction or its trap.

Hint 2

Copy the field, in hex for addresses.

Hint 3

Where a field is 0, a rule of the trace says why.

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

15 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

LBU MASK

Input
mem_rmask of the lbu record.
Expected output
matches = 1

One byte read: bit 0 only. Byte 0 of mem_rdata is the byte at mem_addr.

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

Icarus Verilog · server