Hi everyone,
I am working on a FE310 on the HiFive1 and I have a piece of code that is supposed to clear the “target 0 enables” register (0xc002000).
The compiler (GCC with Ada front-end) generates an amoswap instruction for that, but it looks like the instruction doesn’t have any effect.
You will find my debug session below.
I single step over the: amoswap.w zero,a4,(a5)
instruction where $a5=0xc002000
and $a4=0x0
.
The value of the PLIC register at 0xc002000
doesn’t seem to change…
0xc002000: 0xd7feddfe
Is there something special with the amoswap instruction on PLIC registers?
Dump of assembler code from 0x204037ca to 0x204037f2:
[…]
=> 0x204037de <system__bb__riscv_plic__initialize+22>: amoswap.w zero,a4,(a5)
0x204037e2 <system__bb__riscv_plic__initialize+26>: lui a4,0xc000
[…]
End of assembler dump.
0x204037de 57 (others => (As_Array => True, Arr => (others => False)));
(gdb) p $a5
$8 = 0xc002000
(gdb) x/x $a5
0xc002000: 0xd7feddfe
(gdb) p $a4
$9 = 0x0
(gdb) si
Dump of assembler code from 0x204037ce to 0x204037f6:
[…]
0x204037de <system__bb__riscv_plic__initialize+22>: amoswap.w zero,a4,(a5)
=> 0x204037e2 <system__bb__riscv_plic__initialize+26>: lui a4,0xc000
[…]
End of assembler dump.
(gdb) x/x $a5
0xc002000: 0xd7feddfe