Checking the PLIC and CLINT Implementations in Spike

Continued from the previous article. I had assumed exception interrupt #7 was an exception, but it turned out to be an interrupt.

This tells us that a timer interrupt was already being raised at the point where this interrupt was taken. Timer interrupts should be generated by the CLINT, so let me check that area.

core   0: 3 0x0000000000002b2c (0x01851863)
core   0: 0x0000000000002b3c (0x00813583) ld      a1, 8(sp)
core   0: 3 0x0000000000002b3c (0x00813583) x11 0x00000000100001c0 mem 0x0000000010001e38
core   0: 0x0000000000002b40 (0x0014849b) addiw   s1, s1, 1
core   0: 3 0x0000000000002b40 (0x0014849b) x 9 0x0000000000000018
core   0: 0x0000000000002b44 (0x000b00e7) jalr    s6
core   0: 3 0x0000000000002b44 (0x000b00e7) x 1 0x0000000000002b48
core   0: >>>>  litex_putc
core   0: 0x000000000000316c (0xff010113) addi    sp, sp, -16
core   0: 3 0x000000000000316c (0xff010113) x 2 0x0000000010001e20
core   0: exception interrupt #7, epc 0x0000000000003170
core   0: >>>>  trap_entry
core   0: 0x0000000000000020 (0xfe113c23) sd      ra, -8(sp)
core   0: 3 0x0000000000000020 (0xfe113c23) mem 0x0000000010001e18 0x0000000000002b48
core   0: 0x0000000000000024 (0xfe513823) sd      t0, -16(sp)
core   0: 3 0x0000000000000024 (0xfe513823) mem 0x0000000010001e10 0x0000000010000b48
core   0: 0x0000000000000028 (0xfe613423) sd      t1, -24(sp)
core   0: 3 0x0000000000000028 (0xfe613423) mem 0x0000000010001e08 0x0000000010000b48
core   0: 0x000000000000002c (0xfe713023) sd      t2, -32(sp)
core   0: 3 0x000000000000002c (0xfe713023) mem 0x0000000010001e00 0x0000000000005d70
core   0: 0x0000000000000030 (0xfca13c23) sd      a0, -40(sp)
core   0: 3 0x0000000000000030 (0xfca13c23) mem 0x0000000010001df8 0x000000000000005f
core   0: 0x0000000000000034 (0xfcb13823) sd      a1, -48(sp)
core   0: 3 0x0000000000000034 (0xfcb13823) mem 0x0000000010001df0 0x00000000100001c0
core   0: 0x0000000000000038 (0xfcc13423) sd      a2, -56(sp)

But then I found that the latest Spike already implements the CLINT and the PLIC. I hadn't noticed. Let me take a look at that.


This is an English translation of the original Japanese post: SpikeのPLICとCLINTの実装を確認する