C8 Computer organization · Practice
Interrupts and exceptions
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
0 solved
0 in a row
0 of 9 kinds solid
Check
An ecall at address 0x060C traps to a handler. Before its mret, what should the handler put in mepc so the program continues after the ecall?
Check
Finish the handler so it adds 100 to a0 and returns to the instruction after the ecall.
RISC-V RV32IM (base integer plus multiply and divide). End your program with ebreak. Tab indents; press Esc and then Tab to move on.
Check
A timer counts at 8 MHz. For an interrupt every 1 ms, how much should the handler add to TIMECMP each time?
Check
A timer interrupt fires every 100 instructions, and its handler runs 17 of them. What percentage of the processor's time goes to the handler?
Check
Entry takes 3 cycles and mret 3. A handler adjusts sp twice, saves and restores 4 registers and does 50 cycles of work, at 48 MHz.
(a)
How many cycles does each interrupt cost?
(b)
What share of the core does a 10 kHz interrupt rate use?
Check
The cause code is 7.
(a)
What's mcause for a machine-mode interrupt with that code?
(b)
And for an exception with the same code?
Check
ecall at 0x058C. mepc for the handler to return past it?
Check
12 MHz timer, a tick every 2 ms. TIMECMP step?
Check
A 22-instruction handler every 400 instructions. Share of time?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C8