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
| Signal | Width | Role |
|---|---|---|
question | 8 | input of each check |
Full specification
| order | pc | instruction | trap | cause | tval | next_pc | rd | rd_wdata | mem_addr | rmask | mem_rdata | csr_write | mstatus | mip |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 11 | 0x8000002c | lbu a1, 1(s1) | 0 | 0x00000000 | 0x00000000 | 0x80000030 | 11 | 0x000000ee | 0x800000c5 | 1 | 0x000000ee | 0 | 0x00001800 | 0x00000000 |
| 13 | 0x80000034 | csrrs a3, mstatus, zero | 0 | 0x00000000 | 0x00000000 | 0x80000038 | 13 | 0x00001800 | 0x00000000 | 0 | 0x00000000 | 0 | 0x00001800 | 0x00000000 |
| 14 | 0x80000038 | ecall | 1 | 0x0000000b | 0x00000000 | 0x80000094 | 0 | 0x00000000 | 0x00000000 | 0 | 0x00000000 | 0 | 0x00001800 | 0x00000000 |
| 42 | 0x80000078 | bne t3, zero, 0x80000070 | 0 | 0x00000000 | 0x00000000 | 0x80000070 | 0 | 0x00000000 | 0x00000000 | 0 | 0x00000000 | 0 | 0x00001888 | 0x00000000 |
| 43 | 0x80000070 | bne s4, zero, 0x8000007c | 1 | 0x80000007 | 0x00000000 | 0x80000094 | 0 | 0x00000000 | 0x00000000 | 0 | 0x00000000 | 0 | 0x00001880 | 0x00000080 |
| 44 | 0x80000094 | csrrs t5, mcause, zero | 0 | 0x00000000 | 0x00000000 | 0x80000098 | 30 | 0x80000007 | 0x00000000 | 0 | 0x00000000 | 0 | 0x00001880 | 0x00000080 |
| 52 | 0x80000070 | bne s4, zero, 0x8000007c | 0 | 0x00000000 | 0x00000000 | 0x8000007c | 0 | 0x00000000 | 0x00000000 | 0 | 0x00000000 | 0 | 0x00001888 | 0x00000000 |
| 54 | 0x80000080 | lw t2, 0(t0) | 1 | 0x00000005 | 0x10007000 | 0x80000094 | 0 | 0x00000000 | 0x00000000 | 0 | 0x00000000 | 0 | 0x00001880 | 0x00000000 |
| Entry | Your decision |
|---|---|
| LBU_MASK | mem_rmask of the lbu record. |
| ECALL_NEXT | next_pc of the ecall record (the handler's address). |
| RETIRED | minstret after all 67 records. |
| IRQ_ORDER | The order of the record that took the timer interrupt. |
| IRQ_MEPC | mepc after the interrupt record (the pc the handler will return to). |
| AGAIN_ORDER | The order of the record where that interrupted instruction finally retires. |
| CSRRS_WRITE | csr_write of csrrs a3, mstatus, zero. |
| FAULT_TVAL | tval of the load fault. |
| FAULT_MEM | mem_addr of the load fault record. |
| IRQ_MIE | Bit 3 (MIE) of mstatus after the interrupt record, as 0 or 1. |
| RETIRED_AT | minstret 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